diff options
author | Andy Cedilnik <andy.cedilnik@kitware.com> | 2005-06-17 17:04:56 (GMT) |
---|---|---|
committer | Andy Cedilnik <andy.cedilnik@kitware.com> | 2005-06-17 17:04:56 (GMT) |
commit | d9dc9b54a62c20be2cf42ce050780e1b924e412c (patch) | |
tree | fbc9478d4a3559ec8c6ee5c61a008e031c982f99 /Source/cmCommand.h | |
parent | d3239ac68f4cc74e5f5c7cecf876f07262bbf57e (diff) | |
download | CMake-d9dc9b54a62c20be2cf42ce050780e1b924e412c.zip CMake-d9dc9b54a62c20be2cf42ce050780e1b924e412c.tar.gz CMake-d9dc9b54a62c20be2cf42ce050780e1b924e412c.tar.bz2 |
ENH: Add superclass for all commands and handlers. Improve handlers to have initialization code, and start initializing ctest when start is invoked
Diffstat (limited to 'Source/cmCommand.h')
-rw-r--r-- | Source/cmCommand.h | 49 |
1 files changed, 4 insertions, 45 deletions
diff --git a/Source/cmCommand.h b/Source/cmCommand.h index d26eea5..0143047 100644 --- a/Source/cmCommand.h +++ b/Source/cmCommand.h @@ -17,6 +17,7 @@ #ifndef cmCommand_h #define cmCommand_h +#include "cmObject.h" #include "cmListFileCache.h" #include "cmMakefile.h" @@ -30,9 +31,11 @@ * to support such features as enable/disable, inheritance, * documentation, and construction. */ -class cmCommand +class cmCommand : public cmObject { public: + cmTypeMacro(cmCommand, cmObject); + /** * Construct the command. By default it is enabled with no makefile. */ @@ -104,11 +107,6 @@ public: virtual const char* GetName() = 0; /** - * The class name of the command. - */ - virtual const char* GetNameOfClass() = 0; - - /** * Succinct documentation. */ virtual const char* GetTerseDocumentation() = 0; @@ -156,19 +154,6 @@ public: } /** - * Returns true if this class is the given class, or a subclass of it. - */ - static bool IsTypeOf(const char *type) - { return !strcmp("cmCommand", type); } - - /** - * Returns true if this object is an instance of the given class or - * a subclass of it. - */ - virtual bool IsA(const char *type) - { return cmCommand::IsTypeOf(type); } - - /** * Set the error message */ void SetError(const char* e) @@ -186,30 +171,4 @@ private: std::string m_Error; }; -// All subclasses of cmCommand should invoke this macro. -#define cmTypeMacro(thisClass,superclass) \ -virtual const char* GetNameOfClass() { return #thisClass; } \ -typedef superclass Superclass; \ -static bool IsTypeOf(const char *type) \ -{ \ - if ( !strcmp(#thisClass,type) ) \ - { \ - return true; \ - } \ - return Superclass::IsTypeOf(type); \ -} \ -virtual bool IsA(const char *type) \ -{ \ - return thisClass::IsTypeOf(type); \ -} \ -static thisClass* SafeDownCast(cmCommand *c) \ -{ \ - if ( c && c->IsA(#thisClass) ) \ - { \ - return (thisClass *)c; \ - } \ - return 0;\ -} - - #endif |