I have a case where I'm using a macro to generate simple subclasses. I've currently got it defined as:
#define REGISTER( TYPE, NAME ) \
struct NAME ## Class : public ParentClass \
{ \
NAME ## Class () : ParentClass ( # NAME ); \
}
I really want the Name to contain a period, but then the macro gets expanded to this and doesn't work:
struct Simple.ClassClass : public ParentClass
{
Simple.ClassClass () : ParentClass ("Simple.Class");
};
Is there anyway to use a preprocessor definition to get rid of the period in the name? Then I could keep the period in the string (as desired) and have the class name use a different (legal) character.
The class name doesn't matter (as long as it's unique). The only thing that matters is the readable string.
I have access to Boost.Preprocessor, but I couldn't understand if any of it would be useful for this.
Thanks.
EDIT: The reason behind this is I'm implementing the Industrial Strength Pluggable Factories as a template and a macro for easy generation of the maker class. There may be a lot of maker IDs though so I want the ability to "namespace" them by using a dot. I'm doing it right now with underscores already, I was just curious if I could get it working with a dot instead because I find it more visually pleasing. The only important part is that since another person besides me who is writing code would not see the code the macro generates, the macro can't do any insidious stuff behind the scenes. So whatever string gets put in as the name must be the key used to retrieve the item.
I relooked at the problem this morning and I think I can just avoid macros all together. Thanks anyway.