Changeset 7218 in orxonox.OLD for branches/std/src/lib/lang
- Timestamp:
- Mar 12, 2006, 3:00:04 PM (19 years ago)
- Location:
- branches/std/src/lib/lang
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
branches/std/src/lib/lang/base_object.cc
r7216 r7218 34 34 BaseObject::BaseObject() 35 35 { 36 this->classID = CL_BASE_OBJECT; 36 37 this->className = "BaseObject"; 37 this->classID = CL_BASE_OBJECT;38 38 39 39 this->objectName = ""; … … 78 78 * @param className the class name 79 79 */ 80 void BaseObject::setClassID(ClassID classID, const char*className)80 void BaseObject::setClassID(ClassID classID, const std::string& className) 81 81 { 82 82 //printf("%s(0x%.8X)->%s(0x%.8X)\n", this->className, this->classID, className, classID); … … 150 150 * @returns true if it is, false otherwise 151 151 */ 152 bool BaseObject::isA (const char*className) const152 bool BaseObject::isA (const std::string& className) const 153 153 { 154 154 ClassID classID = ClassList::StringToID(className); … … 163 163 * @returns true on match, false otherwise. 164 164 */ 165 bool BaseObject::operator==(const char*objectName)166 { 167 return ( objectName != NULL &&this->objectName == objectName);165 bool BaseObject::operator==(const std::string& objectName) 166 { 167 return (this->objectName == objectName); 168 168 } 169 169 -
branches/std/src/lib/lang/base_object.h
r7214 r7218 38 38 39 39 /** @returns the className of the corresponding Object */ 40 inline const char* getClassName() const { return this->className ; };40 inline const char* getClassName() const { return this->className.c_str(); }; 41 41 /** @returns the classID of the corresponding Object */ 42 42 inline int getClassID() const { return this->classID; }; … … 44 44 45 45 bool isA (ClassID classID) const; 46 bool isA (const char*className) const;46 bool isA (const std::string& className) const; 47 47 void whatIs() const; 48 48 49 bool operator==(const char*objectName);49 bool operator==(const std::string& objectName); 50 50 /** @param classID comparer for a ClassID @returns true on match, false otherwise */ 51 51 bool operator==(ClassID classID) { return this->isA(classID); }; … … 55 55 56 56 protected: 57 void setClassID(ClassID classID, const char*className);57 void setClassID(ClassID classID, const std::string& className); 58 58 59 59 private: 60 const char*className; //!< the name of the class60 std::string className; //!< the name of the class 61 61 long classID; //!< this is the id from the class_id.h enumeration 62 62 std::string objectName; //!< The name of this object
Note: See TracChangeset
for help on using the changeset viewer.