VR-Forces 4.10 Class Documentation
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Groups Pages
Functions
propertyUtils.h File Reference

Go to the source code of this file.

Functions

template<typename RwType >
RwType * findVariableBindingWithDefault (DtRwVariableBindings &variableBindings, DtRwVariableBindings &defaultBindings, const DtString &variableName)
 Finds a RW corresponding to the given variable name, as with the above functions, but also looks in the default variable bindings for a value if none is found in this binding. More...
 
template<typename T >
boost::optional< T > getPropertyValue (const DtReaderWriter *prop)
 Extracts the value from the given ReaderWriter property. More...
 
template<typename T >
boost::optional< T > findPropertyValue (const DtReaderWriter &properties, const DtString &propertyName)
 Finds the ReaderWriter object in the given set of properties with the specified name and returns its value. More...
 
template<typename T >
void setPropertyValue (DtReaderWriter *prop, T val)
 Sets the value of the given ReaderWriter property. More...
 
template<typename T >
bool findAndSetPropertyValue (DtReaderWriter &properties, const DtString &propertyName, T val)
 Finds the ReaderWriter object in the given set of properties with the specified name and sets its value. More...
 
template<typename K , typename T >
void setMapProperty (DtReaderWriter *prop, const std::map< K, T > &l)
 Sets the values of the given map ReaderWriter property. More...
 
template<typename K , typename T >
bool findAndSetMapProperty (DtReaderWriter &properties, const DtString &propertyName, const std::map< K, T > &m)
 Finds the ReaderWriter object in the given set of properties with the specified name, checks that it is a map with keys of type K and elements of type T, and sets it. More...
 
template<typename T >
boost::optional< T > findVariableBindingValue (const DtReaderWriter &properties, const DtString &propertyName)
 Same as findPropertyValue but assumes variable bindings. More...
 
template<typename T >
boost::optional< T > findVariableBindingValue (const DtReaderWriter &properties, const DtReaderWriter &defaultProperties, const DtString &propertyName)
 Like findPropertyValue, except for variable bindings. More...
 
const DtReaderWriterfindPropertyRw (const DtReaderWriter &properties, const DtString &propertyName)
 Contains utility functions to make it easier to find and extract data from a set of extended properties. More...
 
DtReaderWriterfindPropertyRw (DtReaderWriter &properties, const DtString &propertyName)
 
const DtReaderWriterfindVariableBindingValueRw (const DtReaderWriter &properties, const DtString &propertyName)
 Same as findPropertyRw but for variable bindings. More...
 
DtReaderWriterfindVariableBindingValueRw (DtReaderWriter &properties, const DtString &propertyName)
 
template<typename SpecificRwType >
const SpecificRwType * findProperty (const DtReaderWriter &properties, const DtString &propertyName)
 Finds the ReaderWriter object in the given set of properties with the specified name. More...
 
template<typename SpecificRwType >
SpecificRwType * findProperty (DtReaderWriter &properties, const DtString &propertyName)
 
template<typename SpecificRwType >
const SpecificRwType * findTypedProperty (const DtReaderWriter &properties, const DtString &propertyName)
 Same as findProperty() but with a specific name to avoid name conflicts in some use cases. More...
 
template<typename SpecificRwType >
SpecificRwType * findTypedProperty (DtReaderWriter &properties, const DtString &propertyName)
 
template<typename SpecificRwType >
SpecificRwType * addProperty (DtReaderWriter &properties, const DtString &propertyName)
 Adds a property with the specified name to the given set of properties. More...
 
void addProperty (DtReaderWriter &properties, DtRwProperties *property)
 Adds an existing property to the properties container. More...
 
template<typename T >
void setListProperty (DtReaderWriter *prop, const std::list< T > &l)
 Sets the values of the given list ReaderWriter property. More...
 
template<typename T >
void setListProperty (DtReaderWriter *prop, const std::vector< T > &l)
 
