Changeset 74387 in vbox
- Timestamp:
- Sep 20, 2018 3:51:35 PM (6 years ago)
- Location:
- trunk
- Files:
-
- 7 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/include/iprt/cpp/restanyobject.h
r74106 r74387 96 96 int assignValue(const char *a_pszValue); 97 97 98 /** Make a clone of this object. */ 99 inline RTCRestAnyObject *clone() const { return (RTCRestAnyObject *)baseClone(); } 100 98 101 /* Overridden methods: */ 102 virtual RTCRestObjectBase *baseClone() const RT_OVERRIDE; 99 103 virtual int setNull(void) RT_OVERRIDE; 100 104 virtual int resetToDefault() RT_OVERRIDE; -
trunk/include/iprt/cpp/restarray.h
r74181 r74387 47 47 48 48 /* Overridden methods: */ 49 virtual RTCRestObjectBase *baseClone() const RT_OVERRIDE; 49 50 virtual int resetToDefault() RT_OVERRIDE; 50 51 virtual RTCRestOutputBase &serializeAsJson(RTCRestOutputBase &a_rDst) const RT_OVERRIDE; … … 132 133 133 134 /** 135 * Helper for creating a clone. 136 * 137 * @returns Pointer to new array on success, NULL if out of memory. 138 */ 139 virtual RTCRestArrayBase *createClone(void) const = 0; 140 141 /** 134 142 * Wrapper around the value constructor. 135 143 * … … 137 145 */ 138 146 virtual RTCRestObjectBase *createValue(void) = 0; 139 140 /**141 * Wrapper around the value copy constructor.142 *143 * @returns Pointer to copy on success, NULL if out of memory.144 * @param a_pSrc The value to copy.145 */146 virtual RTCRestObjectBase *createValueCopy(RTCRestObjectBase const *a_pSrc) = 0;147 147 148 148 /** … … 214 214 215 215 /** Copy assignment operator. */ 216 RTCRestArray &operator=(RTCRestArray const &a_rThat)216 inline RTCRestArray &operator=(RTCRestArray const &a_rThat) 217 217 { 218 218 copyArrayWorker(a_rThat, true /*fThrow*/); … … 221 221 222 222 /** Safe copy assignment method. */ 223 in t assignCopy(RTCRestArray const &a_rThat)223 inline int assignCopy(RTCRestArray const &a_rThat) 224 224 { 225 225 return copyArrayWorker(a_rThat, false /*fThrow*/); 226 } 227 228 /** Make a clone of this object. */ 229 inline RTCRestArray *clone() const 230 { 231 return (RTCRestArray *)baseClone(); 226 232 } 227 233 … … 403 409 404 410 protected: 411 virtual RTCRestArrayBase *createClone(void) const RT_OVERRIDE 412 { 413 return new (std::nothrow) RTCRestArray(); 414 } 415 405 416 virtual RTCRestObjectBase *createValue(void) RT_OVERRIDE 406 417 { 407 418 return new (std::nothrow) ElementType(); 408 419 } 409 410 virtual RTCRestObjectBase *createValueCopy(RTCRestObjectBase const *a_pSrc) RT_OVERRIDE411 {412 ElementType *pCopy = new (std::nothrow) ElementType();413 if (pCopy)414 {415 int rc = pCopy->assignCopy(*(ElementType const *)a_pSrc);416 if (RT_SUCCESS(rc))417 return pCopy;418 delete pCopy;419 }420 return NULL;421 }422 420 }; 423 421 -
trunk/include/iprt/cpp/restbase.h
r74347 r74387 265 265 266 266 /** 267 * Create a copy of this object. 268 * 269 * @returns Pointer to copy. 270 */ 271 virtual RTCRestObjectBase *baseClone() const = 0; 272 273 /** 267 274 * Tests if the object is @a null. 268 275 * @returns true if null, false if not. … … 421 428 /** Assign value and clear null indicator. */ 422 429 void assignValue(bool a_fValue); 430 /** Make a clone of this object. */ 431 inline RTCRestBool *clone() const { return (RTCRestBool *)baseClone(); } 423 432 424 433 /* Overridden methods: */ 434 virtual RTCRestObjectBase *baseClone() const RT_OVERRIDE; 425 435 virtual int resetToDefault() RT_OVERRIDE; 426 436 virtual RTCRestOutputBase &serializeAsJson(RTCRestOutputBase &a_rDst) const RT_OVERRIDE; … … 461 471 /** Assign value and clear null indicator. */ 462 472 void assignValue(int64_t a_iValue); 473 /** Make a clone of this object. */ 474 inline RTCRestInt64 *clone() const { return (RTCRestInt64 *)baseClone(); } 463 475 464 476 /* Overridden methods: */ 477 virtual RTCRestObjectBase *baseClone() const RT_OVERRIDE; 465 478 virtual int resetToDefault() RT_OVERRIDE; 466 479 virtual RTCRestOutputBase &serializeAsJson(RTCRestOutputBase &a_rDst) const RT_OVERRIDE; … … 501 514 /** Assign value and clear null indicator. */ 502 515 void assignValue(int32_t a_iValue); 516 /** Make a clone of this object. */ 517 inline RTCRestInt32 *clone() const { return (RTCRestInt32 *)baseClone(); } 503 518 504 519 /* Overridden methods: */ 520 virtual RTCRestObjectBase *baseClone() const RT_OVERRIDE; 505 521 virtual int resetToDefault() RT_OVERRIDE; 506 522 virtual RTCRestOutputBase &serializeAsJson(RTCRestOutputBase &a_rDst) const RT_OVERRIDE; … … 541 557 /** Assign value and clear null indicator. */ 542 558 void assignValue(int16_t a_iValue); 559 /** Make a clone of this object. */ 560 inline RTCRestInt16 *clone() const { return (RTCRestInt16 *)baseClone(); } 543 561 544 562 /* Overridden methods: */ 563 virtual RTCRestObjectBase *baseClone() const RT_OVERRIDE; 545 564 virtual int resetToDefault() RT_OVERRIDE; 546 565 virtual RTCRestOutputBase &serializeAsJson(RTCRestOutputBase &a_rDst) const RT_OVERRIDE; … … 581 600 /** Assign value and clear null indicator. */ 582 601 void assignValue(double a_rdValue); 602 /** Make a clone of this object. */ 603 inline RTCRestDouble *clone() const { return (RTCRestDouble *)baseClone(); } 583 604 584 605 /* Overridden methods: */ 606 virtual RTCRestObjectBase *baseClone() const RT_OVERRIDE; 585 607 virtual int resetToDefault() RT_OVERRIDE; 586 608 virtual RTCRestOutputBase &serializeAsJson(RTCRestOutputBase &a_rDst) const RT_OVERRIDE; … … 604 626 * Class wrapping 'RTCString'. 605 627 */ 606 class RT_DECL_CLASS RTCRestString : public RTC String, public RTCRestObjectBase628 class RT_DECL_CLASS RTCRestString : public RTCRestObjectBase, public RTCString 607 629 { 608 630 public: … … 624 646 /** Safe copy assignment method. */ 625 647 int assignCopy(const char *a_pszThat); 648 /** Make a clone of this object. */ 649 inline RTCRestString *clone() const { return (RTCRestString *)baseClone(); } 626 650 627 651 /* Overridden methods: */ 652 virtual RTCRestObjectBase *baseClone() const RT_OVERRIDE; 628 653 virtual int setNull(void) RT_OVERRIDE; /* (ambigious, so overrider it to make sure.) */ 629 654 virtual int resetToDefault() RT_OVERRIDE; … … 688 713 /** Safe copy assignment method. */ 689 714 int assignCopy(RTCRestDate const &a_rThat); 715 /** Make a clone of this object. */ 716 inline RTCRestDate *clone() const { return (RTCRestDate *)baseClone(); } 690 717 691 718 /* Overridden methods: */ 719 virtual RTCRestObjectBase *baseClone() const RT_OVERRIDE; 692 720 virtual int resetToDefault() RT_OVERRIDE; 693 721 virtual RTCRestOutputBase &serializeAsJson(RTCRestOutputBase &a_rDst) const RT_OVERRIDE; … … 908 936 bool setWorker(int a_iEnumValue); 909 937 938 /** Helper for implementing RTCRestObjectBase::clone(). */ 939 RTCRestObjectBase *cloneWorker(RTCRestStringEnumBase *a_pDst) const; 940 910 941 /** 911 942 * Gets the mapping table. … … 949 980 inline size_t getSize() const { return m_cbData; } 950 981 982 /** Make a clone of this object. */ 983 inline RTCRestBinary *clone() const { return (RTCRestBinary *)baseClone(); } 984 951 985 /* Overridden methods: */ 986 virtual RTCRestObjectBase *baseClone() const RT_OVERRIDE; 952 987 virtual int setNull(void) RT_OVERRIDE; 953 988 virtual int resetToDefault(void) RT_OVERRIDE; … … 983 1018 984 1019 /** 985 * Abstract base class for REST data model objects.1020 * Abstract base class for REST data model classes. 986 1021 */ 987 1022 class RT_DECL_CLASS RTCRestDataObject : public RTCRestObjectBase … … 998 1033 virtual kTypeClass typeClass(void) const RT_OVERRIDE; 999 1034 1000 /** Safe copy assignment method. */1001 virtual int assignCopy(RTCRestDataObject const &a_rThat);1002 1003 1035 /** 1004 1036 * Serialize the members as JSON. … … 1028 1060 /** Copy assignment operator. */ 1029 1061 RTCRestDataObject &operator=(RTCRestDataObject const &a_rThat); 1062 1063 /** Safe copy assignment method. */ 1064 virtual int assignCopy(RTCRestDataObject const &a_rThat); 1065 }; 1066 1067 1068 /** 1069 * Abstract base class for polymorphic REST data model classes. 1070 */ 1071 class RT_DECL_CLASS RTCRestPolyDataObject : public RTCRestDataObject 1072 { 1073 public: 1074 RTCRestPolyDataObject(); 1075 RTCRestPolyDataObject(RTCRestPolyDataObject const &a_rThat); 1076 virtual ~RTCRestPolyDataObject(); 1077 1078 /* Overridden methods:*/ 1079 virtual int resetToDefault() RT_OVERRIDE; 1080 1081 /** Checks if the instance is of a child class (@c true) or of the parent (@c false). */ 1082 virtual bool isChild() const; 1083 1084 protected: 1085 1086 /** Copy assignment operator. */ 1087 RTCRestPolyDataObject &operator=(RTCRestPolyDataObject const &a_rThat); 1030 1088 }; 1031 1089 -
trunk/include/iprt/cpp/restclient.h
r74351 r74387 66 66 virtual int assignWriteable(void *a_pvBuf, size_t a_cbBuf) RT_OVERRIDE; 67 67 68 /** Make a clone of this object. */ 69 inline RTCRestBinaryParameter *clone() const { return (RTCRestBinaryParameter *)baseClone(); } 70 68 71 /* Overridden methods: */ 72 virtual RTCRestObjectBase *baseClone() const RT_OVERRIDE; 69 73 virtual int resetToDefault() RT_OVERRIDE; 70 74 virtual const char *typeName(void) const RT_OVERRIDE; … … 200 204 virtual int assignWriteable(void *a_pvBuf, size_t a_cbBuf) RT_OVERRIDE; 201 205 206 /** Make a clone of this object. */ 207 inline RTCRestBinaryResponse *clone() const { return (RTCRestBinaryResponse *)baseClone(); } 208 202 209 /* Overridden methods: */ 210 virtual RTCRestObjectBase *baseClone() const RT_OVERRIDE; 203 211 virtual int resetToDefault() RT_OVERRIDE; 204 212 virtual const char *typeName(void) const RT_OVERRIDE; -
trunk/include/iprt/cpp/reststringmap.h
r74197 r74387 53 53 54 54 /* Overridden methods: */ 55 virtual RTCRestObjectBase *baseClone() const RT_OVERRIDE; 55 56 virtual int resetToDefault() RT_OVERRIDE; 56 57 virtual RTCRestOutputBase &serializeAsJson(RTCRestOutputBase &a_rDst) const RT_OVERRIDE; … … 216 217 protected: 217 218 /** 219 * Helper for creating a clone. 220 * 221 * @returns Pointer to new map object on success, NULL if out of memory. 222 */ 223 virtual RTCRestStringMapBase *createClone(void) const = 0; 224 225 /** 218 226 * Wrapper around the value constructor. 219 227 * … … 221 229 */ 222 230 virtual RTCRestObjectBase *createValue(void) = 0; 223 224 /**225 * Wrapper around the value copy constructor.226 *227 * @returns Pointer to copy on success, NULL if out of memory.228 * @param a_pSrc The value to copy.229 */230 virtual RTCRestObjectBase *createValueCopy(RTCRestObjectBase const *a_pSrc) = 0;231 231 232 232 /** … … 324 324 } 325 325 326 /** Make a clone of this object. */ 327 inline RTCRestStringMap *clone() const 328 { 329 return (RTCRestStringMap *)baseClone(); 330 } 331 326 332 /** Factory method. */ 327 333 static DECLCALLBACK(RTCRestObjectBase *) createInstance(void) … … 439 445 440 446 protected: 447 virtual RTCRestStringMapBase *createClone(void) const RT_OVERRIDE 448 { 449 return new (std::nothrow) RTCRestStringMap(); 450 } 451 441 452 virtual RTCRestObjectBase *createValue(void) RT_OVERRIDE 442 453 { 443 454 return new (std::nothrow) ValueType(); 444 455 } 445 446 virtual RTCRestObjectBase *createValueCopy(RTCRestObjectBase const *a_pSrc) RT_OVERRIDE447 {448 ValueType *pCopy = new (std::nothrow) ValueType();449 if (pCopy)450 {451 int rc = pCopy->assignCopy(*(ValueType const *)a_pSrc);452 if (RT_SUCCESS(rc))453 return pCopy;454 delete pCopy;455 }456 return NULL;457 }458 456 }; 459 457 -
trunk/src/VBox/Runtime/VBox/VBoxRTImp-vcc32.def
r74351 r74387 220 220 ?assignCopy@RTCRestBinaryResponse@@UAEHPBXI@Z ; (public: virtual int __thiscall RTCRestBinaryResponse::assignCopy(void const *,unsigned int)) 221 221 ?assignCopy@RTCRestBool@@QAEHABV1@@Z ; (public: int __thiscall RTCRestBool::assignCopy(class RTCRestBool const &)) 222 ?assignCopy@RTCRestDataObject@@ UAEHABV1@@Z ; (public: virtual int __thiscall RTCRestDataObject::assignCopy(class RTCRestDataObject const &))222 ?assignCopy@RTCRestDataObject@@MAEHABV1@@Z ; (protected: virtual int __thiscall RTCRestDataObject::assignCopy(class RTCRestDataObject const &)) 223 223 ?assignCopy@RTCRestDate@@QAEHABV1@@Z ; (public: int __thiscall RTCRestDate::assignCopy(class RTCRestDate const &)) 224 224 ?assignCopy@RTCRestDouble@@QAEHABV1@@Z ; (public: int __thiscall RTCRestDouble::assignCopy(class RTCRestDouble const &)) -
trunk/src/VBox/Runtime/VBox/VBoxRTImp-vcc64.def
r74351 r74387 220 220 ?assignCopy@RTCRestBinaryResponse@@UEAAHPEBX_K@Z ; (public: virtual int __cdecl RTCRestBinaryResponse::assignCopy(void const *,unsigned __int64)) 221 221 ?assignCopy@RTCRestBool@@QEAAHAEBV1@@Z ; (public: int __cdecl RTCRestBool::assignCopy(class RTCRestBool const &)) 222 ?assignCopy@RTCRestDataObject@@ UEAAHAEBV1@@Z ; (public: virtual int __cdecl RTCRestDataObject::assignCopy(class RTCRestDataObject const &))222 ?assignCopy@RTCRestDataObject@@MEAAHAEBV1@@Z ; (protected: virtual int __cdecl RTCRestDataObject::assignCopy(class RTCRestDataObject const &)) 223 223 ?assignCopy@RTCRestDate@@QEAAHAEBV1@@Z ; (public: int __cdecl RTCRestDate::assignCopy(class RTCRestDate const &)) 224 224 ?assignCopy@RTCRestDouble@@QEAAHAEBV1@@Z ; (public: int __cdecl RTCRestDouble::assignCopy(class RTCRestDouble const &))
Note:
See TracChangeset
for help on using the changeset viewer.