Changeset 9047 for code/branches/testing/src/libraries/util/SubString.h
- Timestamp:
- Mar 18, 2012, 6:43:24 PM (13 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
code/branches/testing/src/libraries/util/SubString.h
r8858 r9047 58 58 SubString tokens(text, SubString::WhiteSpaces, "", false, '\\', true, '"', true, '{', '}', true, '\0'); 59 59 60 for ( unsigned int i = 0; i < tokens.size(); ++i)60 for (size_t i = 0; i < tokens.size(); ++i) 61 61 orxout() << i << ": " << tokens[i] << endl; 62 62 @endcode … … 127 127 bool bRemoveParenthesisChars = true, 128 128 char commentChar = '\0'); 129 SubString(unsigned int argc, const char** argv); 130 SubString(const SubString& other, unsigned int begin); 131 SubString(const SubString& other, unsigned int begin, unsigned int end); 129 SubString(size_t argc, const char** argv); 130 SubString(const SubString& other, size_t begin, size_t length = std::string::npos); 132 131 ~SubString(); 133 132 … … 135 134 SubString& operator=(const SubString& other); 136 135 bool operator==(const SubString& other) const; 137 bool compare(const SubString& other) const; 138 bool compare(const SubString& other, unsigned int length) const; 136 bool compare(const SubString& other, size_t length = std::string::npos) const; 139 137 SubString operator+(const SubString& other) const; 140 138 SubString& operator+=(const SubString& other); … … 144 142 ///////////////////////////////////////// 145 143 // Split and Join the any String. /////// 146 unsigned int split(const std::string& line,147 148 149 150 151 152 153 154 155 156 157 144 size_t split(const std::string& line, 145 const std::string& delimiters = SubString::WhiteSpaces, 146 const std::string& delimiterNeighbours = "", 147 bool bAllowEmptyEntries = false, 148 char escapeChar ='\\', 149 bool bRemoveEscapeChar = true, 150 char safemodeChar = '"', 151 bool bRemoveSafemodeChar = true, 152 char openparenthesisChar = '{', 153 char closeparenthesisChar = '}', 154 bool bRemoveParenthesisChars = true, 155 char commentChar = '\0'); 158 156 159 157 std::string join(const std::string& delimiter = " ") const; … … 161 159 162 160 // retrieve a SubSet from the String 163 SubString subSet(unsigned int begin) const; 164 SubString subSet(unsigned int begin, unsigned int end) const; 161 SubString subSet(size_t begin, size_t length = std::string::npos) const; 165 162 166 163 // retrieve Information from within … … 168 165 inline bool empty() const { return this->tokens_.empty(); } 169 166 /// Returns the number of tokens stored in this SubString 170 inline unsigned int size() const { return this->tokens_.size(); }167 inline size_t size() const { return this->tokens_.size(); } 171 168 /// Returns the i'th token from the subset of strings @param index The index of the requested token 172 inline const std::string& operator[]( unsigned int index) const { return this->tokens_[index]; }169 inline const std::string& operator[](size_t index) const { return this->tokens_[index]; } 173 170 /// Returns the i'th token from the subset of strings @param index The index of the requested token 174 inline const std::string& getString( unsigned int index) const { return (*this)[index]; }171 inline const std::string& getString(size_t index) const { return (*this)[index]; } 175 172 /// Returns all tokens as std::vector 176 173 inline const std::vector<std::string>& getAllStrings() const { return this->tokens_; } 177 174 /// Returns true if the token is in safemode. @param index The index of the token 178 inline bool isInSafemode( unsigned int index) const { return this->bTokenInSafemode_[index]; }175 inline bool isInSafemode(size_t index) const { return this->bTokenInSafemode_[index]; } 179 176 /// Returns the front of the list of tokens. 180 177 inline const std::string& front() const { return this->tokens_.front(); }
Note: See TracChangeset
for help on using the changeset viewer.