template<typename T >
bool findAndSetListProperty (DtReaderWriter &properties, const DtString &propertyName, const std::list< T > &l)
 Finds the ReaderWriter object in the given set of properties with the specified name, checks that it is a list with elements of type T, and sets it. More...
 
template<typename T >
bool findAndSetListProperty (DtReaderWriter &properties, const DtString &propertyName, const std::vector< T > &l)
 
const DtReaderWriterfindMapItemRw (const DtRwPropertiesMap &propertiesMap, const DtString &itemName)
 Finds the generic ReaderWriter object in the given DtRwPropertiesMap that matches the specified name. More...
 
DtReaderWriterfindMapItemRw (DtRwPropertiesMap &propertiesMap, const DtString &itemName)
 
template<typename SpecificRwType >
const SpecificRwType * findMapItem (const DtRwPropertiesMap &propertiesMap, const DtString &itemName)
 Finds the ReaderWriter object in the given DtRwPropertiesMap that matches the specified name. More...
 
template<typename SpecificRwType >
SpecificRwType * findMapItem (DtRwPropertiesMap &propertiesMap, const DtString &itemName)
 

Function Documentation

const DtReaderWriter* findPropertyRw ( const DtReaderWriter properties,
const DtString propertyName 
)
inline

Contains utility functions to make it easier to find and extract data from a set of extended properties.

These functions are deprecated. It is recommended that developers use the functions within DtPropertyInterface and its subclasses instead. Finds the generic ReaderWriter object in the given set of properties with the specified name.

DtReaderWriter* findPropertyRw ( DtReaderWriter properties,
const DtString propertyName 
)
inline
const DtReaderWriter* findVariableBindingValueRw ( const DtReaderWriter properties,
const DtString propertyName 
)
inline

Same as findPropertyRw but for variable bindings.

DtReaderWriter* findVariableBindingValueRw ( DtReaderWriter properties,
const DtString propertyName 
)
inline
template<typename RwType >
RwType* findVariableBindingWithDefault ( DtRwVariableBindings variableBindings,
DtRwVariableBindings defaultBindings,
const DtString variableName 
)

Finds a RW corresponding to the given variable name, as with the above functions, but also looks in the default variable bindings for a value if none is found in this binding.

Returns null if nothing is found in either place.

template<typename SpecificRwType >
const SpecificRwType* findProperty ( const DtReaderWriter properties,
const DtString propertyName 
)

Finds the ReaderWriter object in the given set of properties with the specified name.

Then verifies that the ReaderWriter matches the type specified as the template argument. Returns a valid pointer if successful.

template<typename SpecificRwType >
SpecificRwType* findProperty ( DtReaderWriter properties,
const DtString propertyName 
)
template<typename SpecificRwType >
const SpecificRwType* findTypedProperty ( const DtReaderWriter properties,
const DtString propertyName 
)

Same as findProperty() but with a specific name to avoid name conflicts in some use cases.

template<typename SpecificRwType >
SpecificRwType* findTypedProperty ( DtReaderWriter properties,
const DtString propertyName 
)
template<typename SpecificRwType >
SpecificRwType* addProperty ( DtReaderWriter properties,
const DtString propertyName 
)

Adds a property with the specified name to the given set of properties.

SpecificRwType must be a subclass of DtPropertyInterface and DtReaderWriter. Returns a pointer to the new item. Returns a null pointer if a property with that name already existed.

Referenced by makVrf::DtSetStatePropertyDialog::setupGui().

void addProperty ( DtReaderWriter properties,
DtRwProperties property 
)
inline

Adds an existing property to the properties container.

The container will take ownership of the given property

template<typename T >
boost::optional<T> getPropertyValue ( const DtReaderWriter prop)

Extracts the value from the given ReaderWriter property.

The template parameter type must be an appropriate storage type for the property value. Cannot be used for ReaderWriter properties of complex types (structures, lists, and maps). Returns a boost::optional object, which can be dereferenced like a pointer to get the value. If a value could not be retrieved for any reason, the return value will be uninitialized, which can be checked (using the capabilities of boost::optional) like so: boost::optional<someType> r = getPropertyValue(prop); if(r) cout << "Value returned!"; else cout << "No value returned!";

