Tide 0.1.0
Public Member Functions | Protected Member Functions | Protected Attributes

tide::StringElement Class Reference

String primitive element. More...

#include <tide/string_element.h>

Inheritance diagram for tide::StringElement:
Inheritance graph
[legend]
Collaboration diagram for tide::StringElement:
Collaboration graph
[legend]

List of all members.

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 StringElementoperator= (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_

Detailed Description

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.


Constructor & Destructor Documentation

tide::StringElement::StringElement ( uint32_t  id,
std::string  value 
)

Create a new string element with no default.

Parameters:
[in]idThe element's ID, as an unsigned integer up to 28 bits.
[in]valueThe 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.

Parameters:
[in]idThe element's ID, as an unsigned integer up to 28 bits.
[in]valueThe element's value.
[in]default_valueThe default value of the element.

Member Function Documentation

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.


Member Data Documentation

uint64_t tide::StringElement::padding_ [protected]

Definition at line 88 of file string_element.h.


The documentation for this class was generated from the following file:
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Defines