瀏覽代碼

Rename *_value() to to_*()

Daniele Bartolini 12 年之前
父節點
當前提交
d144f3f3bd
共有 2 個文件被更改,包括 32 次插入32 次删除
  1. 13 13
      engine/core/json/JSONParser.cpp
  2. 19 19
      engine/core/json/JSONParser.h

+ 13 - 13
engine/core/json/JSONParser.cpp

@@ -210,34 +210,34 @@ bool JSONElement::is_key_unique(const char* k) const
 }
 
 //--------------------------------------------------------------------------
-bool JSONElement::bool_value() const
+bool JSONElement::to_bool() const
 {
 	const bool value = json::parse_bool(m_at);
 	return value;
 }
 
 //--------------------------------------------------------------------------
-int32_t JSONElement::int_value() const
+int32_t JSONElement::to_int() const
 {
 	const int32_t value = json::parse_int(m_at);
 	return value;
 }
 
 //--------------------------------------------------------------------------
-float JSONElement::float_value() const
+float JSONElement::to_float() const
 {
 	const float value = json::parse_float(m_at);
 	return value;
 }
 
 //--------------------------------------------------------------------------
-void JSONElement::string_value(DynamicString& str) const
+void JSONElement::to_string(DynamicString& str) const
 {
 	json::parse_string(m_at, str);
 }
 
 //--------------------------------------------------------------------------
-StringId32 JSONElement::string_id_value() const
+StringId32 JSONElement::to_string_id() const
 {
 	TempAllocator1024 alloc;
 	DynamicString str(alloc);
@@ -246,7 +246,7 @@ StringId32 JSONElement::string_id_value() const
 }
 
 //--------------------------------------------------------------------------
-void JSONElement::array_value(List<bool>& array) const
+void JSONElement::to_array(List<bool>& array) const
 {
 	List<const char*> temp(default_allocator());
 
@@ -259,7 +259,7 @@ void JSONElement::array_value(List<bool>& array) const
 }
 
 //--------------------------------------------------------------------------
-void JSONElement::array_value(List<int16_t>& array) const
+void JSONElement::to_array(List<int16_t>& array) const
 {
 	List<const char*> temp(default_allocator());
 
@@ -272,7 +272,7 @@ void JSONElement::array_value(List<int16_t>& array) const
 }
 
 //--------------------------------------------------------------------------
-void JSONElement::array_value(List<uint16_t>& array) const
+void JSONElement::to_array(List<uint16_t>& array) const
 {
 	List<const char*> temp(default_allocator());
 
@@ -285,7 +285,7 @@ void JSONElement::array_value(List<uint16_t>& array) const
 }
 
 //--------------------------------------------------------------------------
-void JSONElement::array_value(List<int32_t>& array) const
+void JSONElement::to_array(List<int32_t>& array) const
 {
 	List<const char*> temp(default_allocator());
 
@@ -298,7 +298,7 @@ void JSONElement::array_value(List<int32_t>& array) const
 }
 
 //--------------------------------------------------------------------------
-void JSONElement::array_value(List<uint32_t>& array) const
+void JSONElement::to_array(List<uint32_t>& array) const
 {
 	List<const char*> temp(default_allocator());
 
@@ -311,7 +311,7 @@ void JSONElement::array_value(List<uint32_t>& array) const
 }
 
 //--------------------------------------------------------------------------
-void JSONElement::array_value(List<float>& array) const
+void JSONElement::to_array(List<float>& array) const
 {
 	List<const char*> temp(default_allocator());
 
@@ -324,7 +324,7 @@ void JSONElement::array_value(List<float>& array) const
 }
 
 //--------------------------------------------------------------------------
-void JSONElement::array_value(Vector<DynamicString>& array) const
+void JSONElement::to_array(Vector<DynamicString>& array) const
 {
 	List<const char*> temp(default_allocator());
 
@@ -339,7 +339,7 @@ void JSONElement::array_value(Vector<DynamicString>& array) const
 }
 
 //--------------------------------------------------------------------------
-void JSONElement::key_value(Vector<DynamicString>& keys) const
+void JSONElement::to_keys(Vector<DynamicString>& keys) const
 {
 	List<JSONPair> object(default_allocator());
 	json::parse_object(m_at, object);

+ 19 - 19
engine/core/json/JSONParser.h

@@ -107,19 +107,19 @@ public:
 	uint32_t			size() const;
 
 	/// Returns the boolean value of the element.
-	bool				bool_value() const;
+	bool				to_bool() const;
 
 	/// Returns the integer value of the element.
-	int32_t				int_value() const;
+	int32_t				to_int() const;
 
 	/// Returns the float value of the element.
-	float				float_value() const;
+	float				to_float() const;
 
 	/// Returns the string value of the element.
-	void				string_value(DynamicString& str) const;
+	void				to_string(DynamicString& str) const;
 
 	/// Returns the string id value hashed to hash::murmur2_32() of the element.
-	StringId32			string_id_value() const;
+	StringId32			to_string_id() const;
 
 	/// Returns the array value of the element.
 	/// @note
@@ -127,28 +127,28 @@ public:
 	/// array elements by JSONElement::operator[] and it is the very preferred way
 	/// for retrieving array elemets. However, you have to be sure that the array
 	/// contains only items of the given @array type.
-	void				array_value(List<bool>& array) const;
+	void				to_array(List<bool>& array) const;
 
-	/// @copydoc JSONElement::array_value(List<bool>&)
-	void				array_value(List<int16_t>& array) const;
+	/// @copydoc JSONElement::to_array(List<bool>&)
+	void				to_array(List<int16_t>& array) const;
 
-	/// @copydoc JSONElement::array_value(List<bool>&)
-	void				array_value(List<uint16_t>& array) const;
+	/// @copydoc JSONElement::to_array(List<bool>&)
+	void				to_array(List<uint16_t>& array) const;
 
-	/// @copydoc JSONElement::array_value(List<bool>&)
-	void				array_value(List<int32_t>& array) const;
+	/// @copydoc JSONElement::to_array(List<bool>&)
+	void				to_array(List<int32_t>& array) const;
 
-	/// @copydoc JSONElement::array_value(List<bool>&)
-	void				array_value(List<uint32_t>& array) const;
+	/// @copydoc JSONElement::to_array(List<bool>&)
+	void				to_array(List<uint32_t>& array) const;
 
-	/// @copydoc JSONElement::array_value(List<bool>&)
-	void				array_value(List<float>& array) const;
+	/// @copydoc JSONElement::to_array(List<bool>&)
+	void				to_array(List<float>& array) const;
 
-	/// @copydoc JSONElement::array_value(List<bool>&)
-	void				array_value(Vector<DynamicString>& array) const;
+	/// @copydoc JSONElement::to_array(List<bool>&)
+	void				to_array(Vector<DynamicString>& array) const;
 
 	/// Returns all the keys of the element.
-	void				key_value(Vector<DynamicString>& keys) const;
+	void				to_keys(Vector<DynamicString>& keys) const;
 
 private: