Changeset 74008 in vbox for trunk/include/iprt/cpp
- Timestamp:
- Aug 31, 2018 7:08:02 PM (7 years ago)
- svn:sync-xref-src-repo-rev:
- 124754
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/include/iprt/cpp/restbase.h
r73978 r74008 256 256 /** 257 257 * Abstract base class for REST data objects. 258 * 259 * The only information this keeps is the null indicator. 258 260 */ 259 261 class RT_DECL_CLASS RTCRestObjectBase … … 261 263 public: 262 264 RTCRestObjectBase(); 265 RTCRestObjectBase(RTCRestObjectBase const &a_rThat); 263 266 virtual ~RTCRestObjectBase(); 264 267 265 /** @todo Add some kind of state? */ 268 /** 269 * Tests if the object is @a null. 270 * @returns true if null, false if not. 271 */ 272 bool isNull(void) const { return m_fNullIndicator; }; 273 274 /** 275 * Sets the object to @a null and fills it with defaults. 276 * @returns IPRT status code (from resetToDefault). 277 */ 278 virtual int setNull(void); 279 280 /** 281 * Sets the object to not-null state (i.e. undoes setNull()). 282 * @remarks Only really important for strings. 283 */ 284 virtual void setNotNull(void); 266 285 267 286 /** … … 353 372 /** Pointer to factory method. */ 354 373 typedef FNCREATEINSTANCE *PFNCREATEINSTANCE; 374 375 376 protected: 377 /** Null indicator. 378 * @remarks The null values could be mapped onto C/C++ NULL pointer values, 379 * with the consequence that all data members in objects and such would 380 * have had to been allocated individually, even simple @a bool members. 381 * Given that we're overly paranoid about heap allocations (std::bad_alloc), 382 * it's more fitting to use a null indicator for us. 383 */ 384 bool m_fNullIndicator; 355 385 }; 356 386 … … 559 589 RTCRestString(const char *a_pszSrc); 560 590 /** Safe copy assignment method. */ 591 int assignCopy(RTCRestString const &a_rThat); 592 /** Safe copy assignment method. */ 561 593 int assignCopy(RTCString const &a_rThat); 562 594 /** Safe copy assignment method. */ … … 564 596 565 597 /* Overridden methods: */ 598 virtual int setNull(void) RT_OVERRIDE; /* (ambigious, so overrider it to make sure.) */ 566 599 virtual int resetToDefault() RT_OVERRIDE; 567 600 virtual RTCRestOutputBase &serializeAsJson(RTCRestOutputBase &a_rDst) const RT_OVERRIDE; … … 1297 1330 1298 1331 /* Overridden methods: */ 1332 virtual int setNull(void) RT_OVERRIDE; 1299 1333 virtual int resetToDefault() RT_OVERRIDE; 1300 1334 virtual RTCRestOutputBase &serializeAsJson(RTCRestOutputBase &a_rDst) const RT_OVERRIDE;
Note:
See TracChangeset
for help on using the changeset viewer.