Changeset 1006 for code/branches/core2/src/util
- Timestamp:
- Apr 10, 2008, 1:24:29 AM (17 years ago)
- Location:
- code/branches/core2/src/util
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
code/branches/core2/src/util/String.cc
r994 r1006 53 53 strip(&output); 54 54 return output; 55 } 56 57 /** 58 @brief Returns a copy of a string without trailing whitespaces. 59 @param str The string 60 @return The modified copy 61 */ 62 std::string removeTrailingWhitespaces(const std::string& str) 63 { 64 } 65 66 /** 67 @brief Returns true if the string contains something like '..."between quotes"...' 68 @param The string 69 @return True if there is something between quotes 70 */ 71 bool hasStringBetweenQuotes(const std::string& str) 72 { 73 } 74 75 /** 76 @brief If the string contains something like '..."between quotes"...' then 'between quotes' gets returned (without quotes). 77 @param The string 78 @param The string between the quotes 79 */ 80 std::string getStringBetweenQuotes(const std::string& str) 81 { 55 82 } 56 83 … … 218 245 219 246 /** 220 *@brief compares two strings without ignoring the case221 *@param s1 first string222 *@param s2 second string223 247 @brief compares two strings without ignoring the case 248 @param s1 first string 249 @param s2 second string 250 */ 224 251 int nocaseCmp(const std::string& s1, const std::string& s2) 225 252 { … … 246 273 247 274 /** 248 *@brief compares two strings without ignoring the case249 *@param s1 first string250 *@param s2 second string251 *@param len how far from the beginning to start.252 275 @brief compares two strings without ignoring the case 276 @param s1 first string 277 @param s2 second string 278 @param len how far from the beginning to start. 279 */ 253 280 int nocaseCmp(const std::string& s1, const std::string& s2, unsigned int len) 254 281 { … … 270 297 return 0; 271 298 } 299 300 /** 301 @brief Returns true if the string contains a comment, introduced by #, %, ; or //. 302 @param str The string 303 @return True if the string contains a comment 304 */ 305 bool hasComment(const std::string& str) 306 { 307 return (getCommentPosition(str) != std::string::npos); 308 } 309 310 /** 311 @brief If the string contains a comment, the comment gets returned (including the comment symbol), an empty string otherwise. 312 @param str The string 313 @return The comment 314 */ 315 std::string getComment(const std::string& str) 316 { 317 return str.substr(getCommentPosition(str)); 318 } 319 320 /** 321 @brief If the string contains a comment, the position of the comment-symbol gets returned, std::string::npos otherwise. 322 @param str The string 323 @return The position 324 */ 325 unsigned int getCommentPosition(const std::string& str) 326 { 327 for (unsigned int i = 0; i < str.size(); i++) 328 if (isComment(str.substr(i))) 329 return i; 330 331 return std::string::npos; 332 } -
code/branches/core2/src/util/String.h
r994 r1006 34 34 #include "UtilPrereqs.h" 35 35 36 _UtilExport void strip(std::string* str);37 _UtilExport std::string getStripped(const std::string& str);36 _UtilExport void strip(std::string* str); 37 _UtilExport std::string getStripped(const std::string& str); 38 38 39 _UtilExport void stripEnclosingQuotes(std::string* str); 40 _UtilExport std::string getStrippedEnclosingQuotes(const std::string& str); 39 _UtilExport std::string removeTrailingWhitespaces(const std::string& str); 41 40 42 _UtilExport bool isEmpty(const std::string& str); 43 _UtilExport bool isComment(const std::string& str); 44 _UtilExport bool isNumeric(const std::string& str); 41 _UtilExport bool hasStringBetweenQuotes(const std::string& str); 42 _UtilExport std::string getStringBetweenQuotes(const std::string& str); 45 43 46 _UtilExport void lowercase(std::string* str);47 _UtilExport std::string getLowercase(const std::string& str);44 _UtilExport void stripEnclosingQuotes(std::string* str); 45 _UtilExport std::string getStrippedEnclosingQuotes(const std::string& str); 48 46 49 _UtilExport void uppercase(std::string* str); 50 _UtilExport std::string getUppercase(const std::string& str); 47 _UtilExport bool isEmpty(const std::string& str); 48 _UtilExport bool isComment(const std::string& str); 49 _UtilExport bool isNumeric(const std::string& str); 51 50 52 _UtilExport int nocaseCmp(const std::string& s1, const std::string& s2); 53 _UtilExport int nocaseCmp(const std::string& s1, const std::string& s2, unsigned int len); 51 _UtilExport void lowercase(std::string* str); 52 _UtilExport std::string getLowercase(const std::string& str); 53 54 _UtilExport void uppercase(std::string* str); 55 _UtilExport std::string getUppercase(const std::string& str); 56 57 _UtilExport int nocaseCmp(const std::string& s1, const std::string& s2); 58 _UtilExport int nocaseCmp(const std::string& s1, const std::string& s2, unsigned int len); 59 60 _UtilExport bool hasComment(const std::string& str); 61 _UtilExport std::string getComment(const std::string& str); 62 _UtilExport unsigned int getCommentPosition(const std::string& str); 54 63 55 64 //! The Convert class has some static member functions to convert strings to values and values to strings.
Note: See TracChangeset
for help on using the changeset viewer.