Tide 0.1.0
|
The primitive data element interface. More...
#include <tide/prim_element.h>
Public Member Functions | |
PrimitiveElement (uint32_t id, T value) | |
Create a new element with no default. | |
PrimitiveElement (uint32_t id, T value, T default_value) | |
Create a signed integer element with a default value. | |
virtual PrimitiveElement & | operator= (T const &rhs) |
Value assignment operator. | |
virtual uint32_t | id () const |
Get the element's ID. | |
virtual void | id (uint32_t id) |
Set the element's ID. | |
virtual T | value () const |
Get the value. | |
virtual void | value (T value) |
Set the value. | |
operator T () const | |
Cast to the stored type. | |
virtual bool | has_default () const |
Check if a default value is set. | |
virtual T | get_default () const |
Get the default value. | |
virtual void | set_default (T default_value) |
Set the default value. | |
virtual T | remove_default () |
Remove the default value. | |
virtual bool | is_default () const |
Check if this element is at the default value. | |
Protected Member Functions | |
virtual bool | equal_ (PrimitiveElement< T > const &rhs) |
Protected Attributes | |
T | value_ |
T | default_ |
bool | has_default_ |
Friends | |
bool | operator== (PrimitiveElement< T > const &lhs, PrimitiveElement< T > const &rhs) |
Equality operator. |
The primitive data element interface.
Primitive elements store one of the EBML primitive data types. These are:
A default value can be specified for the element. If a default is given, it may allow the element to be skipped when writing to a store.
Any type specified for T must initialise itself upon construction, be copy-constructable, have an assignment operator, and perform its own clean-up in its destructor. POD types qualify for this.
Definition at line 65 of file prim_element.h.
tide::PrimitiveElement< T >::PrimitiveElement | ( | uint32_t | id, |
T | value | ||
) | [inline] |
Create a new element with no default.
[in] | id | The element's ID, as an unsigned integer up to 28 bits. |
[in] | value | The element's value. |
Definition at line 75 of file prim_element.h.
tide::PrimitiveElement< T >::PrimitiveElement | ( | uint32_t | id, |
T | value, | ||
T | default_value | ||
) | [inline] |
Create a signed integer element with a default value.
[in] | id | The element's ID, as an unsigned integer up to 28 bits. |
[in] | value | The element's value. |
[in] | default_value | The default value of the element. |
Definition at line 88 of file prim_element.h.
virtual bool tide::PrimitiveElement< T >::equal_ | ( | PrimitiveElement< T > const & | rhs | ) | [inline, protected, virtual] |
Definition at line 168 of file prim_element.h.
virtual T tide::PrimitiveElement< T >::get_default | ( | ) | const [inline, virtual] |
Get the default value.
Definition at line 132 of file prim_element.h.
virtual bool tide::PrimitiveElement< T >::has_default | ( | ) | const [inline, virtual] |
Check if a default value is set.
Definition at line 130 of file prim_element.h.
virtual uint32_t tide::PrimitiveElement< T >::id | ( | ) | const [inline, virtual] |
Get the element's ID.
Reimplemented from tide::Element.
Definition at line 102 of file prim_element.h.
virtual void tide::PrimitiveElement< T >::id | ( | uint32_t | id | ) | [inline, virtual] |
Set the element's ID.
[in] | id | The element's new ID, as an unsigned integer up to 28 bits. |
Definition at line 109 of file prim_element.h.
virtual bool tide::PrimitiveElement< T >::is_default | ( | ) | const [inline, virtual] |
Check if this element is at the default value.
If the current value is the same as the default value, this element may not need to be stored when being written.
Definition at line 153 of file prim_element.h.
tide::PrimitiveElement< T >::operator T | ( | ) | const [inline] |
Cast to the stored type.
Definition at line 127 of file prim_element.h.
virtual PrimitiveElement& tide::PrimitiveElement< T >::operator= | ( | T const & | rhs | ) | [inline, virtual] |
Value assignment operator.
Reimplemented in tide::BinaryElement, tide::DateElement, tide::FloatElement, tide::IntElement, tide::StringElement, and tide::UIntElement.
Definition at line 95 of file prim_element.h.
virtual T tide::PrimitiveElement< T >::remove_default | ( | ) | [inline, virtual] |
Remove the default value.
Definition at line 143 of file prim_element.h.
virtual void tide::PrimitiveElement< T >::set_default | ( | T | default_value | ) | [inline, virtual] |
Set the default value.
Definition at line 134 of file prim_element.h.
virtual T tide::PrimitiveElement< T >::value | ( | ) | const [inline, virtual] |
Get the value.
Definition at line 123 of file prim_element.h.
virtual void tide::PrimitiveElement< T >::value | ( | T | value | ) | [inline, virtual] |
Set the value.
Definition at line 125 of file prim_element.h.
bool operator== | ( | PrimitiveElement< T > const & | lhs, |
PrimitiveElement< T > const & | rhs | ||
) | [friend] |
Equality operator.
Definition at line 157 of file prim_element.h.
T tide::PrimitiveElement< T >::default_ [protected] |
Definition at line 165 of file prim_element.h.
bool tide::PrimitiveElement< T >::has_default_ [protected] |
Definition at line 166 of file prim_element.h.
T tide::PrimitiveElement< T >::value_ [protected] |
Definition at line 164 of file prim_element.h.