Open Lighting Architecture  0.9.5
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
Classes | Public Member Functions | Static Public Member Functions | List of all members
ola::web::JsonDouble Class Reference

Detailed Description

A double value.

Double Values represent numbers which are not simple integers. They can have a fractional and/or exponent. A double value takes the form: [full].[fractional]e[exponent]. e.g 23.00456e-3.

Inheritance diagram for ola::web::JsonDouble:
ola::web::JsonNumber ola::web::JsonLeafValue ola::web::JsonValue

Classes

struct  DoubleRepresentation
 Represents a JSON double value broken down as separate components. More...

Public Member Functions

 JsonDouble (double value)
 Create a new JsonDouble.
 JsonDouble (const DoubleRepresentation &rep)
 Create a new JsonDouble from separate components.
bool operator== (const JsonValue &other) const
 Equality operator.
bool operator< (const JsonNumber &other) const
 Less than operator.
bool MultipleOf (const JsonNumber &other) const
 Checks if the remainder if non-0;.
void Accept (JsonValueVisitorInterface *visitor)
 The Accept method for the visitor pattern.
void Accept (JsonValueConstVisitorInterface *visitor) const
 The Accept (const) method for the visitor pattern.
const std::string & ToString () const
 Return the double value as a string.
double Value () const
 Returns the value as a double.
JsonValueClone () const
 Make a copy of this JsonValue.
- Public Member Functions inherited from ola::web::JsonNumber
bool operator<= (const JsonNumber &other) const
 Less than or equals operator.
bool operator> (const JsonNumber &other) const
 Greater than operator.
bool operator>= (const JsonNumber &other) const
 Greater than or equals operator.

Static Public Member Functions

static bool AsDouble (const DoubleRepresentation &rep, double *out)
 Convert a DoubleRepresentation to a double value.
static std::string AsString (const DoubleRepresentation &rep)
 Convert the DoubleRepresentation to a string.

Constructor & Destructor Documentation

ola::web::JsonDouble::JsonDouble ( double  value)
explicit

Create a new JsonDouble.

Parameters
valuethe double to use.

Member Function Documentation

void ola::web::JsonDouble::Accept ( JsonValueVisitorInterface visitor)
inlinevirtual

The Accept method for the visitor pattern.

This can be used to traverse the Json Tree in a type-safe manner.

Implements ola::web::JsonValue.

void ola::web::JsonDouble::Accept ( JsonValueConstVisitorInterface visitor) const
inlinevirtual

The Accept (const) method for the visitor pattern.

This can be used to traverse the Json Tree in a type-safe manner.

Implements ola::web::JsonValue.

bool ola::web::JsonDouble::AsDouble ( const DoubleRepresentation rep,
double *  out 
)
static

Convert a DoubleRepresentation to a double value.

Parameters
repthe DoubleRepresentation
[out]outThe value stored as a double.
Returns
false if the DoubleRepresentation can't fit in a double.
string ola::web::JsonDouble::AsString ( const DoubleRepresentation rep)
static

Convert the DoubleRepresentation to a string.

Parameters
repthe DoubleRepresentation
Returns
The string representation of the DoubleRepresentation.
bool ola::web::JsonDouble::operator== ( const JsonValue other) const
inlinevirtual

Equality operator.

This implements equality as defined in section 3.6 of the JSON Schema Core document.

Implements ola::web::JsonValue.

double ola::web::JsonDouble::Value ( ) const
inline

Returns the value as a double.

This may be incorrect if the value exceeds the storage space of the double.


The documentation for this class was generated from the following files: