By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
455,514 Members | 1,728 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 455,514 IT Pros & Developers. It's quick & easy.

Split A Macro (mockpp)

P: n/a
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)
Oct 29 '05 #1
Share this Question
Share on Google+
4 Replies


P: n/a
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.

V
Oct 29 '05 #2

P: n/a
"Victor Bazarov" <v.********@comAcast.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);

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)
Oct 29 '05 #3

P: n/a
Steven Woody wrote:
"Victor Bazarov" <v.********@comAcast.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?
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...
Oct 29 '05 #4

P: n/a
"Victor Bazarov" <v.********@comAcast.net> writes:
Steven Woody wrote:
"Victor Bazarov" <v.********@comAcast.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.
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)
Oct 30 '05 #5

This discussion thread is closed

Replies have been disabled for this discussion.