App::DirectPropertyList class

A special kind of PropertyList that allows to have fast-access bool/int/float properties, apart from normal properties.

Base classes

class PropertyList
A class that contains multiple properties.

Constructors, destructors, conversion operators

DirectPropertyList(size_t nFastAccessCount)
~DirectPropertyList()

Public functions

auto GetDirectBool(uint32_t propertyID) -> bool
Gets a fast-acesss bool property from this DirectPropertyList.
auto GetDirectInt(uint32_t propertyID) -> int
Gets a fast-acesss int property from this DirectPropertyList.
auto GetDirectFloat(uint32_t propertyID) -> float
Gets a fast-acesss float property from this DirectPropertyList.
auto SetBool(uint32_t propertyID, bool value) -> void
Assigns the given bool value to the specified propertyID.
auto SetInt(uint32_t propertyID, int value) -> void
Assigns the given int value to the specified propertyID.
auto SetFloat(uint32_t propertyID, float value) -> void
Assigns the given float value to the specified propertyID.
auto SetProperty(uint32_t propertyID, const Property* pValue) -> void override
Sets the value of the property with the given ID to the specified value.
auto RemoveProperty(uint32_t propertyID) -> int override
Removes this propertyID and its value from the list.
auto HasProperty(uint32_t propertyID) const -> bool override
Tells whether a property with this propertyID is contained inside this list, or inside any of its parents.
auto GetPropertyAlt(uint32_t propertyID, Property*& result) const -> bool override
This does the same as GetProperty(uint32_t, Property*&).
auto GetProperty(uint32_t propertyID, Property*& result) const -> bool override
Gets the pointer to a Property with the given propertyID and assigns it to the parameter 'result'.
auto GetPropertyObject(uint32_t propertyID) const -> Property* override
Gets the pointer to a Property with the given propertyID.
auto CopyFrom(const PropertyList* pOther) -> void override
Copies the properties and parent from pOther.
auto AddPropertiesFrom(const PropertyList* pOther) -> void override
Copies all the properties from pOther to this property list.
auto CopyAllPropertiesFrom(const PropertyList* pOther) -> void override
Copies all the properties from pOther.
auto AddAllPropertiesFrom(const PropertyList* pOther) -> void override
Similar to void CopyPropertiesFrom(PropertyList* pOther), but this copies all the properties from pOther parents as well.
auto Read(IO::IStream* pInputStream) -> bool override
Fills this PropertyList with the information contained in the given IO::IStream, according to the PROP file format.
auto Write(IO::IStream* pOutputStream) const -> bool override
Writes this PropertyList into the given IO::IStream, according to the PROP file format.
auto GetPropertyIDs(eastl::vector<uint32_t>& dst) const -> void override
Fills the given vector with all the property IDs contained in this PropertyList.
auto Clear() -> void override
Removes all the properties from this PropertyList.

Public variables

size_t mnFastAccessCount
DirectValue* mpValues

Protected types

union DirectValue

Protected variables

Property mTemporaryProperty

Function documentation

bool App::DirectPropertyList::GetDirectBool(uint32_t propertyID)

Gets a fast-acesss bool property from this DirectPropertyList.

You MUST only use this for fast-access properties (those specified in SPPropertyIDs); trying to get other properties using this method will result in undefined behaviour. To get non-fast-access properties from this list, use the static methods provided in the Property class.

int App::DirectPropertyList::GetDirectInt(uint32_t propertyID)

Gets a fast-acesss int property from this DirectPropertyList.

You MUST only use this for fast-access properties (those specified in SPPropertyIDs); trying to get other properties using this method will result in undefined behaviour. To get non-fast-access properties from this list, use the static methods provided in the Property class.

float App::DirectPropertyList::GetDirectFloat(uint32_t propertyID)

Gets a fast-acesss float property from this DirectPropertyList.

You MUST only use this for fast-access properties (those specified in SPPropertyIDs); trying to get other properties using this method will result in undefined behaviour. To get non-fast-access properties from this list, use the static methods provided in the Property class.

void App::DirectPropertyList::SetBool(uint32_t propertyID, bool value)

Assigns the given bool value to the specified propertyID.

The property will be stored as fast-access if propertyID is contained in SPPropertyIDs.

void App::DirectPropertyList::SetInt(uint32_t propertyID, int value)

Assigns the given int value to the specified propertyID.

The property will be stored as fast-access if propertyID is contained in SPPropertyIDs.

void App::DirectPropertyList::SetFloat(uint32_t propertyID, float value)

Assigns the given float value to the specified propertyID.

The property will be stored as fast-access if propertyID is contained in SPPropertyIDs.

