Open Lighting Architecture  Latest Git
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Modules 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:
Inheritance graph
[legend]
Collaboration diagram for ola::web::JsonDouble:
Collaboration graph
[legend]

Classes

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

Public Member Functions

 JsonDouble (double value)
 Create a new JsonDouble. More...
 
 JsonDouble (const DoubleRepresentation &rep)
 Create a new JsonDouble from separate components.
 
bool operator== (const JsonValue &other) const
 Equality operator. More...
 
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. More...
 
void Accept (JsonValueConstVisitorInterface *visitor) const
 The Accept (const) method for the visitor pattern. More...
 
const std::string & ToString () const
 Return the double value as a string.
 
double Value () const
 Returns the value as a double. More...
 
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.
 
- Public Member Functions inherited from ola::web::JsonValue
virtual JsonValueLookupElement (const JsonPointer &pointer)
 Locate the JsonValue referred to by the JSON Pointer.
 
virtual bool operator!= (const JsonValue &other) const
 Not-equals operator.
 

Static Public Member Functions

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

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: