Tawara
0.1.0
|
Date primitive element. More...
#include <tawara/date_element.h>
Public Member Functions | |
DateElement (uint32_t id, int64_t value) | |
Create a new date element with no default. More... | |
DateElement (uint32_t id, int64_t value, int64_t default_value) | |
Create a new date element with a default value. More... | |
virtual DateElement & | operator= (int64_t const &rhs) |
Value assignment operator. More... | |
virtual std::streamsize | write_body (std::ostream &output) |
Element body writing. More... | |
![]() | |
PrimitiveElement (uint32_t id, int64_tvalue) | |
Create a new element with no default. More... | |
PrimitiveElement (uint32_t id, int64_tvalue, int64_tdefault_value) | |
Create a signed integer element with a default value. More... | |
virtual uint32_t | id () const |
Get the element's ID. More... | |
virtual void | id (uint32_t id) |
Set the element's ID. More... | |
virtual int64_t | value () const |
Get the value. More... | |
virtual void | value (int64_tvalue) |
Set the value. More... | |
operator int64_t () const | |
Cast to the stored type. More... | |
virtual bool | has_default () const |
Check if a default value is set. More... | |
virtual int64_t | get_default () const |
Get the default value. More... | |
virtual void | set_default (int64_tdefault_value) |
Set the default value. More... | |
virtual int64_t | remove_default () |
Remove the default value. More... | |
virtual bool | is_default () const |
Check if this element is at the default value. More... | |
![]() | |
Element (tawara::ids::ID id) | |
Create a new Element. More... | |
virtual | ~Element () |
Destructor. More... | |
uint32_t | id () const |
Get the element's ID. More... | |
std::streampos | offset () const |
Get the element's offset in the byte stream. More... | |
virtual std::streamsize | size () const |
Get the total size of the element. More... | |
virtual std::streamsize | write (std::ostream &output) |
Element writing. More... | |
virtual std::streamsize | read (std::istream &input) |
Element reading. More... | |
Protected Member Functions | |
virtual std::streamsize | body_size () const |
Get the size of the body of this element. More... | |
virtual std::streamsize | read_body (std::istream &input, std::streamsize size) |
Element body loading. More... | |
![]() | |
virtual bool | equal_ (PrimitiveElement< int64_t > const &rhs) |
![]() | |
std::streamsize | write_id (std::ostream &output) |
Element ID writing. More... | |
virtual std::streamsize | write_size (std::ostream &output) |
Element size writing. More... | |
Additional Inherited Members | |
![]() | |
int64_t | value_ |
int64_t | default_ |
bool | has_default_ |
![]() | |
tawara::ids::ID | id_ |
std::streampos | offset_ |
Date primitive element.
This element stores a date. A date is represented as a signed, 64-bit integer giving the number of nanoseconds since 2001-01-01 00:00:00.
Definition at line 57 of file date_element.h.
tawara::DateElement::DateElement | ( | uint32_t | id, |
int64_t | value | ||
) |
Create a new date element with no default.
[in] | id | The element's ID, as an unsigned integer up to 28 bits. |
[in] | value | The element's value. |
tawara::DateElement::DateElement | ( | uint32_t | id, |
int64_t | value, | ||
int64_t | default_value | ||
) |
Create a new date 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. |
|
protectedvirtual |
Get the size of the body of this element.
Implements tawara::Element.
|
virtual |
Value assignment operator.
Reimplemented from tawara::PrimitiveElement< int64_t >.
|
protectedvirtual |
Element body loading.
BadElementLength | if the date element is an incorrect length (i.e. not 8 bytes). |
Implements tawara::Element.
|
virtual |
Element body writing.
Implements tawara::Element.