@@ -99,7 +99,10 @@ struct has_as {
9999
100100#endif  //  !defined(MSGPACK_USE_CPP03)
101101
102- 
102+ // / Object class that corresponding to MessagePack format object
103+ /* *
104+  * See https://github.com/msgpack/msgpack-c/wiki/v1_1_cpp_object 
105+  */  
103106struct  object  {
104107    union  union_type {
105108        bool  boolean;
@@ -119,42 +122,114 @@ struct object {
119122    msgpack::type::object_type type;
120123    union_type via;
121124
125+     // / Cheking nil
126+     /* *
127+      * @return If the object is nil, then return true, else return false. 
128+      */  
122129    bool  is_nil () const  { return  type == msgpack::type::NIL; }
123130
124131#if  defined(MSGPACK_USE_CPP03)
125132
133+     // / Get value as T
134+     /* *
135+      * If the object can't be converted to T, msgpack::type_error would be thrown. 
136+      * @tparam T The type you want to get. 
137+      * @return The converted object. 
138+      */  
126139    template  <typename  T>
127140    T as () const ;
128141
129142#else   //  defined(MSGPACK_USE_CPP03)
130143
144+     // / Get value as T
145+     /* *
146+      * If the object can't be converted to T, msgpack::type_error would be thrown. 
147+      * @tparam T The type you want to get. 
148+      * @return The converted object. 
149+      */  
131150    template  <typename  T>
132151    typename  std::enable_if<msgpack::has_as<T>::value, T>::type as () const ;
133152
153+     // / Get value as T
154+     /* *
155+      * If the object can't be converted to T, msgpack::type_error would be thrown. 
156+      * @tparam T The type you want to get. 
157+      * @return The converted object. 
158+      */  
134159    template  <typename  T>
135160    typename  std::enable_if<!msgpack::has_as<T>::value, T>::type as () const ;
136161
137162#endif  //  defined(MSGPACK_USE_CPP03)
138163
164+     // / Convert the object
165+     /* *
166+      * If the object can't be converted to T, msgpack::type_error would be thrown. 
167+      * @tparam T The type of v. 
168+      * @param v The value you want to get. `v` is output parameter. `v` is overwritten by converted value from the object. 
169+      * @return The reference of `v`. 
170+      */  
139171    template  <typename  T>
140172    T& convert (T& v) const ;
173+ 
174+     // / Convert the object (obsolete)
175+     /* *
176+      * If the object can't be converted to T, msgpack::type_error would be thrown. 
177+      * @tparam T The type of v. 
178+      * @param v The pointer of the value you want to get. `v` is output parameter. `*v` is overwritten by converted value from the object. 
179+      * @return The pointer of `v`. 
180+      */  
141181    template  <typename  T>
142182    T* convert (T* v) const ;
143183
184+     // / Convert the object if not nil
185+     /* *
186+      * If the object is not nil and can't be converted to T, msgpack::type_error would be thrown. 
187+      * @tparam T The type of v. 
188+      * @param v The value you want to get. `v` is output parameter. `v` is overwritten by converted value from the object if the object is not nil. 
189+      * @return If the object is nil, then return false, else return true. 
190+      */  
144191    template  <typename  T>
145192    bool  convert_if_not_nil (T& v) const ;
146193
194+     // / Default constructor. The object is set to nil.
147195    object ();
148196
197+     // / Copy constructor. Object is shallow copied.
149198    object (const  msgpack_object& o);
150199
200+     // / Construct object from T
201+     /* *
202+      * If `v` is the type that is corresponding to MessegePack format str, bin, ext, array, or map, 
203+      * you need to call `object(const T& v, msgpack::zone& z)` instead of this constructor. 
204+      * 
205+      * @tparam T The type of `v`. 
206+      * @param v The value you want to convert. 
207+      */  
151208    template  <typename  T>
152209    explicit  object (const  T& v);
153210
211+     // / Construct object from T
212+     /* *
213+      * The object is constructed on the zone `z`. 
214+      * See https://github.com/msgpack/msgpack-c/wiki/v1_1_cpp_object 
215+      * 
216+      * @tparam T The type of `v`. 
217+      * @param v The value you want to convert. 
218+      * @param z The zone that is used by the object. 
219+      */  
154220    template  <typename  T>
155221    object (const  T& v, msgpack::zone& z);
156222
157-     //  obsolete
223+     // / Construct object from T (obsolete)
224+     /* *
225+      * The object is constructed on the zone `z`. 
226+      * Use `object(const T& v, msgpack::zone& z)` instead of this constructor. 
227+      * See https://github.com/msgpack/msgpack-c/wiki/v1_1_cpp_object 
228+      * 
229+      * @tparam T The type of `v`. 
230+      * @param v The value you want to convert. 
231+      * @param z The pointer to the zone that is used by the object. 
232+      */  
158233    template  <typename  T>
159234    object (const  T& v, msgpack::zone* z);
160235
0 commit comments