Changeset 9777 in orxonox.OLD for branches/new_class_id/src
- Timestamp:
- Sep 20, 2006, 9:49:13 AM (18 years ago)
- Location:
- branches/new_class_id/src/lib
- Files:
-
- 1 deleted
- 9 edited
Legend:
- Unmodified
- Added
- Removed
-
branches/new_class_id/src/lib/shell/shell_command.cc
r9734 r9777 300 300 if (sc != NULL) 301 301 { 302 for(std::vector<BaseObject*>::const_iterator bo = boList.begin(); bo != boList.end(); ++bo) 303 { 304 PRINT(0)("Command '%s' on '%s::%s'\n", sc->getCName(), (*bo)->getClassCName(), (*bo)->getCName()); 305 (*sc->executor)((*bo), inputSplits.subSet(paramBegin)); 306 } 302 303 if(sc->executor->getType() == Executor<const SubString>::FunctionStatic ) 304 { 305 PRINT(0)("Static Command '%s' of Class '%s' with parameters\n", sc->getCName(), sc->shellClass->getCName()); 306 (*sc->executor)(NULL, inputSplits.subSet(paramBegin)); 307 } 308 else 309 for(std::vector<BaseObject*>::const_iterator bo = boList.begin(); bo != boList.end(); ++bo) 310 { 311 PRINT(0)("Command '%s' on '%s::%s'\n", sc->getCName(), (*bo)->getClassCName(), (*bo)->getCName()); 312 (*sc->executor)((*bo), inputSplits.subSet(paramBegin)); 313 } 307 314 return true; 308 315 } … … 377 384 else 378 385 { 379 // if(this->completors[parameter] == NULL)380 // delete this->completors[parameter];381 // this->completors[parameter] = completorPlugin.clone();386 // if(this->completors[parameter] == NULL) 387 // delete this->completors[parameter]; 388 // this->completors[parameter] = completorPlugin.clone(); 382 389 } 383 390 return this; -
branches/new_class_id/src/lib/shell/shell_command.h
r9769 r9777 56 56 */ 57 57 #define SHELL_COMMAND_STATIC(command, class, function) \ 58 OrxShell::ShellCommand* shell_command_##class##_##command = OrxShell::ShellCommand::registerCommand(#command, #class, createExecutor<class, BaseObject>( function))58 OrxShell::ShellCommand* shell_command_##class##_##command = OrxShell::ShellCommand::registerCommand(#command, #class, createExecutor<class, BaseObject>(&class::function)) 59 59 60 60 -
branches/new_class_id/src/lib/shell/some_shell_commands.cc
r9721 r9777 29 29 30 30 #include "network_game_rules.h" 31 31 SHELL_COMMAND(say, NetworkGameRules, shellSay)->setAlias("say"); 32 32 33 33 #include "player_stats.h" 34 34 SHELL_COMMAND(nick, PlayerStats, shellNick)->setAlias("nick"); 35 35 36 36 // #include "class_list.h" … … 40 40 41 41 #include "p_node.h" 42 43 42 SHELL_COMMAND(debugNode, PNode, debugNode); 43 SHELL_COMMAND(setPosition, PNode, setAbsCoor); 44 44 45 45 #include "render_2d.h" 46 46 SHELL_COMMAND(toggleNodeVisibility, Render2D, toggleNodesVisibility); 47 47 48 48 49 49 #include "material.h" 50 51 52 50 SHELL_COMMAND(setDiffuseTexture, Material, setDiffuseMap) 51 ->defaultValues(MT_NULL, (int)GL_TEXTURE_2D) 52 ->completionPlugin(0, CompletorFileSystem()); 53 53 54 54 #include "loading/resource_manager.h" 55 55 SHELL_COMMAND(debug, ResourceManager, debug); 56 #include "loading/load_param_class_description.h" 57 OrxShell::ShellCommand* shell_command_LPCD_printAll = 58 OrxShell::ShellCommand::registerCommand("printAll", "LoadParamClassDescription", 59 new Executor2_static<LoadParamClassDescription, const SubString, const std::string&, bool>(&LoadParamClassDescription::printAll)) 60 //SHELL_COMMAND_STATIC(print, LoadParamClassDescription, printAll) 61 ->defaultValues(MT_NULL, true); -
branches/new_class_id/src/lib/util/Makefile.am
r9768 r9777 19 19 loading/game_loader.cc \ 20 20 loading/load_param.cc \ 21 loading/load_param_xml.cc \22 21 loading/load_param_description.cc \ 23 22 loading/load_param_class_description.cc \ -
branches/new_class_id/src/lib/util/loading/load_param.cc
r9776 r9777 106 106 return NULL; 107 107 } 108 109 110 -
branches/new_class_id/src/lib/util/loading/load_param_class_description.cc
r9776 r9777 114 114 } 115 115 116 117 118 119 116 /** 120 117 * @brief prints out all loadable Classes, and their parameters 121 118 * @param fileName prints the output to a File 122 * @ todo implement it119 * @param withComments if Comments should be included. 123 120 */ 124 void LoadParamClassDescription::printAll(const std::string& fileName )121 void LoadParamClassDescription::printAll(const std::string& fileName, bool withComments) 125 122 { 126 PRINT(0)("===============================================================\n"); 127 PRINT(0)(" Listing all the Loadable Options (loaded since Game started).\n\n"); 123 printf("================== function called\n"); 124 125 FILE* stream; 126 if( (stream = fopen (fileName.c_str(), "w")) == NULL) 127 { 128 PRINTF(2)("File '%s' could not be opened for writing\n Printing to stdout\n", fileName.c_str()); 129 LoadParamClassDescription::printAllTo(stdout, withComments); 130 return; 131 } 132 else 133 LoadParamClassDescription::printAllTo(stream, withComments); 134 135 fclose (stream); 136 } 137 138 /** 139 * @brief prints out all loadable Classes, and their parameters to a stream 140 * @param stream the stream to print to. 141 * @param withComments if Comments should be included. 142 */ 143 void LoadParamClassDescription::printAllTo(FILE* stream, bool withComments) 144 { 145 fprintf(stream, "===============================================================\n"); 146 fprintf(stream, " Listing all the Loadable Options (loaded since Game started).\n\n"); 128 147 for (ClassDescriptionMap::const_iterator classIt = LoadParamClassDescription::_classList.begin(); 129 148 classIt != LoadParamClassDescription::_classList.end(); 130 149 classIt ++) 131 150 { 132 PRINT(0)("<%s>\n", (*classIt).second._className.c_str());151 fprintf(stream, "<%s>\n", (*classIt).second._className.c_str()); 133 152 for (ParamDescriptionMap::const_iterator param = (*classIt).second._parameters.begin(); 134 153 param != (*classIt).second._parameters.end(); 135 154 ++param) 136 155 { 137 (*param).second.print( );156 (*param).second.print(stream, withComments); 138 157 } 139 PRINT(0)("</%s>\n\n", (*classIt).second._className.c_str());158 fprintf(stream, "</%s>\n\n", (*classIt).second._className.c_str()); 140 159 } 141 PRINT(0)("===============================================================\n");160 fprintf(stream, "===============================================================\n"); 142 161 } -
branches/new_class_id/src/lib/util/loading/load_param_class_description.h
r9776 r9777 25 25 #include "class_id.h" 26 26 #include <map> 27 #include <set>28 27 // Forward Declaration // 29 28 class MultiType; … … 59 58 static void deleteAllDescriptions(); 60 59 61 static void printAll(const std::string& fileName = ""); 60 static void printAll(const std::string& fileName = "", bool withComments = true); 61 static void printAllTo(FILE* stream = stdout, bool withComments = true); 62 62 63 63 private: -
branches/new_class_id/src/lib/util/loading/load_param_description.cc
r9776 r9777 56 56 57 57 /** 58 * prints out this parameter, its input method and the description (if availiable) 58 * @brief prints out this parameter, its input method and the description (if availiable) 59 * @param stream the stream to print to. 60 * @param withComments if the comments should be appended. 59 61 */ 60 void LoadParamDescription::print( ) const62 void LoadParamDescription::print(FILE* stream, bool withComments) const 61 63 { 62 PRINT(0)(" <%s>", this->_name.c_str());64 fprintf(stream, " <%s>", this->_name.c_str()); 63 65 for (unsigned int i = 0; i < this->_parameterCount; i++) 64 66 { 65 67 if (i > 0) 66 PRINT(0)(",");67 PRINT(0)("%s", this->_types[i].c_str());68 fprintf(stream, ","); 69 fprintf(stream, "%s", this->_types[i].c_str()); 68 70 } 69 PRINT(0)("</%s>", this->_name.c_str());71 fprintf(stream, "</%s>", this->_name.c_str()); 70 72 if (!this->_description.empty()) 71 PRINT(0)(" <!-- %s", this->_description.c_str());73 fprintf(stream, " <!-- %s", this->_description.c_str()); 72 74 // default values 73 75 if (this->_parameterCount > 0) 74 76 { 75 PRINT(0)(" (Default: ");77 fprintf(stream, " (Default: "); 76 78 for (unsigned int i = 0; i < this->_parameterCount; i++) 77 79 { 78 80 if (i > 0) 79 PRINT(0)(", ");81 fprintf(stream, ", "); 80 82 if (this->_types[i] == "string") 81 83 { // leave brackets !! 82 PRINT(0)("\"%s\"", this->_defaultValues[i].c_str());84 fprintf(stream, "\"%s\"", this->_defaultValues[i].c_str()); 83 85 } 84 86 else 85 87 { 86 PRINT(0)("%s", this->_defaultValues[i].c_str());88 fprintf(stream, "%s", this->_defaultValues[i].c_str()); 87 89 } 88 90 } 89 PRINT(0)(")");91 fprintf(stream, ")"); 90 92 } 91 93 if (!this->_description.empty() || this->_parameterCount > 0) 92 PRINT(0)(" -->");94 fprintf(stream, " -->"); 93 95 94 PRINT(0)("\n");96 fprintf(stream, "\n"); 95 97 } 96 98 -
branches/new_class_id/src/lib/util/loading/load_param_description.h
r9776 r9777 46 46 void setDescription(const std::string& descriptionText); 47 47 void setValues(unsigned int paramCount, 48 const MultiType* const defaultValues, 49 bool retVal = false); 48 const MultiType* const defaultValues, 49 bool retVal = false); 50 50 51 /** @returns the descriptionString */ 51 52 const std::string& description() { return this->_description; }; 52 53 53 void print( ) const;54 void print(FILE* stream = stdout, bool withComments = true) const; 54 55 55 56 private:
Note: See TracChangeset
for help on using the changeset viewer.