From 8386d3efe128dcb0458e5e991dc0e78c89f43c90 Mon Sep 17 00:00:00 2001 From: Christopher Dunn Date: Fri, 23 Mar 2007 06:38:29 +0000 Subject: [PATCH] Added comments, pre- and post-condition for resize(), clear(), Value(ValueType). --- include/json/value.h | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/include/json/value.h b/include/json/value.h index 5b5e460..fe2f9eb 100644 --- a/include/json/value.h +++ b/include/json/value.h @@ -166,6 +166,13 @@ namespace Json { #endif // ifndef JSONCPP_DOC_EXCLUDE_IMPLEMENTATION 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( Int value ); Value( UInt value ); @@ -230,11 +237,15 @@ namespace Json { UInt size() const; /// Removes all object members and array elements. + /// @pre type() is arrayValue, objectValue, or nullValue + /// @post type() is unchanged void clear(); /// Resize the array to size elements. /// New elements are initialized to null. /// May only be called on nullValue or arrayValue. + /// @pre type() is arrayValue or nullValue + /// @post type() is arrayValue void resize( UInt size ); /// Access an array element (zero based index ).