Generic SmartRest library

Dependents:   SmartRestUnitTest MbedSmartRest MbedSmartRestStreaming

Embed: (wiki syntax)

« Back to documentation index

CharValue Class Reference

CharValue Class Reference

A basic character value. More...

#include <CharValue.h>

Inherits Value.

Public Member Functions

uint8_t valueType () const
 Returns the value type which can be VALUE_NULL, VALUE_INTEGER, VALUE_FLOAT or VALUE_CHARACTER.
long integerValue () const
 Returns the integer value if an integer type, otherwise zero.
double floatValue () const
 Returns the float value if a float type, otherwise zero.
const char * characterValue () const
 Returns the character value if a character type, otherwise zero.
size_t write (AbstractDataSink &) const
 Writes the value to a sink.
size_t length () const
 Returns the number of bytes required to write this value to a sink.
Valuecopy () const
 Copies this value to the heap.

Detailed Description

A basic character value.

This value type behaves simmilar to a null value if the ommitted string is empty.

Definition at line 42 of file CharValue.h.


Member Function Documentation

const char * characterValue (  ) const [virtual]

Returns the character value if a character type, otherwise zero.

Returns:
character value

Implements Value.

Definition at line 75 of file CharValue.cpp.

Value * copy (  ) const [virtual]

Copies this value to the heap.

Referenced contents must also be copied.

Returns:
a new value instance allocated on the heap

Implements Value.

Definition at line 131 of file CharValue.cpp.

double floatValue (  ) const [virtual]

Returns the float value if a float type, otherwise zero.

Returns:
float value

Implements Value.

Definition at line 70 of file CharValue.cpp.

long integerValue (  ) const [virtual]

Returns the integer value if an integer type, otherwise zero.

Returns:
integer value

Implements Value.

Definition at line 65 of file CharValue.cpp.

size_t length (  ) const [virtual]

Returns the number of bytes required to write this value to a sink.

Returns:
number of bytes required to write this value

Implements Value.

Definition at line 96 of file CharValue.cpp.

uint8_t valueType (  ) const [virtual]

Returns the value type which can be VALUE_NULL, VALUE_INTEGER, VALUE_FLOAT or VALUE_CHARACTER.

Returns:
the value type

Implements Value.

Definition at line 58 of file CharValue.cpp.

size_t write ( AbstractDataSink &   ) const [virtual]

Writes the value to a sink.

If necessary, quotes and escape characters may be added.

Parameters:
sinkthe sink to write the value to
Returns:
the number of bytes written

Implements Value.

Definition at line 80 of file CharValue.cpp.