Changeset 7212 in orxonox.OLD
- Timestamp:
- Mar 10, 2006, 5:28:52 AM (19 years ago)
- Location:
- branches/std/src/lib/util
- Files:
-
- 4 edited
Legend:
- Unmodified
- Added
- Removed
-
branches/std/src/lib/util/executor/executor.h
r7211 r7212 192 192 #define ExecutorExecute1(t1) \ 193 193 else if (this->paramCount == 1 && this->defaultValue[0] == t1##_PARAM) \ 194 EXECUTOREXECUTER(_1_##t1)(t1##_FUNC( sub.getString(0), t1##_DEFGRAB(0)))194 EXECUTOREXECUTER(_1_##t1)(t1##_FUNC((const char*)parameters, t1##_DEFGRAB(0))) 195 195 196 196 //! execute-macro for functions with two parameters … … 270 270 virtual void execute (BaseObject* object, const void* parameters = NULL) 271 271 { 272 SubString sub((const char*)parameters, " \n\t", '\\'); 272 SubString sub; 273 printf("===%s\n", (const char*)parameters); 274 if (parameters != NULL) 275 sub.split((const char*)parameters, " \n\t,", '\\'); 273 276 //! FUNCTOR_LIST is the List of Executive Functions 274 277 #define FUNCTOR_LIST(x) ExecutorExecute ## x … … 332 335 virtual void execute (BaseObject* object, const void* parameters = NULL) 333 336 { 334 SubString sub(((const char*)parameters), " \n\t,"); 337 SubString sub; 338 if (parameters != NULL) 339 sub.split((const char*)parameters, " \n\t,", '\\'); 335 340 //! FUNCTOR_LIST is the List of Executive Functions 336 341 #define FUNCTOR_LIST(x) ExecutorExecute ## x -
branches/std/src/lib/util/loading/load_param.cc
r7211 r7212 66 66 ((this->executor->getType() & Executor_NoLoadString) == Executor_NoLoadString))) 67 67 { 68 PRINTF( 4)("Loading '%s' with Parameters '%s' onto: '%s'(%s)\n", this->paramName, loadString.c_str(), this->object->getName(), this->object->getClassName());68 PRINTF(0)("Loading '%s' with Parameters '%s' onto: '%s'(%s)\n", this->paramName.c_str(), loadString.c_str(), this->object->getName(), this->object->getClassName()); 69 69 this->executor->execute(this->object, (const void*)loadString.c_str()); 70 70 } -
branches/std/src/lib/util/substring.cc
r7211 r7212 14 14 15 15 2005-06-10: some naming conventions 16 17 // 18 // splitLine 19 // STL string tokenizer 20 // 21 // Created by Clemens Wacha. 22 // Version 1.0 23 // Copyright (c) 2005 Clemens Wacha. All rights reserved. 24 // 25 16 26 */ 17 27 … … 35 45 string, split); 36 46 } 37 38 47 39 48 /** … … 48 57 string); 49 58 } 50 51 59 SubString::SubString(const std::string& string, const std::string& splitters, char escapeChar,char safemode_char, char comment_char) 52 60 { 53 61 SubString::splitLine(this->strings, this->offsets, 54 62 string, splitters, escapeChar, safemode_char); 63 } 64 65 66 unsigned int SubString::split(const std::string& string, char splitter) 67 { 68 this->offsets.clear(); 69 this->strings.clear(); 70 char split[2]; 71 split[0] = splitter; 72 split[1] = '\0'; 73 SubString::splitLine(this->strings, this->offsets, string, split); 74 return strings.size(); 75 } 76 77 78 /** 79 * Splits a String into a Substring removing all whiteSpaces 80 * @param string the String to Split 81 * @param whiteSpaces MUST BE __TRUE__ 82 * 83 */ 84 unsigned int SubString::split(const std::string& string, bool whiteSpaces) 85 { 86 this->offsets.clear(); 87 this->strings.clear(); 88 SubString::splitLine(this->strings, this->offsets, string); 89 return strings.size(); 90 } 91 92 unsigned int SubString::split(const std::string& string, const std::string& splitters, char escapeChar,char safemode_char, char comment_char) 93 { 94 this->offsets.clear(); 95 this->strings.clear(); 96 SubString::splitLine(this->strings, this->offsets, 97 string, splitters, escapeChar, safemode_char); 98 return strings.size(); 55 99 } 56 100 -
branches/std/src/lib/util/substring.h
r7211 r7212 22 22 { 23 23 public: 24 SubString(const std::string& string , char splitter = ',');24 SubString(const std::string& string = "", char splitter = ','); 25 25 SubString(const std::string& string, bool whiteSpaces); 26 26 SubString(const std::string& string, const std::string& splitters, char escapeChar ='\\', char safemode_char = '"', char comment_char = '\0'); 27 27 ~SubString(); 28 28 29 SPLIT_LINE_STATE splitLine(std::vector<std::string>& ret,std::vector<unsigned int>& offsets,30 const std::string& line, const std::string& delimiters = " \t\r\n",31 char escape_char = '\\', char safemode_char = '"', char comment_char = '\0',32 SPLIT_LINE_STATE start_state = SL_NORMAL); 29 unsigned int split(const std::string& string = "", char splitter = ','); 30 unsigned int split(const std::string& string, bool whiteSpaces); 31 unsigned int split(const std::string& string, const std::string& splitters, char escapeChar ='\\', char safemode_char = '"', char comment_char = '\0'); 32 33 33 34 34 const std::string& operator[](unsigned int i) { return this->getString(i); }; … … 37 37 const std::string& getString(unsigned int i) { return this->strings[i]; }; 38 38 unsigned int getOffset(unsigned int i); 39 40 static SPLIT_LINE_STATE splitLine(std::vector<std::string>& ret,std::vector<unsigned int>& offsets, 41 const std::string& line, const std::string& delimiters = " \t\r\n", 42 char escape_char = '\\', char safemode_char = '"', char comment_char = '\0', 43 SPLIT_LINE_STATE start_state = SL_NORMAL); 39 44 40 45 void debug() const;
Note: See TracChangeset
for help on using the changeset viewer.