void App::DirectPropertyList::SetProperty(uint32_t propertyID, const Property* pValue) override

Sets the value of the property with the given ID to the specified value.

Parameters
propertyID The ID of the property to add.
pValue The value of the property, stored inside a Property object of the appropiate type.

If no property with that ID exists in this list, a new one will be created and added to the list. This does not affect the parent PropertyList; this way you are ensured that the value modified will only affect the current list.

int App::DirectPropertyList::RemoveProperty(uint32_t propertyID) override

Removes this propertyID and its value from the list.

Parameters
propertyID The ID of the property to remove.
Returns true if the property was removed, false if it did not exist.

This does not affect the parent PropertyList.

bool App::DirectPropertyList::HasProperty(uint32_t propertyID) const override

Tells whether a property with this propertyID is contained inside this list, or inside any of its parents.

Parameters
propertyID The ID of the property to check whether it exists.

This function will be called recursively on the PropertyList's parents until the property is found (which returns true) or no parents are left to check (which returns false).

bool App::DirectPropertyList::GetPropertyAlt(uint32_t propertyID, Property*& result) const override

This does the same as GetProperty(uint32_t, Property*&).

It is rarely used.

bool App::DirectPropertyList::GetProperty(uint32_t propertyID, Property*& result) const override

Gets the pointer to a Property with the given propertyID and assigns it to the parameter 'result'.

Parameters
propertyID The ID of the property to find.
result out The destination that will be assigned with the pointer to the found property (if any).
Returns true if the property was found, false otherwise.

If no property with that ID is found, the function will return false and 'result' will remain unmodified. This function will be called recursively on the PropertyList's parents until the property is found (which returns true) or no parents are left to check (which returns false).

Property* App::DirectPropertyList::GetPropertyObject(uint32_t propertyID) const override

Gets the pointer to a Property with the given propertyID.

Parameters
propertyID The ID of the property to get.

This always returns a value: either the found property, or a default property object. However, using this method is not recommended, since there is no way to know if the returned property is the default one or not. Therefore, this method should only be used in cases where the value of the property does not really matter. This function will be called recursively on the PropertyList's parents until the property is found (which returns true) or no parents are left to check (which returns false).

void App::DirectPropertyList::CopyFrom(const PropertyList* pOther) override

Copies the properties and parent from pOther.

Parameters
pOther The PropertyList whose properties will be copied.

After calling this method, this object will be identical to pOther (except for the ResourceKey name); that is, it will have the same properties and the same parent.

void App::DirectPropertyList::AddPropertiesFrom(const PropertyList* pOther) override

Copies all the properties from pOther to this property list.

Parameters
pOther The PropertyList whose properties will be copied.

The existing properties will not be deleted; their values might get overrided if they are contained in pOther, however.

void App::DirectPropertyList::CopyAllPropertiesFrom(const PropertyList* pOther) override

Copies all the properties from pOther.

Parameters
pOther The PropertyList whose properties will be copied.

The existing properties will be removed. The properties will be copied recursively from every pOther parent, so you will end up with a similar result to void AddAllPropertiesFrom(PropertyList* pOther); the difference is that the existing properties will be removed. This PropertyList's parent will be set to null; this way is ensured that this object will end up having only the same properties as pOther and its parents.

void App::DirectPropertyList::AddAllPropertiesFrom(const PropertyList* pOther) override

Similar to void CopyPropertiesFrom(PropertyList* pOther), but this copies all the properties from pOther parents as well.

Parameters
pOther The PropertyList whose properties will be copied.

This method will be called recursively on pOther's parents until no parents are left, and then the properties from pOther will be copied. This ensure that pOther properties have priority over their parents'.

bool App::DirectPropertyList::Read(IO::IStream* pInputStream) override

Fills this PropertyList with the information contained in the given IO::IStream, according to the PROP file format.

Parameters
pInputStream The IStream where the data will be read from.
Returns true if everything could be successfully read, false otherwise.

If there's any error while reading the file, the operation will be interrupted, and no more properties will be read.

bool App::DirectPropertyList::Write(IO::IStream* pOutputStream) const override

Writes this PropertyList into the given IO::IStream, according to the PROP file format.

Parameters
pOutputStream The IStream where the data will be written.
Returns true if everything could be successfully written, false otherwise.

If there's any error while writing the file, the operation will be interrupted, and no more properties will be written.

void App::DirectPropertyList::GetPropertyIDs(eastl::vector<uint32_t>& dst) const override

Fills the given vector with all the property IDs contained in this PropertyList.

Parameters
dst out A uint32_t vector where the IDs will be put.

This does not include the properties contained in the parent.