A property is a variable that can be created and retrieved by name at runtime.
More...
All properties are part of a property group (Properties). A property group can be created with the Properties.Create function and destroyed with the Properties.Destroy function, but the Properties destructor probably will do what you want to, automatically.
Properties can be added to and retrieved from a property group through the following functions:
Properties can be removed from a group by using PropertiesRef.Clear.
◆ CleanupPropertyCallback
This should release any resources associated with value
that are no longer needed.
This callback is set per-property. Different properties in the same group can have different cleanup callbacks.
This callback will be called during PropertiesRef.SetPointerWithCleanup if the function fails for any reason.
- Parameters
-
userdata | an app-defined pointer passed to the callback. |
value | the pointer assigned to the property to clean up. |
- Thread safety:
- This callback may fire without any locks held; if this is a concern, the app should provide its own locking.
- Since
- This datatype is available since SDL 3.2.0.
- See also
- PropertiesRef.SetPointerWithCleanup
◆ CleanupPropertyCB
This should release any resources associated with value
that are no longer needed.
This callback is set per-property. Different properties in the same group can have different cleanup callbacks.
This callback will be called during PropertiesRef.SetPointerWithCleanup if the function fails for any reason.
- Parameters
-
value | the pointer assigned to the property to clean up. |
- Thread safety:
- This callback may fire without any locks held; if this is a concern, the app should provide its own locking.
- Since
- This datatype is available since SDL 3.2.0.
- See also
- PropertiesRef.SetPointerWithCleanup
-
CleanupPropertyCallback
-
result-callback
- Category:
- Result callback
◆ EnumeratePropertiesCallback
This callback is called from PropertiesRef.Enumerate(), and is called once per property in the set.
- Parameters
-
userdata | an app-defined pointer passed to the callback. |
props | the Properties that is being enumerated. |
name | the next property name in the enumeration. |
- Thread safety:
- PropertiesRef.Enumerate holds a lock on
props
during this callback.
- Since
- This datatype is available since SDL 3.2.0.
- See also
- PropertiesRef.Enumerate
◆ EnumeratePropertiesCB
◆ PropertiesShared
◆ PropertiesWeak
◆ PropertyType
- Since
- This enum is available since SDL 3.2.0.
◆ GetGlobalProperties()
- Returns
- a valid property ID on success.
- Exceptions
-
- Since
- This function is available since SDL 3.2.0.
◆ Lock()
Obtain a multi-threaded lock for these properties. Other threads will wait while trying to lock these properties until they are unlocked. Properties must be unlocked before they are destroyed.
The lock is automatically taken when setting individual properties, this function is only needed when you want to set several properties atomically or want to guarantee that properties being queried aren't freed in another thread.
- Returns
- PropertiesLock on success.
- Exceptions
-
- Thread safety:
- It is safe to call this function from any thread.
- Since
- This function is available since SDL 3.2.0.
- See also
- PropertiesLock.Unlock
◆ PROPERTY_TYPE_BOOLEAN
Initial value:=
SDL_PROPERTY_TYPE_BOOLEAN
◆ PROPERTY_TYPE_INVALID
Initial value:=
SDL_PROPERTY_TYPE_INVALID
◆ PROPERTY_TYPE_NUMBER
Initial value:=
SDL_PROPERTY_TYPE_NUMBER
◆ PROPERTY_TYPE_POINTER
Initial value:=
SDL_PROPERTY_TYPE_POINTER
◆ PROPERTY_TYPE_STRING
Initial value:=
SDL_PROPERTY_TYPE_STRING