Created
June 27, 2012 16:14
-
-
Save pghalliday/3005134 to your computer and use it in GitHub Desktop.
Blog - OOOCode - Part 2 - Gist 2
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include "MyClass.h" | |
#define OOOClass MyClass | |
OOOPrivateData | |
int nMyField; | |
OOOPrivateDataEnd | |
OOODestructor | |
{ | |
} | |
OOODestructorEnd | |
OOOMethod(int, getMyField) | |
{ | |
return OOOF(nMyField); | |
} | |
OOOMethodEnd | |
OOOMethod(int, getData) | |
{ | |
return OOOC(getMyField); | |
} | |
OOOMethodEnd | |
OOOConstructor(int nMyField) | |
{ | |
#define OOOInterface IMyInterface | |
OOOMapVirtuals | |
OOOVirtualMapping(getData) | |
OOOMapVirtualsEnd | |
#undef OOOInterface | |
OOOMapMethods | |
OOOMethodMapping(getMyField) | |
OOOMapMethodsEnd | |
OOOF(nMyField) = nMyField; | |
} | |
OOOConstructorEnd | |
#undef OOOClass |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#ifndef MYCLASS_H_ | |
#define MYCLASS_H_ | |
#include "OOOCode.h" | |
#include "IMyInterface.h" | |
#define OOOClass MyClass | |
OOODeclare(int nMyField) | |
OOOImplements | |
OOOImplement(IMyInterface); | |
OOOImplementsEnd | |
OOOExports | |
OOOExport(int, getMyField); | |
OOOExportsEnd | |
OOODeclareEnd | |
#undef OOOClass | |
#endif |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include "OOOUnitTestDefines.h" | |
#include "MyClass.h" | |
OOOTest(MyClass) | |
{ | |
MyClass * pMyClass = OOOConstruct(MyClass, 5); | |
MyClass * pMyClassCopy = OOOCall(pMyClass, copy); | |
/* Check stuff here */ | |
OOOCheck(OOOCall(pMyClass, getMyField) == 5); | |
OOOCheck(OOOICall(OOOCast(IMyInterface, pMyClass), getData) == 5); | |
OOOCheck(OOOCall(pMyClassCopy, isEqual, pMyClass)); | |
OOOCheck(OOOCall(pMyClassCopy , getMyField) == 5); | |
OOOCheck(pMyClassCopy != pMyClass); | |
OOODestroy(pMyClass); | |
OOODestroy(pMyClassCopy); | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include "MyClass.h" | |
#define OOOClass MyClass | |
OOOPrivateData | |
int nMyField; | |
OOOPrivateDataEnd | |
OOODestructor | |
{ | |
} | |
OOODestructorEnd | |
OOOMethod(int, getMyField) | |
{ | |
return OOOF(nMyField); | |
} | |
OOOMethodEnd | |
OOOMethod(MyClass *, copy) | |
{ | |
return OOOConstruct(MyClass, OOOF(nMyField)); | |
} | |
OOOMethodEnd | |
OOOMethod(bool, isEqual, MyClass * pCompare) | |
{ | |
return (OOOF(nMyField) == OOOPCall(pCompare, getMyField)); | |
} | |
OOOMethodEnd | |
OOOMethod(int, getData) | |
{ | |
return OOOC(getMyField); | |
} | |
OOOMethodEnd | |
OOOConstructor(int nMyField) | |
{ | |
#define OOOInterface IMyInterface | |
OOOMapVirtuals | |
OOOVirtualMapping(getData) | |
OOOMapVirtualsEnd | |
#undef OOOInterface | |
OOOMapMethods | |
OOOMethodMapping(getMyField), | |
OOOMethodMapping(copy), | |
OOOMethodMapping(isEqual) | |
OOOMapMethodsEnd | |
OOOF(nMyField) = nMyField; | |
} | |
OOOConstructorEnd | |
#undef OOOClass |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#ifndef MYCLASS_H_ | |
#define MYCLASS_H_ | |
#include "OOOCode.h" | |
#include "IMyInterface.h" | |
#define OOOClass MyClass | |
OOODeclare(int nMyField) | |
OOOImplements | |
OOOImplement(IMyInterface); | |
OOOImplementsEnd | |
OOOExports | |
OOOExport(int, getMyField); | |
OOOExport(MyClass *, copy); | |
OOOExport(bool, isEqual, MyClass * pCompare); | |
OOOExportsEnd | |
OOODeclareEnd | |
#undef OOOClass | |
#endif |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment