mirror of
				https://github.com/ciphervance/supercell-wx.git
				synced 2025-10-31 05:10:04 +00:00 
			
		
		
		
	Create custom string tokenizer for use in placefile parsing
- Avoids the use of regular expressions, and is expected to be more efficient with large placefiles
This commit is contained in:
		
							parent
							
								
									88475f5b0e
								
							
						
					
					
						commit
						6767c0c50a
					
				
					 4 changed files with 148 additions and 0 deletions
				
			
		|  | @ -8,6 +8,25 @@ namespace scwx | |||
| namespace util | ||||
| { | ||||
| 
 | ||||
| /**
 | ||||
|  * @brief Parse a list of tokens from a string | ||||
|  * | ||||
|  * This function will take an input string, and apply the delimiters vector in | ||||
|  * order to tokenize the string. Each set of delimiters in the delimiters vector | ||||
|  * will be used once. A set of delimiters will be used to match any character, | ||||
|  * rather than a sequence of characters. Tokens are automatically trimmed of any | ||||
|  * whitespace. | ||||
|  * | ||||
|  * @param [in] s Input string to tokenize | ||||
|  * @param [in] delimiters A vector of delimiters to use for each token. | ||||
|  * @param [in] pos Search begin position. Default is 0. | ||||
|  * | ||||
|  * @return Tokenized string | ||||
|  */ | ||||
| std::vector<std::string> ParseTokens(const std::string&       s, | ||||
|                                      std::vector<std::string> delimiters, | ||||
|                                      std::size_t              pos = 0); | ||||
| 
 | ||||
| std::string ToString(const std::vector<std::string>& v); | ||||
| 
 | ||||
| } // namespace util
 | ||||
|  |  | |||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue
	
	 Dan Paulat
						Dan Paulat