So I have a large methodmap which inherits from StringMap. Getting and setting properties are fairly copy-paste but I wanted to make it stupidly simpler with macros.
I got these:
PHP Code:
#define IntGet(%1) public get()\
{\
int i; this.GetValue(%1, i);\
return i;\
}
#define IntSet(%1) public set( const int i )\
{\
this.SetValue(%1, i);\
}
// And so on with bool and float
Moving to a property...
PHP Code:
property int iRoundState
{
IntGet("iRoundState")
IntSet("iRoundState")
}
Which compiles just fine, but I wanna make it
even simpler with just a single macro. So I tried this:
PHP Code:
#define DoInt(%1) IntGet(%1)IntSet(%1)
Which spews "error 155: expected newline, but found 'public'" when used. So after a bunch of variations of the such I was never able to get it to work. Is this "one line wonder" even possible?
And yes I know a lot of people hate macros
__________________