Changeset 1052 for code/trunk/src/util/SubString.h
- Timestamp:
- Apr 14, 2008, 3:42:49 AM (17 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
code/trunk/src/util/SubString.h
r871 r1052 88 88 SubString(const std::string& string, 89 89 const std::string& delimiters, const std::string& delimiterNeighbours = "", bool emptyEntries=false, 90 char escapeChar ='\\', char safemode_char = '"', char openparenthesis_char = '(', char closeparenthesis_char = ')', char comment_char = '\0'); 90 char escapeChar ='\\', bool removeExcapeChar = true, char safemode_char = '"', bool removeSafemodeChar = true, 91 char openparenthesis_char = '(', char closeparenthesis_char = ')', bool removeParenthesisChars = true, char comment_char = '\0'); 91 92 SubString(unsigned int argc, const char** argv); 92 93 /** @brief create a Substring as a copy of another one. @param subString the SubString to copy. */ … … 111 112 unsigned int split(const std::string& string, 112 113 const std::string& delimiters, const std::string& delimiterNeighbours = "", bool emptyEntries = false, 113 char escapeChar ='\\', char safemode_char = '"', char openparenthesis_char = '(', char closeparenthesis_char = ')', char comment_char = '\0'); 114 char escapeChar ='\\', bool removeExcapeChar = true, char safemode_char = '"', bool removeSafemodeChar = true, 115 char openparenthesis_char = '(', char closeparenthesis_char = ')', bool removeParenthesisChars = true, char comment_char = '\0'); 114 116 std::string join(const std::string& delimiter = " ") const; 115 117 //////////////////////////////////////// … … 120 122 121 123 // retrieve Information from within 122 /** @ returns true if the SubString is empty */124 /** @brief Returns true if the SubString is empty */ 123 125 inline bool empty() const { return this->strings.empty(); }; 124 /** @ returns the count of Strings stored in this substring */126 /** @brief Returns the count of Strings stored in this substring */ 125 127 inline unsigned int size() const { return this->strings.size(); }; 126 /** @ param i the i'th String @returns the i'th string from the subset of Strings*/128 /** @brief Returns the i'th string from the subset of Strings @param i the i'th String */ 127 129 inline const std::string& operator[](unsigned int i) const { return this->strings[i]; }; 128 /** @ param i the i'th String @returns the i'th string from the subset of Strings*/130 /** @brief Returns the i'th string from the subset of Strings @param i the i'th String */ 129 131 inline const std::string& getString(unsigned int i) const { return (*this)[i]; }; 130 /** @returns the front of the StringList. */ 132 /** @brief Returns true if the token is in safemode. @param i the i'th token */ 133 inline bool isInSafemode(unsigned int i) const { return this->bInSafemode[i]; } 134 /** @brief Returns the front of the StringList. */ 131 135 inline const std::string& front() const { return this->strings.front(); }; 132 /** @ returns the back of the StringList. */136 /** @brief Returns the back of the StringList. */ 133 137 inline const std::string& back() const { return this->strings.back(); }; 134 138 /** @brief removes the back of the strings list. */ 135 inline void pop_back() { this->strings.pop_back(); };139 inline void pop_back() { this->strings.pop_back(); this->bInSafemode.pop_back(); }; 136 140 137 141 // the almighty algorithm. 138 142 static SPLIT_LINE_STATE splitLine(std::vector<std::string>& ret, 143 std::vector<bool>& bInSafemode, 139 144 const std::string& line, 140 145 const std::string& delimiters = SubString::WhiteSpaces, … … 142 147 bool emptyEntries = false, 143 148 char escape_char = '\\', 149 bool removeExcapeChar = true, 144 150 char safemode_char = '"', 151 bool removeSafemodeChar = true, 145 152 char openparenthesis_char = '(', 146 153 char closeparenthesis_char = ')', 154 bool removeParenthesisChars = true, 147 155 char comment_char = '\0', 148 156 SPLIT_LINE_STATE start_state = SL_NORMAL); … … 157 165 private: 158 166 std::vector<std::string> strings; //!< strings produced from a single string splitted in multiple strings 167 std::vector<bool> bInSafemode; 159 168 }; 160 169
Note: See TracChangeset
for help on using the changeset viewer.