@@ -105,8 +105,17 @@ namespace App
105105 public:
106106 enum PropertyFlags
107107 {
108- kPropertyFlagNotDirect = 0x10 ,
109- kPropertyFlagArray = 0x30
108+ // / If set, when the property object is destroyed, it will try to cleanup memory
109+ kPropertyFlagCleanup = 4 ,
110+ // / If set, the data is stored in a separate buffer, pointed at by the fields in PropertyArray
111+ kPropertyFlagPointer = 0x10 ,
112+ // / If set, the property will not deallocate memory pointed by it; if not set, the pointer memory will be deleted when the property is destroyed
113+ kPropertyFlagSkipDealloc = 0x20 ,
114+
115+ // / Combination of flags for array properties that must copy their origin data, and must clean it up on delete
116+ kPropertyFlagArrayByCopy = kPropertyFlagPointer | kPropertyFlagCleanup ,
117+ // / Combination of flags for array properties whose data is a reference to memory managed by other code, and must not copy nor delete that memory
118+ kPropertyFlagArrayByReference = kPropertyFlagPointer | kPropertyFlagSkipDealloc ,
110119 };
111120
112121 public:
@@ -392,120 +401,135 @@ namespace App
392401 // / This will be an array bool property of 'nValueCount' values.
393402 // / @param pValues The array with the values.
394403 // / @param nValueCount How many values the array has.
404+ // / @param flags Set of flags for the property; by default, it makes the array a reference to the given memory
395405 // /
396- Property& SetArrayBool (const bool * pValues, size_t nValueCount);
406+ Property& SetArrayBool (const bool * pValues, size_t nValueCount, int flags = kPropertyFlagArrayByReference );
397407
398408 // /
399409 // / Sets the value of this Property to an array of int32_t values.
400410 // / This will be an array int32 property of 'nValueCount' values.
401411 // / @param pValues The array with the values.
402412 // / @param nValueCount How many values the array has.
413+ // / @param flags Set of flags for the property; by default, it makes the array a reference to the given memory
403414 // /
404- Property& SetArrayInt32 (const int32_t * pValues, size_t nValueCount);
415+ Property& SetArrayInt32 (const int32_t * pValues, size_t nValueCount, int flags = kPropertyFlagArrayByReference );
405416
406417 // /
407418 // / Sets the value of this Property to an array of uint32_t values.
408419 // / This will be an array uint32 property of 'nValueCount' values.
409420 // / @param pValues The array with the values.
410421 // / @param nValueCount How many values the array has.
422+ // / @param flags Set of flags for the property; by default, it makes the array a reference to the given memory
411423 // /
412- Property& SetArrayUInt32 (const uint32_t * pValues, size_t nValueCount);
424+ Property& SetArrayUInt32 (const uint32_t * pValues, size_t nValueCount, int flags = kPropertyFlagArrayByReference );
413425
414426 // /
415427 // / Sets the value of this Property to an array of float values.
416428 // / This will be an array float property of 'nValueCount' values.
417429 // / @param pValues The array with the values.
418430 // / @param nValueCount How many values the array has.
431+ // / @param flags Set of flags for the property; by default, it makes the array a reference to the given memory
419432 // /
420- Property& SetArrayFloat (const float * pValues, size_t nValueCount);
433+ Property& SetArrayFloat (const float * pValues, size_t nValueCount, int flags = kPropertyFlagArrayByReference );
421434
422435 // /
423436 // / Sets the value of this Property to an array of ResourceKey values.
424437 // / This will be an array key property of 'nValueCount' values.
425438 // / @param pValues The array with the values.
426439 // / @param nValueCount How many values the array has.
440+ // / @param flags Set of flags for the property; by default, it makes the array a reference to the given memory
427441 // /
428- Property& SetArrayKey (const ResourceKey* pValues, size_t nValueCount);
442+ Property& SetArrayKey (const ResourceKey* pValues, size_t nValueCount, int flags = kPropertyFlagArrayByReference );
429443
430444 // /
431445 // / Sets the value of this Property to the an array of eastl::string8 values.
432446 // / This will be an array eastl::string8 property of 'nValueCount' values.
433447 // / @param pValues The array with the values.
434448 // / @param nValueCount How many values the array has.
449+ // / @param flags Set of flags for the property; by default, it makes the array a reference to the given memory
435450 // /
436- Property& SetArrayString8 (const eastl::string8* pValues, size_t nValueCount);
451+ Property& SetArrayString8 (const eastl::string8* pValues, size_t nValueCount, int flags = kPropertyFlagArrayByReference );
437452
438453 // /
439454 // / Sets the value of this Property to an array of eastl::string16 values.
440455 // / This will be an array eastl::string16 property of 'nValueCount' values.
441456 // / @param pValues The array with the values.
442457 // / @param nValueCount How many values the array has.
458+ // / @param flags Set of flags for the property; by default, it makes the array a reference to the given memory
443459 // /
444- Property& SetArrayString16 (const eastl::string16* pValues, size_t nValueCount);
460+ Property& SetArrayString16 (const eastl::string16* pValues, size_t nValueCount, int flags = kPropertyFlagArrayByReference );
445461
446462 // /
447463 // / Sets the value of this Property to an array of BoundingBox values.
448464 // / This will be an array bbox property of 'nValueCount' values.
449465 // / @param pValues The array with the values.
450466 // / @param nValueCount How many values the array has.
467+ // / @param flags Set of flags for the property; by default, it makes the array a reference to the given memory
451468 // /
452- Property& SetArrayBBox (const BoundingBox* pValues, size_t nValueCount);
469+ Property& SetArrayBBox (const BoundingBox* pValues, size_t nValueCount, int flags = kPropertyFlagArrayByReference );
453470
454471 // /
455472 // / Sets the value of this Property to an array of Transform values.
456473 // / This will be an array transform property of 'nValueCount' values.
457474 // / @param pValues The array with the values.
458475 // / @param nValueCount How many values the array has.
476+ // / @param flags Set of flags for the property; by default, it makes the array a reference to the given memory
459477 // /
460- Property& SetArrayTransform (const Transform* pValues, size_t nValueCount);
478+ Property& SetArrayTransform (const Transform* pValues, size_t nValueCount, int flags = kPropertyFlagArrayByReference );
461479
462480 // /
463481 // / Sets the value of this Property to an array of LocalizedString values.
464482 // / This will be an array text property of 'nValueCount' values.
465483 // / @param pValues The array with the values.
466484 // / @param nValueCount How many values the array has.
485+ // / @param flags Set of flags for the property; by default, it makes the array a reference to the given memory
467486 // /
468- Property& SetArrayText (const LocalizedString* pValues, size_t nValueCount);
487+ Property& SetArrayText (const LocalizedString* pValues, size_t nValueCount, int flags = kPropertyFlagArrayByReference );
469488
470489 // /
471490 // / Sets the value of this Property to an array of Math::Vector2 values.
472491 // / This will be an array vector2 property of 'nValueCount' values.
473492 // / @param pValues The array with the values.
474493 // / @param nValueCount How many values the array has.
494+ // / @param flags Set of flags for the property; by default, it makes the array a reference to the given memory
475495 // /
476- Property& SetArrayVector2 (const Vector2* pValues, size_t nValueCount);
496+ Property& SetArrayVector2 (const Vector2* pValues, size_t nValueCount, int flags = kPropertyFlagArrayByReference );
477497
478498 // /
479499 // / Sets the value of this Property to an array of Math::Vector3 values.
480500 // / This will be an array vector3 property of 'nValueCount' values.
481501 // / @param pValues The array with the values.
482502 // / @param nValueCount How many values the array has.
503+ // / @param flags Set of flags for the property; by default, it makes the array a reference to the given memory
483504 // /
484- Property& SetArrayVector3 (const Vector3* pValues, size_t nValueCount);
505+ Property& SetArrayVector3 (const Vector3* pValues, size_t nValueCount, int flags = kPropertyFlagArrayByReference );
485506
486507 // /
487508 // / Sets the value of this Property to an array of Math::Vector4 values.
488509 // / This will be an array vector4 property of 'nValueCount' values.
489510 // / @param pValues The array with the values.
490511 // / @param nValueCount How many values the array has.
512+ // / @param flags Set of flags for the property; by default, it makes the array a reference to the given memory
491513 // /
492- Property& SetArrayVector4 (const Vector4* pValues, size_t nValueCount);
514+ Property& SetArrayVector4 (const Vector4* pValues, size_t nValueCount, int flags = kPropertyFlagArrayByReference );
493515
494516 // /
495517 // / Sets the value of this Property to an array of Math::ColorRGB values.
496518 // / This will be an array colorRGB property of 'nValueCount' values.
497519 // / @param pValues The array with the values.
498520 // / @param nValueCount How many values the array has.
521+ // / @param flags Set of flags for the property; by default, it makes the array a reference to the given memory
499522 // /
500- Property& SetArrayColorRGB (const ColorRGB* pValues, size_t nValueCount);
523+ Property& SetArrayColorRGB (const ColorRGB* pValues, size_t nValueCount, int flags = kPropertyFlagArrayByReference );
501524
502525 // /
503526 // / Sets the value of this Property to an array of Math::ColorRGBA values.
504527 // / This will be an array colorRGBA property of 'nValueCount' values.
505528 // / @param pValues The array with the values.
506529 // / @param nValueCount How many values the array has.
530+ // / @param flags Set of flags for the property; by default, it makes the array a reference to the given memory
507531 // /
508- Property& SetArrayColorRGBA (const ColorRGBA* pValues, size_t nValueCount);
532+ Property& SetArrayColorRGBA (const ColorRGBA* pValues, size_t nValueCount, int flags = kPropertyFlagArrayByReference );
509533
510534 // /@}
511535
@@ -1179,64 +1203,64 @@ namespace App
11791203 // TODO Bounding boxes?
11801204
11811205
1182- inline Property& Property::SetArrayBool (const bool * pValues, size_t nValueCount) {
1183- Set (PropertyType::Bool, kPropertyFlagArray , (void *) pValues, sizeof (bool ), nValueCount);
1206+ inline Property& Property::SetArrayBool (const bool * pValues, size_t nValueCount, int flags ) {
1207+ Set (PropertyType::Bool, flags , (void *) pValues, sizeof (bool ), nValueCount);
11841208 return *this ;
11851209 }
1186- inline Property& Property::SetArrayInt32 (const int32_t * pValues, size_t nValueCount) {
1187- Set (PropertyType::Int32, kPropertyFlagArray , (void *)pValues, sizeof (int32_t ), nValueCount);
1210+ inline Property& Property::SetArrayInt32 (const int32_t * pValues, size_t nValueCount, int flags ) {
1211+ Set (PropertyType::Int32, flags , (void *)pValues, sizeof (int32_t ), nValueCount);
11881212 return *this ;
11891213 }
1190- inline Property& Property::SetArrayUInt32 (const uint32_t * pValues, size_t nValueCount) {
1191- Set (PropertyType::UInt32, kPropertyFlagArray , (void *)pValues, sizeof (uint32_t ), nValueCount);
1214+ inline Property& Property::SetArrayUInt32 (const uint32_t * pValues, size_t nValueCount, int flags ) {
1215+ Set (PropertyType::UInt32, flags , (void *)pValues, sizeof (uint32_t ), nValueCount);
11921216 return *this ;
11931217 }
1194- inline Property& Property::SetArrayFloat (const float * pValues, size_t nValueCount) {
1195- Set (PropertyType::Float, kPropertyFlagArray , (void *)pValues, sizeof (float ), nValueCount);
1218+ inline Property& Property::SetArrayFloat (const float * pValues, size_t nValueCount, int flags ) {
1219+ Set (PropertyType::Float, flags , (void *)pValues, sizeof (float ), nValueCount);
11961220 return *this ;
11971221 }
1198- inline Property& Property::SetArrayKey (const ResourceKey* pValues, size_t nValueCount) {
1199- Set (PropertyType::Key, kPropertyFlagArray , (void *)pValues, sizeof (ResourceKey), nValueCount);
1222+ inline Property& Property::SetArrayKey (const ResourceKey* pValues, size_t nValueCount, int flags ) {
1223+ Set (PropertyType::Key, flags , (void *)pValues, sizeof (ResourceKey), nValueCount);
12001224 return *this ;
12011225 }
1202- inline Property& Property::SetArrayString8 (const eastl::string8* pValues, size_t nValueCount) {
1203- Set (PropertyType::String8, kPropertyFlagArray , (void *)pValues, sizeof (eastl::string8), nValueCount);
1226+ inline Property& Property::SetArrayString8 (const eastl::string8* pValues, size_t nValueCount, int flags ) {
1227+ Set (PropertyType::String8, flags , (void *)pValues, sizeof (eastl::string8), nValueCount);
12041228 return *this ;
12051229 }
1206- inline Property& Property::SetArrayString16 (const eastl::string16* pValues, size_t nValueCount) {
1207- Set (PropertyType::String16, kPropertyFlagArray , (void *)pValues, sizeof (eastl::string16), nValueCount);
1230+ inline Property& Property::SetArrayString16 (const eastl::string16* pValues, size_t nValueCount, int flags ) {
1231+ Set (PropertyType::String16, flags , (void *)pValues, sizeof (eastl::string16), nValueCount);
12081232 return *this ;
12091233 }
1210- inline Property& Property::SetArrayBBox (const BoundingBox* pValues, size_t nValueCount) {
1211- Set (PropertyType::BBox, kPropertyFlagArray , (void *)pValues, sizeof (BoundingBox), nValueCount);
1234+ inline Property& Property::SetArrayBBox (const BoundingBox* pValues, size_t nValueCount, int flags ) {
1235+ Set (PropertyType::BBox, flags , (void *)pValues, sizeof (BoundingBox), nValueCount);
12121236 return *this ;
12131237 }
1214- inline Property& Property::SetArrayTransform (const Transform* pValues, size_t nValueCount) {
1215- Set (PropertyType::Transform, kPropertyFlagArray , (void *)pValues, sizeof (Transform), nValueCount);
1238+ inline Property& Property::SetArrayTransform (const Transform* pValues, size_t nValueCount, int flags ) {
1239+ Set (PropertyType::Transform, flags , (void *)pValues, sizeof (Transform), nValueCount);
12161240 return *this ;
12171241 }
1218- inline Property& Property::SetArrayText (const LocalizedString* pValues, size_t nValueCount) {
1219- Set (PropertyType::Text, kPropertyFlagArray , (void *)pValues, sizeof (LocalizedString), nValueCount);
1242+ inline Property& Property::SetArrayText (const LocalizedString* pValues, size_t nValueCount, int flags ) {
1243+ Set (PropertyType::Text, flags , (void *)pValues, sizeof (LocalizedString), nValueCount);
12201244 return *this ;
12211245 }
1222- inline Property& Property::SetArrayVector2 (const Vector2* pValues, size_t nValueCount) {
1223- Set (PropertyType::Vector2, kPropertyFlagArray , (void *)pValues, sizeof (Vector2), nValueCount);
1246+ inline Property& Property::SetArrayVector2 (const Vector2* pValues, size_t nValueCount, int flags ) {
1247+ Set (PropertyType::Vector2, flags , (void *)pValues, sizeof (Vector2), nValueCount);
12241248 return *this ;
12251249 }
1226- inline Property& Property::SetArrayVector3 (const Vector3* pValues, size_t nValueCount) {
1227- Set (PropertyType::Vector3, kPropertyFlagArray , (void *)pValues, sizeof (Vector3), nValueCount);
1250+ inline Property& Property::SetArrayVector3 (const Vector3* pValues, size_t nValueCount, int flags ) {
1251+ Set (PropertyType::Vector3, flags , (void *)pValues, sizeof (Vector3), nValueCount);
12281252 return *this ;
12291253 }
1230- inline Property& Property::SetArrayVector4 (const Vector4* pValues, size_t nValueCount) {
1231- Set (PropertyType::Vector4, kPropertyFlagArray , (void *)pValues, sizeof (Vector4), nValueCount);
1254+ inline Property& Property::SetArrayVector4 (const Vector4* pValues, size_t nValueCount, int flags ) {
1255+ Set (PropertyType::Vector4, flags , (void *)pValues, sizeof (Vector4), nValueCount);
12321256 return *this ;
12331257 }
1234- inline Property& Property::SetArrayColorRGB (const ColorRGB* pValues, size_t nValueCount) {
1235- Set (PropertyType::ColorRGB, kPropertyFlagArray , (void *)pValues, sizeof (ColorRGB), nValueCount);
1258+ inline Property& Property::SetArrayColorRGB (const ColorRGB* pValues, size_t nValueCount, int flags ) {
1259+ Set (PropertyType::ColorRGB, flags , (void *)pValues, sizeof (ColorRGB), nValueCount);
12361260 return *this ;
12371261 }
1238- inline Property& Property::SetArrayColorRGBA (const ColorRGBA* pValues, size_t nValueCount) {
1239- Set (PropertyType::ColorRGBA, kPropertyFlagArray , (void *)pValues, sizeof (ColorRGBA), nValueCount);
1262+ inline Property& Property::SetArrayColorRGBA (const ColorRGBA* pValues, size_t nValueCount, int flags ) {
1263+ Set (PropertyType::ColorRGBA, flags , (void *)pValues, sizeof (ColorRGBA), nValueCount);
12401264 return *this ;
12411265 }
12421266
0 commit comments