Fairport
v1.0.38
|
Property object base class. More...
#include <object.h>
Public Member Functions | |
virtual | ~const_property_object () |
virtual std::vector< prop_id > | get_prop_list () const =0 |
Get a list of all properties on this object. | |
virtual prop_type | get_prop_type (prop_id id) const =0 |
Get the property type of a given prop_id. | |
virtual bool | prop_exists (prop_id id) const =0 |
Indicates the existance of a given property on this object. | |
virtual size_t | size (prop_id id) const =0 |
Returns the total size of a variable length property. | |
template<typename T > | |
T | read_prop (prop_id id) const |
Read a property as a given type. | |
template<typename T > | |
std::vector< T > | read_prop_array (prop_id id) const |
Read a property as an array of the given type. | |
virtual hnid_stream_device | open_prop_stream (prop_id id)=0 |
Creates a stream device over a property on this object. | |
Protected Member Functions | |
virtual byte | get_value_1 (prop_id id) const =0 |
Implemented by child classes to fetch a 1 byte sized property. | |
virtual ushort | get_value_2 (prop_id id) const =0 |
Implemented by child classes to fetch a 2 byte sized property. | |
virtual ulong | get_value_4 (prop_id id) const =0 |
Implemented by child classes to fetch a 4 byte sized property. | |
virtual ulonglong | get_value_8 (prop_id id) const =0 |
Implemented by child classes to fetch a 8 byte sized property. | |
virtual std::vector< byte > | get_value_variable (prop_id id) const =0 |
Implemented by child classes to fetch a variable sized property. |
Property object base class.
This class provides a simple interface (using templates) to access properties on an object. It defines a handful of virtual functions child classes implement to read the raw data.
This class is contains all the conversion logic between the different types, implemented as template specializations, and other property logic such as multivalued property parsing.
virtual fairport::const_property_object::~const_property_object | ( | ) | [inline, virtual] |
virtual std::vector<prop_id> fairport::const_property_object::get_prop_list | ( | ) | const [pure virtual] |
Get a list of all properties on this object.
Implemented in fairport::const_table_row, and fairport::property_bag.
Get the property type of a given prop_id.
[in] | id | The prop_id |
key_not_found<prop_id> | If the specified property is not present |
Implemented in fairport::const_table_row, and fairport::property_bag.
virtual byte fairport::const_property_object::get_value_1 | ( | prop_id | id | ) | const [protected, pure virtual] |
Implemented by child classes to fetch a 1 byte sized property.
virtual ushort fairport::const_property_object::get_value_2 | ( | prop_id | id | ) | const [protected, pure virtual] |
Implemented by child classes to fetch a 2 byte sized property.
virtual ulong fairport::const_property_object::get_value_4 | ( | prop_id | id | ) | const [protected, pure virtual] |
Implemented by child classes to fetch a 4 byte sized property.
virtual ulonglong fairport::const_property_object::get_value_8 | ( | prop_id | id | ) | const [protected, pure virtual] |
Implemented by child classes to fetch a 8 byte sized property.
virtual std::vector<byte> fairport::const_property_object::get_value_variable | ( | prop_id | id | ) | const [protected, pure virtual] |
Implemented by child classes to fetch a variable sized property.
virtual hnid_stream_device fairport::const_property_object::open_prop_stream | ( | prop_id | id | ) | [pure virtual] |
Creates a stream device over a property on this object.
The returned stream device can be used to construct a proper stream:
const_property_object* po = ...; prop_stream nstream(po->open_prop_stream(0x3001));
Which can then be used as any iostream would be.
[in] | id | The prop_id |
key_not_found<prop_id> | If the specified property is not present |
Implemented in fairport::const_table_row, and fairport::property_bag.
virtual bool fairport::const_property_object::prop_exists | ( | prop_id | id | ) | const [pure virtual] |
Indicates the existance of a given property on this object.
[in] | id | The prop_id |
Implemented in fairport::const_table_row, and fairport::property_bag.
bool fairport::const_property_object::read_prop< bool > | ( | prop_id | id | ) | const [inline] |
Read a property as a given type.
It is the callers responsibility to ensure the prop_id is of or convertable to the requested type.
T | The type to interpret he property as |
[in] | id | The prop_id |
key_not_found<prop_id> | If the specified property is not present |
std::vector< bool > fairport::const_property_object::read_prop_array< bool > | ( | prop_id | id | ) | const [inline] |
Read a property as an array of the given type.
It is the callers responsibility to ensure the prop_id is of or convertable to the requested type.
T | The type to interpret he property as |
[in] | id | The prop_id |
key_not_found<prop_id> | If the specified property is not present |
virtual size_t fairport::const_property_object::size | ( | prop_id | id | ) | const [pure virtual] |
Returns the total size of a variable length property.
[in] | id | The prop_id |
Implemented in fairport::const_table_row, and fairport::property_bag.