/* orxonox - the future of 3D-vertical-scrollers Copyright (C) 2004 orx This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2, or (at your option) any later version. ### File Specific: main-programmer: Patrick Boenzli co-programmer: ... */ #include "base_object.h" #include "load_param.h" using namespace std; /** \brief sets the name from a LoadXML-Element \param root the element to load from */ BaseObject::BaseObject(const TiXmlElement* root) { this->className = NULL; this->classID = CL_BASE_OBJECT; this->finalized = false; this->objectName = NULL; if (root) this->loadParams(root); } /** \brief standard deconstructor */ BaseObject::~BaseObject () { // delete []this->className; if (this->objectName) delete []this->objectName; } /** \brief loads parameters \param root the element to load from */ void BaseObject::loadParams(const TiXmlElement* root) { // name setup LoadParam(root, "name", this, &BaseObject::setName) .describe("the name of the Object at hand"); } /** \brief sets the class identifiers \param id a number for the class from class_list.h enumeration \param className the class name */ void BaseObject::setClassID(long classID, const char* className) { this->setClassID(classID); this->setClassName(className); } /** \brief sets the class identifier \param id a number for the class from class_list.h enumeration */ void BaseObject::setClassID (long classID) { this->classID = classID; } /** \brief sets the class identifiers \param className the class name */ void BaseObject::setClassName(const char* className) { this->className = className; } /* \brief sets the class identifiers \param a number for the class from class_list.h enumeration \param the class name bool BaseObject::isA (char* className) { if( this->className == className) return false; return true; } */ /** \brief set the name of the Object */ void BaseObject::setName (const char* objectName) { if (this->objectName) delete []this->objectName; if (objectName) { this->objectName = new char[strlen(objectName)+1]; strcpy(this->objectName, objectName); } else this->objectName = NULL; }