revert to old boost based regex as GCC does not properly implement it prior to GCC 4.90
This commit is contained in:
		
							parent
							
								
									e28e45f38e
								
							
						
					
					
						commit
						d53eb881c2
					
				| @ -32,6 +32,7 @@ SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. | |||||||
| 
 | 
 | ||||||
| #include <boost/filesystem.hpp> | #include <boost/filesystem.hpp> | ||||||
| #include <boost/filesystem/fstream.hpp> | #include <boost/filesystem/fstream.hpp> | ||||||
|  | #include <boost/regex.hpp> | ||||||
| 
 | 
 | ||||||
| #include <regex> | #include <regex> | ||||||
| #include <string> | #include <string> | ||||||
| @ -40,21 +41,11 @@ SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. | |||||||
| inline std::string ReadIniFileAndLowerContents(const boost::filesystem::path &path) | inline std::string ReadIniFileAndLowerContents(const boost::filesystem::path &path) | ||||||
| { | { | ||||||
|     boost::filesystem::fstream config_stream(path); |     boost::filesystem::fstream config_stream(path); | ||||||
|     std::string input_str((std::istreambuf_iterator<char>(config_stream)), |     std::string ini_file_content((std::istreambuf_iterator<char>(config_stream)), | ||||||
|                           std::istreambuf_iterator<char>()); |                           std::istreambuf_iterator<char>()); | ||||||
|     std::regex regex("\\w+="); |     boost::regex regex( "^([^=]*)" ); //match from start of line to '='
 | ||||||
| 
 |     std::string format( "\\L$1\\E" ); //replace with downcased substring
 | ||||||
|     std::string output = input_str; |     return boost::regex_replace( ini_file_content, regex, format ); | ||||||
|     const std::sregex_token_iterator end; |  | ||||||
|     for (std::sregex_token_iterator i(input_str.begin(), input_str.end(), regex); i != end; ++i) |  | ||||||
|     { |  | ||||||
|         std::string match = *i; |  | ||||||
|         std::string new_regex = *i; |  | ||||||
|         std::transform(new_regex.begin(), new_regex.end(), new_regex.begin(), ::tolower); |  | ||||||
|         SimpleLogger().Write() << match << " - " << new_regex; |  | ||||||
|         output = std::regex_replace(output, std::regex(match), new_regex); |  | ||||||
|     } |  | ||||||
|     return output; |  | ||||||
| } | } | ||||||
| 
 | 
 | ||||||
| #endif // INI_FILE_UTIL_H
 | #endif // INI_FILE_UTIL_H
 | ||||||
|  | |||||||
		Loading…
	
		Reference in New Issue
	
	Block a user