Skip to content

TSdlProperties

A group of SDL properties.

Definition

Unit: Neslib.Sdl3.Basics

type TSdlProperties = record ... end;

Properties

Name Description
AsBoolean Boolean property values.
AsFloat Floating-point property values.
AsNumber Integer property values.
AsPointer Pointer property values.
AsString String property values.
Global The global SDL properties.

Operators

Name Description
Equal(TSdlProperties, TSdlProperties) Used to compare against another TSdlProperties.
Equal(TSdlProperties, Pointer) Used to compare against nil.
Implicit Used to set the value to nil.
NotEqual(TSdlProperties, TSdlProperties) Used to compare against another TSdlProperties.
NotEqual(TSdlProperties, Pointer) Used to compare against nil.

Methods

Name Description
Assign Copy a group of properties.
Create Create a group of properties.
Delete Delete a property from a group of properties.
Enumerate Enumerate the properties contained in this group of properties.
Free Destroy this group of properties.
GetType Get the type of a property in this group of properties.
Has Return whether a property exists in this group of properties.
Lock Lock this group of properties.
SetPointerWithCleanup Set a pointer property in this group of properties with a cleanup function that is called when the property is deleted.
Unlock Unlock this group of properties.

Property Descriptions

AsBoolean

Boolean property values.

property AsBoolean[const AName: String]: Boolean read GetAsBoolean write SetAsBoolean

Type: Boolean

Exceptions

ESdlError: Raised on failure.

Remarks

It is safe to use this property from any thread


AsFloat

Floating-point property values.

property AsFloat[const AName: String]: Single read GetAsFloat write SetAsFloat

Type: Single

Exceptions

ESdlError: Raised on failure.

Remarks

It is safe to use this property from any thread


AsNumber

Integer property values.

property AsNumber[const AName: String]: Int64 read GetAsNumber write SetAsNumber

Type: Int64

Exceptions

ESdlError: Raised on failure.

Remarks

It is safe to use this property from any thread


AsPointer

Pointer property values.

By convention, the names of properties that SDL exposes on objects will start with 'SDL.', and properties that SDL uses internally will start with 'SDL.internal.'. These should be considered read-only and should not be modified by applications.

property AsPointer[const AName: String]: Pointer read GetAsPointer write SetAsPointer

Type: Pointer

Exceptions

ESdlError: Raised on failure.

See Also

Remarks

Set the value to nil to delete the property.

It is safe to use this property from any thread, although the data returned is not protected and could potentially be freed if you set the value to nil or call Delete on these properties from another thread. If you need to avoid this, Lock and Unlock.


AsString

String property values.

property AsString[const AName: String]: String read GetAsString write SetAsString

Type: String

Exceptions

ESdlError: Raised on failure.

Remarks

Set the value to an empty string to delete the property.

It is safe to use this property from any thread, although the data returned is not protected and could potentially be freed if you set the value to an empty string or call Delete on these properties from another thread. If you need to avoid this, Lock and Unlock.


Global

The global SDL properties.

class property Global: TSdlProperties read GetGlobal

Type: TSdlProperties

Exceptions

ESdlError: Raised on failure.


Operator Descriptions

Equal(TSdlProperties, TSdlProperties)

Used to compare against another TSdlProperties.

class operator Equal(const ALeft, ARight: TSdlProperties): Boolean; inline; static

Parameters

ALeft: TSdlProperties

ARight: TSdlProperties

Returns

Boolean


Equal(TSdlProperties, Pointer)

Used to compare against nil.

class operator Equal(const ALeft: TSdlProperties; const ARight: Pointer): Boolean; inline; static

Parameters

ALeft: TSdlProperties

ARight: Pointer

Returns

Boolean


Implicit(Pointer)

Used to set the value to nil.

class operator Implicit(const AValue: Pointer): TSdlProperties; inline; static

Parameters

AValue: Pointer

Returns

TSdlProperties


NotEqual(TSdlProperties, TSdlProperties)

