diff options
Diffstat (limited to 'include/swobject.h')
-rw-r--r-- | include/swobject.h | 11 |
1 files changed, 6 insertions, 5 deletions
diff --git a/include/swobject.h b/include/swobject.h index 974f982..27eafd6 100644 --- a/include/swobject.h +++ b/include/swobject.h @@ -8,9 +8,9 @@ #endif #include <defs.h> -#include <string.h> -#define SWDYNAMIC_CAST(className, object) (className *)((object->getClass()->isAssignableFrom(#className))?object:0) +SWORD_NAMESPACE_START +#define SWDYNAMIC_CAST(className, object) (className *)((object)?((object->getClass()->isAssignableFrom(#className))?object:0):0) /** * Class used for SWDYNAMIC_CAST to save the inheritance order. @@ -20,13 +20,13 @@ private: const char **descends; public: - SWClass (const char **descends) { + SWClass(const char **descends) { this->descends = descends; } - bool isAssignableFrom (const char *className) const { + bool isAssignableFrom(const char *className) const { for (int i = 0; descends[i]; i++) { - if (!stricmp (descends[i], className)) + if (!stricmp(descends[i], className)) return true; } return false; @@ -51,4 +51,5 @@ public: } }; +SWORD_NAMESPACE_END #endif |