template<typename T >
boost::optional<T> findPropertyValue ( const DtReaderWriter properties,
const DtString propertyName 
)

Finds the ReaderWriter object in the given set of properties with the specified name and returns its value.

This effectively a convenience function for calling findPropertyRw() and getPropertyValue().

template<typename T >
void setPropertyValue ( DtReaderWriter prop,
val 
)

Sets the value of the given ReaderWriter property.

The template parameter type must be an appropriate storage type for the property value. Cannot be used for ReaderWriter properties of complex types (structures, lists, and maps).

template<typename T >
bool findAndSetPropertyValue ( DtReaderWriter properties,
const DtString propertyName,
val 
)

Finds the ReaderWriter object in the given set of properties with the specified name and sets its value.

This effectively a convenience function for calling findPropertyRw() and setPropertyValue(). Only works with simple data types (i.e. numerical values, bools, strings). Returns false if no property with that name can be found.

template<typename T >
void setListProperty ( DtReaderWriter prop,
const std::list< T > &  l 
)

Sets the values of the given list ReaderWriter property.

template<typename T >
void setListProperty ( DtReaderWriter prop,
const std::vector< T > &  l 
)
template<typename T >
bool findAndSetListProperty ( DtReaderWriter properties,
const DtString propertyName,
const std::list< T > &  l 
)

Finds the ReaderWriter object in the given set of properties with the specified name, checks that it is a list with elements of type T, and sets it.

This effectively a convenience function for calling findPropertyRw() and setting each item in the list. Only works with lists of simple data types (i.e. numerical values, bools, strings). Returns false if no property with that name can be found.

template<typename T >
bool findAndSetListProperty ( DtReaderWriter properties,
const DtString propertyName,
const std::vector< T > &  l 
)
template<typename K , typename T >
void setMapProperty ( DtReaderWriter prop,
const std::map< K, T > &  l 
)

Sets the values of the given map ReaderWriter property.

template<typename K , typename T >
bool findAndSetMapProperty ( DtReaderWriter properties,
const DtString propertyName,
const std::map< K, T > &  m 
)

Finds the ReaderWriter object in the given set of properties with the specified name, checks that it is a map with keys of type K and elements of type T, and sets it.

This effectively a convenience function for calling findPropertyRw() and setting each item in the map. Only works with lists of simple data types (i.e. numerical values, bools, strings). Returns false if no property with that name can be found.

template<typename T >
boost::optional<T> findVariableBindingValue ( const DtReaderWriter properties,
const DtString propertyName 
)

Same as findPropertyValue but assumes variable bindings.

template<typename T >
boost::optional<T> findVariableBindingValue ( const DtReaderWriter properties,
const DtReaderWriter defaultProperties,
const DtString propertyName 
)

Like findPropertyValue, except for variable bindings.

const DtReaderWriter* findMapItemRw ( const DtRwPropertiesMap propertiesMap,
const DtString itemName 
)
inline

Finds the generic ReaderWriter object in the given DtRwPropertiesMap that matches the specified name.

DtReaderWriter* findMapItemRw ( DtRwPropertiesMap propertiesMap,
const DtString itemName 
)
inline
template<typename SpecificRwType >
const SpecificRwType* findMapItem ( const DtRwPropertiesMap propertiesMap,
const DtString itemName 
)

Finds the ReaderWriter object in the given DtRwPropertiesMap that matches the specified name.

Then verifies that the ReaderWriter matches the type specified as the template argument. Returns a valid pointer if successful.

template<typename SpecificRwType >
SpecificRwType* findMapItem ( DtRwPropertiesMap propertiesMap,
const DtString itemName 
)

Document ID: Generated on Tue Sep 21 17:42:52 EDT 2021 from SVN revision 234861
Copyright © 2005-2021 MAK Technologies. All Rights Reserved (www.mak.com)