Changeset 9692 in orxonox.OLD for branches/new_class_id
- Timestamp:
- Aug 23, 2006, 12:43:25 AM (18 years ago)
- Location:
- branches/new_class_id/src/lib
- Files:
-
- 13 edited
Legend:
- Unmodified
- Added
- Removed
-
branches/new_class_id/src/lib/lang/new_object_list.h
r9691 r9692 36 36 NewObjectListDefinitionID(ClassName, -1) 37 37 38 38 class BaseObject; 39 39 //! The superclass that all NewObjectLists follow. 40 40 /** … … 44 44 { 45 45 public: 46 //! An iterator Base-Class, for iterator-casting and storing. 46 class base_iterator 47 { 48 public: 49 virtual base_iterator operator++() = 0; 50 virtual base_iterator operator--() = 0; 51 virtual BaseObject* operator*() = 0; 52 virtual base_iterator& operator=(const base_iterator& iterator) = 0; 53 virtual bool operator==(const base_iterator& iterator) = 0; 54 protected: 55 void* _it; 56 }; 57 58 virtual base_iterator& base_begin() = 0; 59 virtual base_iterator& base_end() = 0; 60 61 //! A fast iterator Base-Class, for iterator-casting and storing. 62 /** 63 * @note This Iterator is explicitely used only for storage purposes 64 */ 47 65 class IteratorBase { }; 48 66 … … 76 94 77 95 protected: 78 typedef std::map<int, NewObjectListBase*> classIDMap;//!< The Generic Map.79 typedef std::map<std::string, NewObjectListBase*> classNameMap; //!< The Generic Map.96 typedef std::map<int, NewObjectListBase*> classIDMap; //!< The Generic Map. 97 typedef std::map<std::string, NewObjectListBase*> classNameMap; //!< The Generic Map. 80 98 81 99 NewClassID _identity; //!< The Identity of the Class (ID and Name). … … 108 126 typedef typename list::const_iterator const_iterator; 109 127 128 virtual base_iterator& base_begin() { }; 129 virtual base_iterator& base_end() { }; 130 131 110 132 class Iterator : public NewObjectListBase::IteratorBase 111 133 { -
branches/new_class_id/src/lib/script_engine/script.cc
r9298 r9692 24 24 25 25 #include "class_list.h" 26 CREATE_SCRIPTABLE_CLASS(Script, CL_SCRIPT,26 CREATE_SCRIPTABLE_CLASS(Script, Script::classID(), 27 27 addMethod("addObject", ExecutorLua2<Script,const std::string&, const std::string& >(&Script::addObject)) 28 28 ->addMethod("registerClass", ExecutorLua1<Script,const std::string&>(&Script::registerClass)) … … 31 31 ); 32 32 33 NewObjectListDefinition(Script); 34 33 35 Script::Script(const TiXmlElement* root) 34 36 { 35 this-> setClassID(CL_SCRIPT, "Script");37 this->registerObject(this, Script::_objectList); 36 38 37 39 returnCount = argumentCount = 0; … … 64 66 luaopen_math(luaState); 65 67 luaopen_debug(luaState); 66 68 67 69 this->loadFile(filename); 68 70 … … 100 102 std::string filedest(ResourceManager::getInstance()->getDataDir()); 101 103 filedest += "scripts/" + filename; 102 104 103 105 this->addThisScript(); 104 106 this->registerStandartClasses(); 105 107 106 108 if(currentFile.length() != 0) 107 109 { … … 295 297 lua_remove(luaState,-1*returnCount); 296 298 returnCount--; 297 299 298 300 } 299 301 } … … 375 377 { 376 378 bool success = false; 377 379 378 380 //this->registerClass(std::string("Vector")); 379 381 this->registerClass("ScriptTrigger"); … … 382 384 return success; 383 385 } 384 385 386 387 386 388 void Script::registerClass( const std::string& className) 387 389 { … … 400 402 } 401 403 } 402 404 403 405 } 404 406 -
branches/new_class_id/src/lib/script_engine/script.h
r9298 r9692 22 22 class Script : public BaseObject 23 23 { 24 NewObjectListDeclaration(Script); 24 25 public: 25 26 Script(const TiXmlElement* root = NULL); … … 33 34 bool loadFile(const std::string& filename); 34 35 void addObject( const std::string& className,const std::string& objectName); 35 void registerClass(const std::string& className); //!< Register a class but dont add any instances 36 void registerClass(const std::string& className); //!< Register a class but dont add any instances 36 37 37 38 /// QUERRYING -
branches/new_class_id/src/lib/script_engine/script_class.cc
r8711 r9692 19 19 #include <cassert> 20 20 21 NewObjectListDefinition(ScriptClass); 21 22 /** 22 23 * @brief standard constructor … … 27 28 { 28 29 assert(scriptMethods != NULL); 29 this-> setClassID(CL_SCRIPT_CLASS, "ScriptClass");30 this->registerObject(this, Shell::_objectList); 30 31 31 32 this->_classID = classID; -
branches/new_class_id/src/lib/shell/shell.cc
r8362 r9692 54 54 ->completionPlugin(0, OrxShell::CompletorFileSystem(".ttf", "fonts/")); 55 55 56 NewObjectListDefinition(Shell); 56 57 57 58 /** … … 60 61 Shell::Shell () 61 62 { 62 this->setClassID(CL_SHELL, "Shell"); 63 this->registerObject(this, Shell::_objectList); 64 63 65 this->setName("Shell"); 64 66 -
branches/new_class_id/src/lib/shell/shell.h
r7762 r9692 48 48 class Shell : public Element2D, public EventListener 49 49 { 50 50 NewObjectListDeclaration(Shell); 51 51 public: 52 52 Shell(); -
branches/new_class_id/src/lib/shell/shell_buffer.h
r8145 r9692 24 24 class ShellBuffer 25 25 { 26 27 26 public: 28 27 virtual ~ShellBuffer(); -
branches/new_class_id/src/lib/shell/shell_command.cc
r9406 r9692 21 21 #include "compiler.h" 22 22 #include "debug.h" 23 #include "class_list.h"24 23 25 24 #include "key_names.h" … … 28 27 { 29 28 SHELL_COMMAND(debug, ShellCommandClass, help); 29 NewObjectListDefinition(ShellCommand); 30 30 31 31 … … 38 38 ShellCommand::ShellCommand(const std::string& commandName, const std::string& className, Executor* executor) 39 39 { 40 this-> setClassID(CL_SHELL_COMMAND, "ShellCommand");40 this->registerObject(this, ShellCommand::_objectList); 41 41 PRINTF(4)("create shellcommand '%s' for class '%s'\n", commandName.c_str(), className.c_str()); 42 42 this->setName(commandName); … … 94 94 void ShellCommand::unregisterCommand(const std::string& commandName, const std::string& className) 95 95 { 96 97 96 ShellCommandClass* cmdClass = ShellCommandClass::acquireCommandClass(className); 98 97 if (cmdClass != NULL) 99 98 { 100 99 CmdList::iterator cmd; 101 for (cmd = cmdClass-> commandList.begin(); cmd != cmdClass->commandList.end(); cmd++)100 for (cmd = cmdClass->_commandList.begin(); cmd != cmdClass->_commandList.end(); cmd++) 102 101 if (commandName == (*cmd)->getName()) 103 102 { … … 119 118 120 119 CmdList::const_iterator elem; 121 for (unsigned int i = 0; i < cmdClass-> commandList.size(); i++)122 { 123 if (commandName == cmdClass-> commandList[i]->getName())124 return (cmdClass-> commandList[i]);120 for (unsigned int i = 0; i < cmdClass->_commandList.size(); i++) 121 { 122 if (commandName == cmdClass->_commandList[i]->getName()) 123 return (cmdClass->_commandList[i]); 125 124 } 126 125 return NULL; -
branches/new_class_id/src/lib/shell/shell_command.h
r8145 r9692 58 58 class ShellCommand : public BaseObject 59 59 { 60 NewObjectListDeclaration(ShellCommand); 61 60 62 friend class ShellCommandClass; 61 63 public: -
branches/new_class_id/src/lib/shell/shell_command_class.cc
r9406 r9692 21 21 22 22 #include "debug.h" 23 #include "class_list.h"24 23 #include "compiler.h" 25 24 … … 28 27 namespace OrxShell 29 28 { 29 NewObjectListDefinition(ShellCommandClass); 30 30 31 CmdClassList* ShellCommandClass::commandClassList = NULL; 31 32 … … 35 36 */ 36 37 ShellCommandClass::ShellCommandClass(const std::string& className) 37 : className(className)38 { 39 this-> setClassID(CL_SHELL_COMMAND_CLASS, "ShellCommandClass");38 : _className(className) 39 { 40 this->registerObject(this, ShellCommandClass::_objectList); 40 41 this->setName(className); 41 42 -
branches/new_class_id/src/lib/shell/shell_command_class.h
r8362 r9692 25 25 class ShellCommandClass : public BaseObject 26 26 { 27 NewObjectListDeclaration(ShellCommandClass); 28 27 29 friend class ShellCommand; 28 30 public: 29 31 /** @returns the CommandClassList */ 30 static const CmdClassList& getCommandClassList() { return *ShellCommandClass:: commandClassList; };32 static const CmdClassList& getCommandClassList() { return *ShellCommandClass::_commandClassList; }; 31 33 32 34 static bool getCommandListOfClass(const std::string& className, std::list<std::string>& stringList); … … 34 36 static void unregisterAllCommands(); 35 37 static ShellCommandClass* getCommandClass(const std::string& className); 36 ClassID getClassID();38 NewClassID getClassID(); 37 39 static bool exists(const std::string& className); 38 40 … … 51 53 52 54 private: 53 const std::string className; //!< The Name of the Class. This should match the ClassName of the Commands Class.54 ClassIDclassID; //!< The classID of this Class55 CmdList commandList; //!< A list of Commands from this Class55 const std::string _className; //!< The Name of the Class. This should match the ClassName of the Commands Class. 56 NewClassID _classID; //!< The classID of this Class 57 CmdList _commandList; //!< A list of Commands from this Class 56 58 57 static CmdClassList* commandClassList; //!< A list of Classes59 static CmdClassList* _commandClassList; //!< A list of Classes 58 60 }; 59 61 } -
branches/new_class_id/src/lib/shell/shell_input.cc
r8339 r9692 24 24 #include "compiler.h" 25 25 #include "key_names.h" 26 26 27 27 28 namespace OrxShell … … 31 32 ->setAlias("help"); 32 33 34 NewObjectListDefinition(ShellInput); 33 35 34 36 /** … … 39 41 : Text ("") 40 42 { 43 this->registerObject(this, ShellInput::_objectList); 44 41 45 this->pressedKey = SDLK_FIRST; 42 this->setClassID(CL_SHELL_INPUT, "ShellInput");43 46 44 47 this->inputLine = ""; -
branches/new_class_id/src/lib/shell/shell_input.h
r7858 r9692 30 30 class ShellInput : public Text, public EventListener 31 31 { 32 NewObjectListDeclaration(ShellInput); 32 33 33 34 public:
Note: See TracChangeset
for help on using the changeset viewer.