A property is a variable that can be created and retrieved by name at runtime.
More...
All properties are part of a property group (PropertiesBase). A property group can be created with the CreateProperties() function or by simply instantiating Properties. It can be destroyed with the PropertiesRef.reset(), 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 PropertiesBase.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 PropertiesBase.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
- PropertiesBase.SetPointerWithCleanup
◆ CleanupPropertyCB
◆ EnumeratePropertiesCallback
◆ EnumeratePropertiesCB
◆ PropertyType
- Since
- This enum is available since SDL 3.2.0.
◆ CreateProperties()
All properties are automatically destroyed when Quit() is called.
- Returns
- a valid Properties for a new group of properties, or false on failure; call GetError() for more information.
- Thread safety:
- It is safe to call this function from any thread.
- Since
- This function is available since SDL 3.2.0.
- See also
- Properties
◆ 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