Merge branch 'develop' into feature/sax2
This commit is contained in:
		
						commit
						abac6a0e84
					
				
					 8 changed files with 238 additions and 20 deletions
				
			
		|  | @ -32,6 +32,7 @@ class lexer | |||
|     using number_integer_t = typename BasicJsonType::number_integer_t; | ||||
|     using number_unsigned_t = typename BasicJsonType::number_unsigned_t; | ||||
|     using number_float_t = typename BasicJsonType::number_float_t; | ||||
|     using string_t = typename BasicJsonType::string_t; | ||||
| 
 | ||||
|   public: | ||||
|     /// token types for the parser
 | ||||
|  | @ -1130,7 +1131,7 @@ scan_number_done: | |||
|     } | ||||
| 
 | ||||
|     /// return current string value (implicitly resets the token; useful only once)
 | ||||
|     std::string&& move_string() | ||||
|     string_t&& move_string() | ||||
|     { | ||||
|         return std::move(token_buffer); | ||||
|     } | ||||
|  | @ -1260,7 +1261,7 @@ scan_number_done: | |||
|     std::vector<char> token_string {}; | ||||
| 
 | ||||
|     /// buffer for variable-length tokens (numbers, strings)
 | ||||
|     std::string token_buffer {}; | ||||
|     string_t token_buffer {}; | ||||
| 
 | ||||
|     /// a description of occurred lexer errors
 | ||||
|     const char* error_message = ""; | ||||
|  |  | |||
|  | @ -33,6 +33,7 @@ class parser | |||
|     using number_integer_t = typename BasicJsonType::number_integer_t; | ||||
|     using number_unsigned_t = typename BasicJsonType::number_unsigned_t; | ||||
|     using number_float_t = typename BasicJsonType::number_float_t; | ||||
|     using string_t = typename BasicJsonType::string_t; | ||||
|     using lexer_t = lexer<BasicJsonType>; | ||||
|     using token_type = typename lexer_t::token_type; | ||||
| 
 | ||||
|  | @ -205,7 +206,7 @@ class parser | |||
|                 } | ||||
| 
 | ||||
|                 // parse values
 | ||||
|                 std::string key; | ||||
|                 string_t key; | ||||
|                 BasicJsonType value; | ||||
|                 while (true) | ||||
|                 { | ||||
|  |  | |||
|  | @ -68,11 +68,11 @@ class output_stream_adapter : public output_adapter_protocol<CharType> | |||
| }; | ||||
| 
 | ||||
| /// output adapter for basic_string
 | ||||
| template<typename CharType> | ||||
| template<typename CharType, typename StringType = std::basic_string<CharType>> | ||||
| class output_string_adapter : public output_adapter_protocol<CharType> | ||||
| { | ||||
|   public: | ||||
|     explicit output_string_adapter(std::basic_string<CharType>& s) : str(s) {} | ||||
|     explicit output_string_adapter(StringType& s) : str(s) {} | ||||
| 
 | ||||
|     void write_character(CharType c) override | ||||
|     { | ||||
|  | @ -85,10 +85,10 @@ class output_string_adapter : public output_adapter_protocol<CharType> | |||
|     } | ||||
| 
 | ||||
|   private: | ||||
|     std::basic_string<CharType>& str; | ||||
|     StringType& str; | ||||
| }; | ||||
| 
 | ||||
| template<typename CharType> | ||||
| template<typename CharType, typename StringType = std::basic_string<CharType>> | ||||
| class output_adapter | ||||
| { | ||||
|   public: | ||||
|  | @ -98,8 +98,8 @@ class output_adapter | |||
|     output_adapter(std::basic_ostream<CharType>& s) | ||||
|         : oa(std::make_shared<output_stream_adapter<CharType>>(s)) {} | ||||
| 
 | ||||
|     output_adapter(std::basic_string<CharType>& s) | ||||
|         : oa(std::make_shared<output_string_adapter<CharType>>(s)) {} | ||||
|     output_adapter(StringType& s) | ||||
|         : oa(std::make_shared<output_string_adapter<CharType, StringType>>(s)) {} | ||||
| 
 | ||||
|     operator output_adapter_t<CharType>() | ||||
|     { | ||||
|  |  | |||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue