Open Lighting Architecture: ola::web::JsonDouble Class Reference

| Open Lighting Architecture 0.10.9

Loading...
Searching...
No Matches
Classes | Public Member Functions | Static Public Member Functions | List of all members
ola::web::JsonDouble Class Reference
JSON

## 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:

## 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.
JsonValue * | Clone () 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 JsonValue * | LookupElement (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.
static std::string | AsString (const DoubleRepresentation &rep)
| Convert the DoubleRepresentation to a string.

## Constructor & Destructor Documentation

## ◆ JsonDouble()

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

Create a new JsonDouble.

Parameters

  value | the double to use.

## Member Function Documentation

## ◆ Accept() [1/2]

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.

## ◆ Accept() [2/2]

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.

## ◆ AsDouble()

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

Convert a DoubleRepresentation to a double value.

Parameters

  | rep | the DoubleRepresentation
  [out] | out | The value stored as a double.

Returns
  false if the DoubleRepresentation can't fit in a double.

## ◆ AsString()

string ola::web::JsonDouble::AsString | ( | const DoubleRepresentation & | rep | ) |
| static

Convert the DoubleRepresentation to a string.

Parameters

  rep | the DoubleRepresentation

Returns
  The string representation of the DoubleRepresentation.

## ◆ Clone()

JsonValue * ola::web::JsonDouble::Clone | ( |  | ) | const
| inlinevirtual

Make a copy of this JsonValue.

Implements ola::web::JsonValue.

## ◆ MultipleOf()

bool ola::web::JsonDouble::MultipleOf | ( | const JsonNumber & | other | ) | const
| inlinevirtual

Checks if the remainder if non-0;.

Implements ola::web::JsonNumber.

## ◆ operator<()

bool ola::web::JsonDouble::operator< | ( | const JsonNumber & | other | ) | const
| inlinevirtual

Less than operator.

Implements ola::web::JsonNumber.

## ◆ operator==()

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.

## ◆ Value()

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:

- include/ola/web/Json.h
- common/web/Json.cpp