10Duke Scale C++ Client
Loading...
Searching...
No Matches
tenduke::json::cjson::CjsonElement Class Reference

#include <CJsonElement.h>

Detailed Description

cJSON-implementation of tenduke::json::JSONElement.

Inheritance diagram for tenduke::json::cjson::CjsonElement:
tenduke::json::JSONElement tenduke::json::cjson::CjsonArray tenduke::json::cjson::CjsonBoolean tenduke::json::cjson::CjsonNumber tenduke::json::cjson::CjsonObject tenduke::json::cjson::CjsonString

Public Member Functions

 CjsonElement (enum tenduke::json::JSONElement::Type type, cJSON *element, bool root)
 Constructs new instance.
 
 CjsonElement (enum tenduke::json::JSONElement::Type type, cJSON *element)
 Constructs new instance.
 
std::string asString () const override
 Returns string representation of this element.
 
enum Type getType () const override
 Returns type of this element.
 
void setRoot (bool p_root)
 Marks this node as root element.
 
cJSON * getCjsonElement () const
 Returns the pointer to cJSON-element.
 
- Public Member Functions inherited from tenduke::json::JSONElement
bool isArray () const
 Utility to check if this element is JSONArray.
 
bool isBoolean () const
 Utility to check if this element is JSONBoolean.
 
bool isNull () const
 Utility to check if this element is null.
 
bool isNumber () const
 Utility to check if this element is JSONNumber.
 
bool isObject () const
 Utility to check if this element is JSONObject.
 
bool isString () const
 Utility to check if this element is JSONString.
 
bool isUndefined () const
 Utility to check if this element is undefined.
 

Protected Attributes

cJSON * element
 Pointer to the cJSON element.
 

Additional Inherited Members

- Public Types inherited from tenduke::json::JSONElement
enum  Type {
  UNDEFINED , NULLISH , OBJECT , ARRAY ,
  NUMBER , STRING , BOOLEAN
}
 Type of the element.
 
- Static Public Member Functions inherited from tenduke::json::JSONElement
static std::string typeToString (const enum Type type)
 Converts the type to string.
 

Constructor & Destructor Documentation

◆ CjsonElement() [1/2]

tenduke::json::cjson::CjsonElement::CjsonElement ( enum tenduke::json::JSONElement::Type  type,
cJSON *  element,
bool  root 
)
inline

Constructs new instance.

Parameters
type-
element-
root-

◆ CjsonElement() [2/2]

tenduke::json::cjson::CjsonElement::CjsonElement ( enum tenduke::json::JSONElement::Type  type,
cJSON *  element 
)
inline

Constructs new instance.

Parameters
type-
element-

Member Function Documentation

◆ asString()

std::string tenduke::json::cjson::CjsonElement::asString ( ) const
overridevirtual

Returns string representation of this element.

Returns
-

Implements tenduke::json::JSONElement.

Reimplemented in tenduke::json::cjson::CjsonNumber, and tenduke::json::cjson::CjsonString.

◆ getCjsonElement()

cJSON * tenduke::json::cjson::CjsonElement::getCjsonElement ( ) const
inline

Returns the pointer to cJSON-element.

TBD: Should this be removed?

Returns
-

◆ getType()

enum Type tenduke::json::cjson::CjsonElement::getType ( ) const
inlineoverridevirtual

Returns type of this element.

Returns
-

Implements tenduke::json::JSONElement.

◆ setRoot()

void tenduke::json::cjson::CjsonElement::setRoot ( bool  p_root)
inline

Marks this node as root element.

Parameters
p_root-

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