Added comments, pre- and post-condition for resize(), clear(), Value(ValueType).

This commit is contained in:
Christopher Dunn 2007-03-23 06:38:29 +00:00
parent 5674738668
commit 8386d3efe1

View File

@ -166,6 +166,13 @@ namespace Json {
#endif // ifndef JSONCPP_DOC_EXCLUDE_IMPLEMENTATION #endif // ifndef JSONCPP_DOC_EXCLUDE_IMPLEMENTATION
public: public:
/** \brief Create a default Value of the given type.
This is a very useful constructor.
To create an empty array, pass arrayValue.
To create an empty object, pass objectValue.
Another Value can then be set to this one by assignment.
This is useful since clear() and resize() will not alter types.
*/
Value( ValueType type = nullValue ); Value( ValueType type = nullValue );
Value( Int value ); Value( Int value );
Value( UInt value ); Value( UInt value );
@ -230,11 +237,15 @@ namespace Json {
UInt size() const; UInt size() const;
/// Removes all object members and array elements. /// Removes all object members and array elements.
/// @pre type() is arrayValue, objectValue, or nullValue
/// @post type() is unchanged
void clear(); void clear();
/// Resize the array to size elements. /// Resize the array to size elements.
/// New elements are initialized to null. /// New elements are initialized to null.
/// May only be called on nullValue or arrayValue. /// May only be called on nullValue or arrayValue.
/// @pre type() is arrayValue or nullValue
/// @post type() is arrayValue
void resize( UInt size ); void resize( UInt size );
/// Access an array element (zero based index ). /// Access an array element (zero based index ).