SPT JSON API  1.0.0
Developed by Sans Pareil Technologies, Inc. (SPT)
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Pages
spt::json::Number Class Reference

Represents a JSON number value. More...

#include <Number.h>

+ Inheritance diagram for spt::json::Number:
+ Collaboration diagram for spt::json::Number:

Public Member Functions

 Number (int64_t ival)
 
 Number (double dval)
 
 Number (Number &&rhs)
 Move CTOR. More...
 
Numberoperator= (Number &&rhs)
 Move assignment operator. More...
 
bool isInt () const
 
bool isFloat () const
 
int64_t getInt () const
 
Numberset (int64_t ival)
 Update the value stored in this instance to the specified integral value. More...
 
double getFloat () const
 
Numberset (double dval)
 Update the value stored in this instance to the specified integral value. More...
 
- Public Member Functions inherited from spt::json::Value
virtual ~Value ()
 Virtual DTOR for sub-classes. More...
 
 Value (Value &&rhs)
 Move CTOR. More...
 
Valueoperator= (Value &&rhs)
 Move assignment operator. More...
 
 Value (const Value &)=delete
 Copy CTOR. Deleted. More...
 
Valueoperator= (Value &)=delete
 Copy assignment operator deleted. More...
 
Type getType () const
 Return the type of data that is represented by this instance. More...
 

Additional Inherited Members

- Public Types inherited from spt::json::Value
enum  Type : int8_t {
  Type::String, Type::Number, Type::Object, Type::Array,
  Type::Boolean, Type::Null
}
 Enumeration of JSON data types. More...
 
typedef std::unique_ptr< ValuePtr
 Unique pointer that holds a value instance. More...
 
- Protected Member Functions inherited from spt::json::Value
 Value (Type t)
 CTOR with specified type. More...
 

Detailed Description

Represents a JSON number value.

A number may be integral or floating point. Use the isInt or isFloat methods to determine whether the value represents an integral or floating value.

Date
Created 2013/05/02 18:50
Author
Rakesh Vidyadharan
Version
Id
Number.h 5671 2014-10-25 15:33:01Z rakesh

Constructor & Destructor Documentation

spt::json::Number::Number ( int64_t  ival)
inlineexplicit
Parameters
ivalCreate a new instance with the specified integral value
spt::json::Number::Number ( double  dval)
inlineexplicit
Parameters
dvalCreate a new instance with the specified float value.
spt::json::Number::Number ( Number &&  rhs)
inline

Move CTOR.

Member Function Documentation

double spt::json::Number::getFloat ( ) const
inline
Returns
The double that was stored in this instance.
int64_t spt::json::Number::getInt ( ) const
inline
Returns
The integer that was stored in this instance.
bool spt::json::Number::isFloat ( ) const
inline
Returns
Return true if this instance was constructed using a double.
bool spt::json::Number::isInt ( ) const
inline
Returns
Return true if this instance was constructed using an integer.
Number& spt::json::Number::operator= ( Number &&  rhs)
inline

Move assignment operator.

Number& spt::json::Number::set ( int64_t  ival)
inline

Update the value stored in this instance to the specified integral value.

Parameters
ivalThe new integral value to set
Returns
This instance for convenience.
Number& spt::json::Number::set ( double  dval)
inline

Update the value stored in this instance to the specified integral value.

Parameters
dvalThe new integral value to set
Returns
This instance for convenience.

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