renamed "toString()" to "to_string()"
This commit is contained in:
		
							parent
							
								
									f63ff7727e
								
							
						
					
					
						commit
						3bef1a5097
					
				
					 4 changed files with 14 additions and 14 deletions
				
			
		|  | @ -116,7 +116,7 @@ You can also get a string representation (serialize): | |||
| 
 | ||||
| ```cpp | ||||
| // explicit conversion to string | ||||
| std::string s = j.toString(); | ||||
| std::string s = j.to_string(); | ||||
| ``` | ||||
| 
 | ||||
| The value of s could be `{"pi": 3.141, "happy": true}`, but the order of the entries in the object is not fixed. | ||||
|  |  | |||
|  | @ -477,7 +477,7 @@ json::operator object_t() const | |||
|     return get<object_t>(); | ||||
| } | ||||
| 
 | ||||
| const std::string json::toString() const noexcept | ||||
| const std::string json::to_string() const noexcept | ||||
| { | ||||
|     switch (_type) | ||||
|     { | ||||
|  | @ -511,7 +511,7 @@ const std::string json::toString() const noexcept | |||
|                 { | ||||
|                     result += ", "; | ||||
|                 } | ||||
|                 result += i->toString(); | ||||
|                 result += i->to_string(); | ||||
|             } | ||||
| 
 | ||||
|             return "[" + result + "]"; | ||||
|  | @ -527,7 +527,7 @@ const std::string json::toString() const noexcept | |||
|                 { | ||||
|                     result += ", "; | ||||
|                 } | ||||
|                 result += "\"" + i->first + "\": " + i->second.toString(); | ||||
|                 result += "\"" + i->first + "\": " + i->second.to_string(); | ||||
|             } | ||||
| 
 | ||||
|             return "{" + result + "}"; | ||||
|  |  | |||
|  | @ -181,13 +181,13 @@ class json | |||
|     /// write to stream
 | ||||
|     friend std::ostream& operator<<(std::ostream& o, const json& j) | ||||
|     { | ||||
|         o << j.toString(); | ||||
|         o << j.to_string(); | ||||
|         return o; | ||||
|     } | ||||
|     /// write to stream
 | ||||
|     friend std::ostream& operator>>(const json& j, std::ostream& o) | ||||
|     { | ||||
|         o << j.toString(); | ||||
|         o << j.to_string(); | ||||
|         return o; | ||||
|     } | ||||
| 
 | ||||
|  | @ -205,7 +205,7 @@ class json | |||
|     } | ||||
| 
 | ||||
|     /// explicit conversion to string representation (C++ style)
 | ||||
|     const std::string toString() const noexcept; | ||||
|     const std::string to_string() const noexcept; | ||||
| 
 | ||||
|     /// add an object/array to an array
 | ||||
|     json& operator+=(const json&); | ||||
|  |  | |||
|  | @ -15,7 +15,7 @@ TEST_CASE("array") | |||
|         const json j_const (j); | ||||
| 
 | ||||
|         // string representation of default value
 | ||||
|         CHECK(j.toString() == "[]"); | ||||
|         CHECK(j.to_string() == "[]"); | ||||
| 
 | ||||
|         // iterators
 | ||||
|         CHECK(j.begin() != j.end()); | ||||
|  | @ -303,7 +303,7 @@ TEST_CASE("object") | |||
|         const json j_const = j; | ||||
| 
 | ||||
|         // string representation of default value
 | ||||
|         CHECK(j.toString() == "{}"); | ||||
|         CHECK(j.to_string() == "{}"); | ||||
| 
 | ||||
|         // iterators
 | ||||
|         CHECK(j.begin() != j.end()); | ||||
|  | @ -683,7 +683,7 @@ TEST_CASE("null") | |||
|         CHECK(j.type() == json::value_type::null); | ||||
| 
 | ||||
|         // string representation of default value
 | ||||
|         CHECK(j.toString() == "null"); | ||||
|         CHECK(j.to_string() == "null"); | ||||
| 
 | ||||
|         // iterators
 | ||||
|         CHECK(j.begin() != j.end()); | ||||
|  | @ -753,7 +753,7 @@ TEST_CASE("string") | |||
|         CHECK(j.cbegin() != j.cend()); | ||||
| 
 | ||||
|         // string representation of default value
 | ||||
|         CHECK(j.toString() == "\"\""); | ||||
|         CHECK(j.to_string() == "\"\""); | ||||
| 
 | ||||
|         // container members
 | ||||
|         CHECK(j.size() == 1); | ||||
|  | @ -835,7 +835,7 @@ TEST_CASE("boolean") | |||
|         CHECK(j.cbegin() != j.cend()); | ||||
| 
 | ||||
|         // string representation of default value
 | ||||
|         CHECK(j.toString() == "false"); | ||||
|         CHECK(j.to_string() == "false"); | ||||
| 
 | ||||
|         // container members
 | ||||
|         CHECK(j.size() == 1); | ||||
|  | @ -914,7 +914,7 @@ TEST_CASE("number (int)") | |||
|         CHECK(j.cbegin() != j.cend()); | ||||
| 
 | ||||
|         // string representation of default value
 | ||||
|         CHECK(j.toString() == "0"); | ||||
|         CHECK(j.to_string() == "0"); | ||||
| 
 | ||||
|         // container members
 | ||||
|         CHECK(j.size() == 1); | ||||
|  | @ -1000,7 +1000,7 @@ TEST_CASE("number (float)") | |||
|         CHECK(j.cbegin() != j.cend()); | ||||
| 
 | ||||
|         // string representation of default value
 | ||||
|         CHECK(j.toString() == "0.000000"); | ||||
|         CHECK(j.to_string() == "0.000000"); | ||||
| 
 | ||||
|         // container members
 | ||||
|         CHECK(j.size() == 1); | ||||
|  |  | |||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue