Changeset 9406 in orxonox.OLD for trunk/src/lib/util
- Timestamp:
- Jul 24, 2006, 11:09:47 AM (18 years ago)
- Location:
- trunk/src/lib/util
- Files:
-
- 2 deleted
- 13 edited
- 5 copied
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/lib/util/Makefile.am
r8724 r9406 6 6 libORXlibutil_a_SOURCES = \ 7 7 substring.cc \ 8 tokenizer.cc \9 8 color.cc \ 10 9 helper_functions.cc \ … … 24 23 filesys/file.cc \ 25 24 filesys/directory.cc \ 25 filesys/net_link.cc \ 26 26 \ 27 27 preferences.cc \ … … 32 32 noinst_HEADERS = \ 33 33 substring.h \ 34 tokenizer.h \35 34 multi_type.h \ 36 35 color.h \ … … 44 43 filesys/file.h \ 45 44 filesys/directory.h \ 45 filesys/net_link.h \ 46 46 \ 47 47 preferences.h \ -
trunk/src/lib/util/executor/executor_functional.h
r8271 r9406 179 179 { 180 180 (__EXECUTOR_FUNCTIONAL_FUNCTION_EXEC)( 181 fromString<type0>(sub[0], getDefault<type0>(this->defaultValue, 0)));181 (sub.size() > 0) ? fromString<type0>(sub[0], getDefault<type0>(this->defaultValue, 0)) : (fromMulti<type0>(this->defaultValue[0]))); 182 182 }; 183 183 … … 222 222 { 223 223 (__EXECUTOR_FUNCTIONAL_FUNCTION_EXEC)( 224 fromString<type0>(sub[0], getDefault<type0>(this->defaultValue, 0)),225 fromString<type1>(sub[1], getDefault<type1>(this->defaultValue, 1)));224 (sub.size() > 0) ? fromString<type0>(sub[0], getDefault<type0>(this->defaultValue, 0)) : (fromMulti<type0>(this->defaultValue[0])), 225 (sub.size() > 1) ? fromString<type1>(sub[1], getDefault<type1>(this->defaultValue, 1)) : (fromMulti<type1>(this->defaultValue[1]))); 226 226 }; 227 227 … … 276 276 { 277 277 (__EXECUTOR_FUNCTIONAL_FUNCTION_EXEC)( 278 fromString<type0>(sub[0], getDefault<type0>(this->defaultValue, 0)),279 fromString<type1>(sub[1], getDefault<type1>(this->defaultValue, 1)),280 fromString<type2>(sub[2], getDefault<type2>(this->defaultValue, 2)));278 (sub.size() > 0) ? fromString<type0>(sub[0], getDefault<type0>(this->defaultValue, 0)) : (fromMulti<type0>(this->defaultValue[0])), 279 (sub.size() > 1) ? fromString<type1>(sub[1], getDefault<type1>(this->defaultValue, 1)) : (fromMulti<type1>(this->defaultValue[1])), 280 (sub.size() > 2) ? fromString<type2>(sub[2], getDefault<type2>(this->defaultValue, 2)) : (fromMulti<type2>(this->defaultValue[2]))); 281 281 }; 282 282 … … 333 333 { 334 334 (__EXECUTOR_FUNCTIONAL_FUNCTION_EXEC)( 335 fromString<type0>(sub[0], getDefault<type0>(this->defaultValue, 0)),336 fromString<type1>(sub[1], getDefault<type1>(this->defaultValue, 1)),337 fromString<type2>(sub[2], getDefault<type2>(this->defaultValue, 2)),338 fromString<type3>(sub[3], getDefault<type3>(this->defaultValue, 3)));335 (sub.size() > 0) ? fromString<type0>(sub[0], getDefault<type0>(this->defaultValue, 0)) : (fromMulti<type0>(this->defaultValue[0])), 336 (sub.size() > 1) ? fromString<type1>(sub[1], getDefault<type1>(this->defaultValue, 1)) : (fromMulti<type1>(this->defaultValue[1])), 337 (sub.size() > 2) ? fromString<type2>(sub[2], getDefault<type2>(this->defaultValue, 2)) : (fromMulti<type2>(this->defaultValue[2])), 338 (sub.size() > 3) ? fromString<type3>(sub[3], getDefault<type3>(this->defaultValue, 3)) : (fromMulti<type3>(this->defaultValue[3]))); 339 339 }; 340 340 … … 392 392 { 393 393 (__EXECUTOR_FUNCTIONAL_FUNCTION_EXEC)( 394 fromString<type0>(sub[0], getDefault<type0>(this->defaultValue, 0)),395 fromString<type1>(sub[1], getDefault<type1>(this->defaultValue, 1)),396 fromString<type2>(sub[2], getDefault<type2>(this->defaultValue, 2)),397 fromString<type3>(sub[3], getDefault<type3>(this->defaultValue, 3)),398 fromString<type4>(sub[4], getDefault<type4>(this->defaultValue, 4)));394 (sub.size() > 0) ? fromString<type0>(sub[0], getDefault<type0>(this->defaultValue, 0)) : (fromMulti<type0>(this->defaultValue[0])), 395 (sub.size() > 1) ? fromString<type1>(sub[1], getDefault<type1>(this->defaultValue, 1)) : (fromMulti<type1>(this->defaultValue[1])), 396 (sub.size() > 2) ? fromString<type2>(sub[2], getDefault<type2>(this->defaultValue, 2)) : (fromMulti<type2>(this->defaultValue[2])), 397 (sub.size() > 3) ? fromString<type3>(sub[3], getDefault<type3>(this->defaultValue, 3)) : (fromMulti<type3>(this->defaultValue[3])), 398 (sub.size() > 4) ? fromString<type4>(sub[4], getDefault<type4>(this->defaultValue, 4)) : (fromMulti<type4>(this->defaultValue[4]))); 399 399 }; 400 400 -
trunk/src/lib/util/executor/functor_list.h
r8894 r9406 135 135 136 136 //! mixed values: 137 FUNCTOR_LIST(2)(l_STRING, l_INT); 137 138 FUNCTOR_LIST(2)(l_STRING, l_FLOAT); 138 139 FUNCTOR_LIST(2)(l_UINT, l_LONG); -
trunk/src/lib/util/helper_functions.cc
r7714 r9406 19 19 #include "stdlibincl.h" 20 20 21 using namespace std; 21 22 22 23 23 /** -
trunk/src/lib/util/loading/dynamic_loader.cc
r8362 r9406 23 23 24 24 25 using namespace std; 25 26 26 27 27 -
trunk/src/lib/util/loading/factory.cc
r8362 r9406 19 19 //#include "shell_command.h" 20 20 21 using namespace std; 21 22 22 23 23 //SHELL_COMMAND(create, Factory, fabricate); … … 117 117 if (factory != Factory::factoryList->end()) 118 118 { 119 PRINTF(2)("Create a new Object of type %s\n", (*factory)->get Name());119 PRINTF(2)("Create a new Object of type %s\n", (*factory)->getCName()); 120 120 return (*factory)->fabricateObject(root); 121 121 } … … 145 145 if (factory != Factory::factoryList->end()) 146 146 { 147 PRINTF(4)("Create a new Object of type %s\n", (*factory)->get Name());147 PRINTF(4)("Create a new Object of type %s\n", (*factory)->getCName()); 148 148 return (*factory)->fabricateObject(NULL); 149 149 } … … 173 173 if (factory != Factory::factoryList->end()) 174 174 { 175 PRINTF(4)("Create a new Object of type %s\n", (*factory)->get Name());175 PRINTF(4)("Create a new Object of type %s\n", (*factory)->getCName()); 176 176 return (*factory)->fabricateObject(NULL); 177 177 } -
trunk/src/lib/util/loading/load_param.cc
r8408 r9406 65 65 ((this->executor->getType() & Executor_NoLoadString) == Executor_NoLoadString))) 66 66 { 67 PRINTF(4)("Loading value '%s' with Parameters '%s' onto: %s::%s\n", this->paramName.c_str(), loadString.c_str(), this->object->getClass Name(), this->object->getName());67 PRINTF(4)("Loading value '%s' with Parameters '%s' onto: %s::%s\n", this->paramName.c_str(), loadString.c_str(), this->object->getClassCName(), this->object->getCName()); 68 68 (*this->executor)(this->object, SubString(loadString, ",", SubString::WhiteSpaces, false, '\\')); 69 69 } … … 164 164 { 165 165 // locating the class 166 this->classDesc = LoadClassDescription::addClass(object->getClass Name());166 this->classDesc = LoadClassDescription::addClass(object->getClassCName()); 167 167 168 168 if ((this->paramDesc = this->classDesc->addParam(paramName)) != NULL) -
trunk/src/lib/util/loading/resource.cc
r8271 r9406 18 18 #include "resource.h" 19 19 20 using namespace std; 20 21 21 22 22 -
trunk/src/lib/util/loading/resource_manager.cc
r8724 r9406 50 50 #include <unistd.h> 51 51 52 using namespace std; 52 53 53 54 54 /** -
trunk/src/lib/util/multi_type.cc
r8316 r9406 18 18 #include "multi_type.h" 19 19 20 //#include "stdincl.h"21 #include <stddef.h>22 #include <stdlib.h>23 #include <string.h>24 #include <stdio.h>25 20 #include <sstream> 26 21 … … 28 23 #include "debug.h" 29 24 #endif 30 31 using namespace std;32 25 33 26 /** -
trunk/src/lib/util/substring.cc
r7477 r9406 28 28 #include "substring.h" 29 29 30 #include <string.h>31 #include <cassert>32 33 34 30 /** 35 31 * @brief default constructor … … 108 104 109 105 /** @brief An empty String */ 110 const std::string SubString::emptyString = "";106 // const std::string SubString::emptyString = ""; 111 107 /** @brief Helper that gets you a String consisting of all White Spaces */ 112 108 const std::string SubString::WhiteSpaces = " \n\t"; … … 238 234 } 239 235 else 240 return SubString::emptyString; 236 { 237 static std::string empty; 238 return empty; 239 } 241 240 } 242 241 … … 250 249 * SubString::SubString(const SubString& subString, unsigned int subSetBegin) 251 250 */ 252 SubString SubString:: getSubSet(unsigned int subSetBegin) const251 SubString SubString::subSet(unsigned int subSetBegin) const 253 252 { 254 253 return SubString(*this, subSetBegin); … … 265 264 * SubString::SubString(const SubString& subString, unsigned int subSetBegin) 266 265 */ 267 SubString SubString:: getSubSet(unsigned int subSetBegin, unsigned int subSetEnd) const266 SubString SubString::subSet(unsigned int subSetBegin, unsigned int subSetEnd) const 268 267 { 269 268 return SubString(*this, subSetBegin, subSetEnd); … … 289 288 * Supports delimiters, escape characters, 290 289 * ignores special characters between safemode_char and between comment_char and linend '\n'. 291 *292 *293 290 */ 294 291 SubString::SPLIT_LINE_STATE -
trunk/src/lib/util/substring.h
r8408 r9406 2 2 * @file substring.h 3 3 * @brief a small class to get the parts of a string separated by commas 4 * 5 * This class is also identified as a Tokenizer. It splits up one long 6 * String into multiple small ones by a designated Delimiter. 7 * 8 * Substring is Advanced, and it is possible, to split a string by ',' 9 * but also removing leading and trailing spaces around the comma. 10 * 11 * @example 12 * Split the String std::string st = "1345, The new empire , is , orxonox" 13 * is splitted with: 14 * SubString(st, ',', " \n\t") 15 * into 16 * "1345", "The new empire", "is", "orxonox" 17 * As you can see, the useless spaces around ',' were removed. 4 18 */ 5 19 6 #ifndef _ SUBSTRING_H7 #define _ SUBSTRING_H20 #ifndef __SUBSTRING_H__ 21 #define __SUBSTRING_H__ 8 22 9 23 #include <vector> … … 61 75 62 76 // retrieve a SubSet from the String 63 SubString getSubSet(unsigned int subSetBegin) const;64 SubString getSubSet(unsigned int subSetBegin, unsigned int subSetEnd) const;77 SubString subSet(unsigned int subSetBegin) const; 78 SubString subSet(unsigned int subSetBegin, unsigned int subSetEnd) const; 65 79 66 80 // retrieve Information from within … … 70 84 inline unsigned int size() const { return this->strings.size(); }; 71 85 /** @param i the i'th String @returns the i'th string from the subset of Strings */ 72 inline const std::string& operator[](unsigned int i) const { return (i < this->strings.size()) ? this->strings[i] : emptyString; };86 inline const std::string& operator[](unsigned int i) const { return this->strings[i]; }; 73 87 /** @param i the i'th String @returns the i'th string from the subset of Strings */ 74 88 inline const std::string& getString(unsigned int i) const { return (*this)[i]; }; 89 /** @returns the front of the StringList. */ 90 inline const std::string& front() const { return this->strings.front(); }; 91 /** @returns the back of the StringList. */ 92 inline const std::string& back() const { return this->strings.back(); }; 93 /** @brief removes the back of the strings list. */ 94 inline void pop_back() { this->strings.pop_back(); }; 75 95 76 96 // the almighty algorithm. … … 93 113 private: 94 114 std::vector<std::string> strings; //!< strings produced from a single string splitted in multiple strings 95 96 static const std::string emptyString;97 115 }; 98 116 99 #endif /* _ SUBSTRING_H*/117 #endif /* __SUBSTRING_H__ */ -
trunk/src/lib/util/threading.cc
r7847 r9406 18 18 #include "threading.h" 19 19 20 using namespace std; 20 21 21 22 22 namespace OrxThread
Note: See TracChangeset
for help on using the changeset viewer.