Used to compare against another TSdlProperties.

class operator NotEqual(const ALeft, ARight: TSdlProperties): Boolean; inline; static

Parameters

ALeft: TSdlProperties

ARight: TSdlProperties

Returns

Boolean


NotEqual(TSdlProperties, Pointer)

Used to compare against nil.

class operator NotEqual(const ALeft: TSdlProperties; const ARight: Pointer): Boolean; inline; static

Parameters

ALeft: TSdlProperties

ARight: Pointer

Returns

Boolean


Method Descriptions

Assign(TSdlProperties)

Copy a group of properties.

Copy all the properties from ASource to this group, with the exception of properties requiring cleanup (set using SetPointerWithCleanup), which will not be copied. Any property that already exists in this group will be overwritten.

procedure Assign(const ASource: TSdlProperties); inline

Exceptions

ESdlError: Raised on failure.

Parameters

ASource: TSdlProperties : The properties to copy.

Remarks

It is safe to call this function from any thread.


Create

Create a group of properties.

All properties are automatically destroyed when SdlQuit is called.

class function Create: TSdlProperties; inline; static

Exceptions

ESdlError: Raised on failure.

Returns

TSdlProperties: A new group of properties.

See Also

Remarks

It is safe to call this function from any thread.


Delete(String)

Delete a property from a group of properties.

procedure Delete(const AName: String); inline

Exceptions

ESdlError: Raised on failure.

Parameters

AName: String : The name of the property to delete.

Remarks

It is safe to call this method from any thread


Enumerate(TSdlEnumeratePropertiesCallback)

Enumerate the properties contained in this group of properties.

The callback function is called for each property in the group of properties. The properties are locked during enumeration.

procedure Enumerate(const ACallback: TSdlEnumeratePropertiesCallback)

Exceptions

ESdlError: Raised on failure.

Parameters

ACallback: TSdlEnumeratePropertiesCallback : The function to call for each property.

Remarks

It is safe to call this method from any thread


Free

Destroy this group of properties.

All properties are deleted and their cleanup functions will be called, if any.

procedure Free; inline

Remarks

This function should not be called while these properties are locked or other threads might be setting or getting values from these properties.


GetType(String)

Get the type of a property in this group of properties.

function GetType(const AName: String): TSdlPropertyType; inline

Parameters

AName: String : The name of the property to query.

Returns

TSdlPropertyType: The type of the property, or TSdlPropertyType.Invalid if it is not set.

See Also

Remarks

It is safe to call this method from any thread


Has(String)

Return whether a property exists in this group of properties.

function Has(const AName: String): Boolean; inline

Parameters

AName: String : The name of the property to query.

Returns

Boolean: True if the property exists, or False if it doesn't.

See Also

Remarks

It is safe to call this method from any thread


Lock

Lock this group of properties.

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.

procedure Lock; inline

Exceptions

ESdlError: Raised on failure.

See Also

Remarks

It is safe to call this method from any thread.


SetPointerWithCleanup(String, Pointer, TSdlPropertyCleanupCallback)

Set a pointer property in this group of properties with a cleanup function that is called when the property is deleted.

The cleanup function is also called if setting the property fails for any reason.

For simply setting basic data types, like numbers, bools, or strings, use AsNumber, AsBoolean or AsString instead, as those functions will handle cleanup on your behalf. This function is only for more complex, custom data.

procedure SetPointerWithCleanup(const AName: String; const AValue: Pointer; const ACleanup: TSdlPropertyCleanupCallback)

Exceptions

ESdlError: Raised on failure.

Parameters

AName: String : The name of the property to modify.

AValue: Pointer : The new value of the property, or nil to delete the property.

ACleanup: TSdlPropertyCleanupCallback : The function to call when this property is deleted, or nil if no cleanup is necessary.

See Also

Remarks

It is safe to call this method from any thread


Unlock

Unlock this group of properties.

procedure Unlock; inline

See Also

Remarks

It is safe to call this method from any thread