Tide 0.1.0
|
String primitive element. More...
#include <tide/string_element.h>
Public Member Functions | |
StringElement (uint32_t id, std::string value) | |
Create a new string element with no default. | |
StringElement (uint32_t id, std::string value, std::string default_value) | |
Create a new string element with a default value. | |
virtual StringElement & | operator= (std::string const &rhs) |
Value assignment operator. | |
virtual uint64_t | padding () const |
Get the amount of padding used. | |
virtual void | padding (uint64_t padding) |
Set the amount of padding to use. | |
virtual std::streamsize | write_body (std::ostream &output) |
Element body writing. | |
Protected Member Functions | |
virtual std::streamsize | body_size () const |
Get the size of the body of this element. | |
virtual std::streamsize | read_body (std::istream &input, std::streamsize size) |
Element body loading. | |
Protected Attributes | |
uint64_t | padding_ |
String primitive element.
This element stores a UTF-8 string. Upon writing to a store, the string may or may not be padded with null bytes.
Definition at line 46 of file string_element.h.
tide::StringElement::StringElement | ( | uint32_t | id, |
std::string | value | ||
) |
Create a new string element with no default.
[in] | id | The element's ID, as an unsigned integer up to 28 bits. |
[in] | value | The element's value. |
tide::StringElement::StringElement | ( | uint32_t | id, |
std::string | value, | ||
std::string | default_value | ||
) |
Create a new string 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. |
virtual std::streamsize tide::StringElement::body_size | ( | ) | const [protected, virtual] |
Get the size of the body of this element.
Implements tide::Element.
virtual StringElement& tide::StringElement::operator= | ( | std::string const & | rhs | ) | [virtual] |
Value assignment operator.
Reimplemented from tide::PrimitiveElement< std::string >.
virtual uint64_t tide::StringElement::padding | ( | ) | const [inline, virtual] |
Get the amount of padding used.
Definition at line 71 of file string_element.h.
virtual void tide::StringElement::padding | ( | uint64_t | padding | ) | [inline, virtual] |
Set the amount of padding to use.
Strings can be zero-padded at the end. This is particularly useful when overwriting an existing string with one that is shorter, so that the file does not need to be rewritten or a void element used.
Management of this value is the responsibility of the user of the StringElement. It will never be adjusted automatically.
Definition at line 82 of file string_element.h.
virtual std::streamsize tide::StringElement::read_body | ( | std::istream & | input, |
std::streamsize | size | ||
) | [protected, virtual] |
Element body loading.
Implements tide::Element.
virtual std::streamsize tide::StringElement::write_body | ( | std::ostream & | output | ) | [virtual] |
Element body writing.
Implements tide::Element.
uint64_t tide::StringElement::padding_ [protected] |
Definition at line 88 of file string_element.h.