From: Sean Middleditch Date: Sat, 16 Jan 2010 09:40:16 +0000 (-0800) Subject: rename ArrayProxy to ElementProxy and ObjectProxy to PropertyProxy X-Git-Tag: v1.3~21^2~3^2~7 X-Git-Url: http://www.project-moonshot.org/gitweb/?p=jansson.git;a=commitdiff_plain;h=2dc2b6bab7176f5e49597fc97aaf6788d5f53b01 rename ArrayProxy to ElementProxy and ObjectProxy to PropertyProxy --- diff --git a/janssonxx.h b/janssonxx.h index c8a70ab..bac4317 100644 --- a/janssonxx.h +++ b/janssonxx.h @@ -23,8 +23,8 @@ namespace jansson { class Value; namespace _private { - class ArrayProxy; - class ObjectProxy; + class ElementProxy; + class PropertyProxy; // base class for JSON value interface template @@ -69,14 +69,14 @@ namespace jansson { inline const Value operator[](unsigned long index) const; // get value at array index (non-const version) - inline ValueBase at(unsigned int index); + inline ValueBase at(unsigned int index); - inline ValueBase operator[](signed int index); - inline ValueBase operator[](unsigned int index); - inline ValueBase operator[](signed short index); - inline ValueBase operator[](unsigned short index); - inline ValueBase operator[](signed long index); - inline ValueBase operator[](unsigned long index); + inline ValueBase operator[](signed int index); + inline ValueBase operator[](unsigned int index); + inline ValueBase operator[](signed short index); + inline ValueBase operator[](unsigned short index); + inline ValueBase operator[](signed long index); + inline ValueBase operator[](unsigned long index); // get object property (const version) inline const Value get(const char* key) const; @@ -86,11 +86,11 @@ namespace jansson { inline const Value operator[](const std::string& key) const; // get object property (non-const version) - inline ValueBase get(const char* key); + inline ValueBase get(const char* key); - inline ValueBase get(const std::string& key); - inline ValueBase operator[](const char* key); - inline ValueBase operator[](const std::string& key); + inline ValueBase get(const std::string& key); + inline ValueBase operator[](const char* key); + inline ValueBase operator[](const std::string& key); // clear all array/object values inline void clear(); @@ -164,13 +164,13 @@ namespace jansson { }; // proxies an array element - class ArrayProxy { + class ElementProxy { public: // constructor - ArrayProxy(json_t* array, unsigned int index) : _array(array), _index(index) {} + ElementProxy(json_t* array, unsigned int index) : _array(array), _index(index) {} // assign to the proxied element - inline ArrayProxy& operator=(const Value& value); + inline ElementProxy& operator=(const Value& value); // get the proxied element json_t* as_json() const { return json_array_get(_array, _index); } @@ -184,13 +184,13 @@ namespace jansson { }; // proxies an object property - class ObjectProxy { + class PropertyProxy { public: // constructor - ObjectProxy(json_t* array, const char* key) : _object(array), _key(key) {} + PropertyProxy(json_t* array, const char* key) : _object(array), _key(key) {} // assign to the proxied element - inline ObjectProxy& operator=(const Value& value); + inline PropertyProxy& operator=(const Value& value); // get the proxied element json_t* as_json() const { return json_object_get(_object, _key); } @@ -275,7 +275,7 @@ namespace jansson { } // construct a new iterator for a given object - Iterator(const _private::ValueBase<_private::ObjectProxy>& value) : _object(value.as_json()), _iter(0) { + Iterator(const _private::ValueBase<_private::PropertyProxy>& value) : _object(value.as_json()), _iter(0) { _iter = json_object_iter(_object.as_json()); } diff --git a/janssonxx.tcc b/janssonxx.tcc index 0bc505b..2ba753e 100644 --- a/janssonxx.tcc +++ b/janssonxx.tcc @@ -28,22 +28,22 @@ const jansson::Value jansson::_private::ValueBase<_Base>::operator[](unsigned lo // get value at array index (non-const version) template -jansson::_private::ValueBase jansson::_private::ValueBase<_Base>::at(unsigned int index) { - return ArrayProxy(_Base::as_json(), index); +jansson::_private::ValueBase jansson::_private::ValueBase<_Base>::at(unsigned int index) { + return ElementProxy(_Base::as_json(), index); } template -jansson::_private::ValueBase jansson::_private::ValueBase<_Base>::operator[](signed int index) { return at(index); } +jansson::_private::ValueBase jansson::_private::ValueBase<_Base>::operator[](signed int index) { return at(index); } template -jansson::_private::ValueBase jansson::_private::ValueBase<_Base>::operator[](unsigned int index) { return at(index); } +jansson::_private::ValueBase jansson::_private::ValueBase<_Base>::operator[](unsigned int index) { return at(index); } template -jansson::_private::ValueBase jansson::_private::ValueBase<_Base>::operator[](signed short index) { return at(index); } +jansson::_private::ValueBase jansson::_private::ValueBase<_Base>::operator[](signed short index) { return at(index); } template -jansson::_private::ValueBase jansson::_private::ValueBase<_Base>::operator[](unsigned short index) { return at(index); } +jansson::_private::ValueBase jansson::_private::ValueBase<_Base>::operator[](unsigned short index) { return at(index); } template -jansson::_private::ValueBase jansson::_private::ValueBase<_Base>::operator[](signed long index) { return at(index); } +jansson::_private::ValueBase jansson::_private::ValueBase<_Base>::operator[](signed long index) { return at(index); } template -jansson::_private::ValueBase jansson::_private::ValueBase<_Base>::operator[](unsigned long index) { return at(index); } +jansson::_private::ValueBase jansson::_private::ValueBase<_Base>::operator[](unsigned long index) { return at(index); } // get object property (const version) template @@ -60,16 +60,16 @@ const jansson::Value jansson::_private::ValueBase<_Base>::operator[](const std:: // get object property (non-const version) template -jansson::_private::ValueBase jansson::_private::ValueBase<_Base>::get(const char* key) { - return ObjectProxy(_Base::as_json(), key); +jansson::_private::ValueBase jansson::_private::ValueBase<_Base>::get(const char* key) { + return PropertyProxy(_Base::as_json(), key); } template -jansson::_private::ValueBase jansson::_private::ValueBase<_Base>::get(const std::string& key) { return get(key.c_str()); } +jansson::_private::ValueBase jansson::_private::ValueBase<_Base>::get(const std::string& key) { return get(key.c_str()); } template -jansson::_private::ValueBase jansson::_private::ValueBase<_Base>::operator[](const char* key) { return get(key); } +jansson::_private::ValueBase jansson::_private::ValueBase<_Base>::operator[](const char* key) { return get(key); } template -jansson::_private::ValueBase jansson::_private::ValueBase<_Base>::operator[](const std::string& key) { return get(key.c_str()); } +jansson::_private::ValueBase jansson::_private::ValueBase<_Base>::operator[](const std::string& key) { return get(key.c_str()); } // clear all array/object values template @@ -146,13 +146,13 @@ template } // assign value to proxied array element -jansson::_private::ArrayProxy& jansson::_private::ArrayProxy::operator=(const Value& value) { +jansson::_private::ElementProxy& jansson::_private::ElementProxy::operator=(const Value& value) { json_array_set(_array, _index, value.as_json()); return *this; } // assign value to proxied object property -jansson::_private::ObjectProxy& jansson::_private::ObjectProxy::operator=(const Value& value) { +jansson::_private::PropertyProxy& jansson::_private::PropertyProxy::operator=(const Value& value) { json_object_set(_object, _key, value.as_json()); return *this; }