 |
C++Talk.NET C++ language newsgroups
|
| View previous topic :: View next topic |
| Author |
Message |
Steven Woody Guest
|
Posted: Sat Oct 29, 2005 3:47 am Post subject: Split A Macro (mockpp) |
|
|
i am using a third-party library (mockpp), which comes in many macro for
use. for example
MOCKPP_CHAINER_FOR_EXT(MyMock, do, ext) myDo (&myMock);
it declared and initialized a 'myDo' object in a combined form. but i want to
seperate the declaration from initialization for some purpose. what will the
syntax likely be?
--
steven woody (id: narke)
Angelica Bell: What happens to us when we die?
Virginia Woolf: ... We return to the place we came from.
Angelica Bell: I don't remember where I came from.
Virginia Woolf: Neither do I.
- The Hours (2002)
|
|
| Back to top |
|
 |
Victor Bazarov Guest
|
Posted: Sat Oct 29, 2005 4:45 am Post subject: Re: Split A Macro (mockpp) |
|
|
Steven Woody wrote:
| Quote: | i am using a third-party library (mockpp), which comes in many macro
for
use. for example
MOCKPP_CHAINER_FOR_EXT(MyMock, do, ext) myDo (&myMock);
it declared and initialized a 'myDo' object in a combined form. but i
want to seperate the declaration from initialization for some
purpose. what will the syntax likely be?
|
Have you tried looking at the headers to see how the macro is defined?
That would help, you know...
Try dropping the parentheses with the address of the 'myMock' thing.
MOCKPP_CHAINRE_FOR_EXT(MyMock, do, ext) myDo;
(that might create a declaration). If 'myDo' is a member, you will
need to initialise it in the c-tor's initialiser list. If it's not,
there is no initialisation, only assignment, after this.
V
|
|
| Back to top |
|
 |
Steven Woody Guest
|
Posted: Sat Oct 29, 2005 5:27 pm Post subject: Re: Split A Macro (mockpp) |
|
|
"Victor Bazarov" <v.Abazarov (AT) comAcast (DOT) net> writes:
| Quote: | Steven Woody wrote:
i am using a third-party library (mockpp), which comes in many macro
for
use. for example
MOCKPP_CHAINER_FOR_EXT(MyMock, do, ext) myDo (&myMock);
it declared and initialized a 'myDo' object in a combined form. but i
want to seperate the declaration from initialization for some
purpose. what will the syntax likely be?
Have you tried looking at the headers to see how the macro is defined?
That would help, you know...
Try dropping the parentheses with the address of the 'myMock' thing.
MOCKPP_CHAINRE_FOR_EXT(MyMock, do, ext) myDo;
(that might create a declaration). If 'myDo' is a member, you will
need to initialise it in the c-tor's initialiser list. If it's not,
there is no initialisation, only assignment, after this.
|
MOCKPP_CHAINER_FOR_EXT(...) is a #define, the above expanded to:
MyMock::FooBar myDo(&myMock);
so it seems clear the FooBar has to be constructed with a &myMock. if i
delcared it and initialize later, then the FooBar has to provide some method
leting me set in the &myMock. but i failed finding this information because
the library is toooooo complex and full of macro definitions.
--
steven woody (id: narke)
How Far You Fall Doesn't Matter, It's How You Land
- Haine, La (1995)
|
|
| Back to top |
|
 |
Victor Bazarov Guest
|
Posted: Sat Oct 29, 2005 8:50 pm Post subject: Re: Split A Macro (mockpp) |
|
|
Steven Woody wrote:
| Quote: | "Victor Bazarov" <v.Abazarov (AT) comAcast (DOT) net> writes:
Steven Woody wrote:
i am using a third-party library (mockpp), which comes in many macro
for
use. for example
MOCKPP_CHAINER_FOR_EXT(MyMock, do, ext) myDo (&myMock);
it declared and initialized a 'myDo' object in a combined form. but
i want to seperate the declaration from initialization for some
purpose. what will the syntax likely be?
Have you tried looking at the headers to see how the macro is
defined? That would help, you know...
Try dropping the parentheses with the address of the 'myMock' thing.
MOCKPP_CHAINRE_FOR_EXT(MyMock, do, ext) myDo;
(that might create a declaration). If 'myDo' is a member, you will
need to initialise it in the c-tor's initialiser list. If it's not,
there is no initialisation, only assignment, after this.
MOCKPP_CHAINER_FOR_EXT(...) is a #define, the above expanded to:
MyMock::FooBar myDo(&myMock);
|
How do you know? Did you look at the preprocessor output? What do
'do' and 'ext' mean?
| Quote: | so it seems clear the FooBar has to be constructed with a &myMock. if
i delcared it and initialize later, then the FooBar has to provide
some method leting me set in the &myMock.
|
If 'myDo' is a member of a class, you don't have a choice. A declaration
and an initialiser _have_to_ be separate.
| Quote: | but i failed finding this
information because the library is toooooo complex and full of macro
definitions.
|
My crystal ball is under the weather today, so I can't help you look it
up either. Sorry...
|
|
| Back to top |
|
 |
Steven Woody Guest
|
Posted: Sun Oct 30, 2005 11:13 am Post subject: Re: Split A Macro (mockpp) |
|
|
"Victor Bazarov" <v.Abazarov (AT) comAcast (DOT) net> writes:
| Quote: | Steven Woody wrote:
"Victor Bazarov" <v.Abazarov (AT) comAcast (DOT) net> writes:
Steven Woody wrote:
i am using a third-party library (mockpp), which comes in many macro
for
use. for example
MOCKPP_CHAINER_FOR_EXT(MyMock, do, ext) myDo (&myMock);
it declared and initialized a 'myDo' object in a combined form. but
i want to seperate the declaration from initialization for some
purpose. what will the syntax likely be?
Have you tried looking at the headers to see how the macro is
defined? That would help, you know...
Try dropping the parentheses with the address of the 'myMock' thing.
MOCKPP_CHAINRE_FOR_EXT(MyMock, do, ext) myDo;
(that might create a declaration). If 'myDo' is a member, you will
need to initialise it in the c-tor's initialiser list. If it's not,
there is no initialisation, only assignment, after this.
MOCKPP_CHAINER_FOR_EXT(...) is a #define, the above expanded to:
MyMock::FooBar myDo(&myMock);
How do you know? Did you look at the preprocessor output? What do
'do' and 'ext' mean?
|
i checked the headers for the difinition. MyMock is a mock class which was
gernerated to mocking a real object. so, the 'do' is a mehtod in the interface
of the real class. MOCKPP_CHAINER_FOR_EXE(...) used to create a object which
control how the mock object will behavior when the 'do' is called. and 'ext' is
just a text extension to prevent any possible name conflicts.
| Quote: |
so it seems clear the FooBar has to be constructed with a &myMock. if
i delcared it and initialize later, then the FooBar has to provide
some method leting me set in the &myMock.
If 'myDo' is a member of a class, you don't have a choice. A declaration
and an initialiser _have_to_ be separate.
but i failed finding this
information because the library is toooooo complex and full of macro
definitions.
My crystal ball is under the weather today, so I can't help you look it
up either. Sorry...
|
might there are someone who know the MOCKPP ...
--
steven woody (id: narke)
Pepper...is hot and scorches, just like the sun
- Politiki kouzina (2003)
|
|
| Back to top |
|
 |
|
|
You cannot post new topics in this forum You cannot reply to topics in this forum You cannot edit your posts in this forum You cannot delete your posts in this forum You cannot vote in polls in this forum
|
|