@@ -35,9 +35,9 @@ class Object;
3535
3636
3737class JSON_API Array
38- // / Represents a JSON array. JSON array provides a representation
38+ // / Represents a JSON array. Array provides a representation
3939 // / based on shared pointers and optimized for performance. It is possible to
40- // / convert object to Poco::Dynamic::Array. Conversion requires copying and therefore
40+ // / convert Array to Poco::Dynamic::Array. Conversion requires copying and therefore
4141 // / has performance penalty; the benefit is in improved syntax, eg:
4242 // /
4343 // / // use pointers to avoid copying
@@ -57,7 +57,7 @@ class JSON_API Array
5757 // / i = da[0]["test"]; // i == 0
5858 // / i = da[1]["test1"][1]; // i == 2
5959 // / i = da[1]["test2"]; // i == 4
60- // /
60+ // / ----
6161{
6262public:
6363 typedef std::vector<Dynamic::Var> ValueVec;
@@ -66,27 +66,27 @@ class JSON_API Array
6666 typedef SharedPtr<Array> Ptr;
6767
6868 Array ();
69- // / Default constructor
69+ // / Creates an empty Array.
7070
7171 Array (const Array& copy);
72- // / Copy Constructor
72+ // / Creates an Array by copying another one.
7373
7474 virtual ~Array ();
75- // / Destructor
75+ // / Destroys the Array.
7676
7777 ValueVec::const_iterator begin () const ;
78- // / Returns iterator
78+ // / Returns the begin iterator for values.
7979
8080 ValueVec::const_iterator end () const ;
81- // / Returns iterator
81+ // / Returns the end iterator for values.
8282
8383 Dynamic::Var get (unsigned int index) const ;
84- // / Retrieves an element. Will return an empty value
85- // / when the element doesn't exist.
84+ // / Retrieves the element at the given index.
85+ // / Will return an empty value when the element doesn't exist.
8686
8787 Array::Ptr getArray (unsigned int index) const ;
8888 // / Retrieves an array. When the element is not
89- // / an array or doesn't exist, an empty SharedPtr is returned.
89+ // / an Array or doesn't exist, an empty SharedPtr is returned.
9090
9191 template <typename T>
9292 T getElement (unsigned int index) const
@@ -104,30 +104,30 @@ class JSON_API Array
104104 // / Retrieves an object. When the element is not
105105 // / an object or doesn't exist, an empty SharedPtr is returned.
106106
107- std::size_t size () const ;
108- // / Returns the size of the array
107+ std::size_t size () const ;
108+ // / Returns the size of the array.
109109
110110 bool isArray (unsigned int index) const ;
111- // / Returns true when the element is an array
111+ // / Returns true when the element is an array.
112112
113113 bool isArray (const Dynamic::Var& value) const ;
114- // / Returns true when the element is an array
114+ // / Returns true when the element is an array.
115115
116116 bool isArray (ConstIterator& value) const ;
117- // / Returns true when the element is an array
117+ // / Returns true when the element is an array.
118118
119119 bool isNull (unsigned int index) const ;
120120 // / Returns true when the element is null or
121121 // / when the element doesn't exist.
122122
123123 bool isObject (unsigned int index) const ;
124- // / Returns true when the element is an object
124+ // / Returns true when the element is an object.
125125
126126 bool isObject (const Dynamic::Var& value) const ;
127- // / Returns true when the element is an object
127+ // / Returns true when the element is an object.
128128
129129 bool isObject (ConstIterator& value) const ;
130- // / Returns true when the element is an object
130+ // / Returns true when the element is an object.
131131
132132 template <typename T>
133133 T optElement (unsigned int index, const T& def) const
@@ -137,13 +137,13 @@ class JSON_API Array
137137 // / value will be returned
138138 {
139139 T value = def;
140- if ( index < _values.size () )
140+ if (index < _values.size ())
141141 {
142142 try
143143 {
144144 value = _values[index].convert <T>();
145145 }
146- catch (...)
146+ catch (...)
147147 {
148148 // Default value is returned.
149149 }
@@ -180,6 +180,9 @@ class JSON_API Array
180180};
181181
182182
183+ //
184+ // inlines
185+ //
183186inline Array::ValueVec::const_iterator Array::begin () const
184187{
185188 return _values.begin ();
@@ -236,7 +239,8 @@ inline void Array::remove(unsigned int index)
236239 _values.erase (_values.begin () + index);
237240}
238241
239- }} // Namespace Poco::JSON
242+
243+ } } // namespace Poco::JSON
240244
241245
242246namespace Poco {
@@ -521,7 +525,7 @@ class VarHolderImpl<JSON::Array>: public VarHolder
521525};
522526
523527
524- }} // namespace Poco::JSON
528+ } } // namespace Poco::Dynamic
525529
526530
527531#endif // JSON_Array_INCLUDED
0 commit comments