Microsoft Information Protection (MIP) SDK for C++: Reference 1.15
Doxygen-generated documentation for MIP SDK written in C++
Loading...
Searching...
No Matches
JsonValue Class Referenceabstract

#include <src/api/mip/json_value.h>

Public Member Functions

virtual void AddMember (const std::string &key, bool member)=0
 Add a boolean member to an Object with the specified key and value.
 
virtual void AddMember (const std::string &key, const std::shared_ptr< JsonValue > &jsonValue)=0
 Add a value member to an Object.
 
virtual void AddMember (const std::string &key, const std::string &member)=0
 
virtual void AddMember (const std::string &key, int member)=0
 Add a signed integer member to an Object with the specified key and value.
 
virtual void AddMember (const std::string &key, unsigned int member)=0
 Add an unsigned integer member to an Object with the specified key and value.
 
virtual bool GetBool () const =0
 If the current value is a bool, return it.
 
virtual double GetDouble () const =0
 If the current value is a double, return it.
 
virtual int GetInt () const =0
 If the current value is an int, return it.
 
virtual std::shared_ptr< JsonValueGetMember (const std::string &key) const =0
 return child value with the specified key if this is an Object.
 
virtual std::shared_ptr< JsonValueGetMember (unsigned int index) const =0
 return child value at specified index if this is an Array.
 
virtual std::string GetString () const =0
 If the current value is a string, return it.
 
virtual std::vector< std::string > GetStringArray () const =0
 return value array as strings, skip non string elements.
 
virtual std::vector< std::pair< std::string, std::string > > GetStringObjectMembers () const =0
 Return all string members of this object and their keys, skip non string elements.
 
virtual unsigned int GetUint () const =0
 If the current value is a uint, return it.
 
virtual bool HasMember (const std::string &key) const =0
 return true if object has a child with the specified key.
 
virtual bool IsArray () const =0
 check if value is a json array.
 
virtual bool IsBool () const =0
 Return true if the current value is a bool.
 
virtual bool IsInt () const =0
 Returns true if the current value is an int.
 
virtual bool IsNumber () const =0
 Return true if the current value is a number of any type.
 
virtual bool IsObject () const =0
 check if value is a json object.
 
virtual bool IsString () const =0
 check if value is a string.
 
virtual bool IsUint () const =0
 Return true if the current value is an unsigned int.
 
virtual void PushBack (const std::shared_ptr< JsonValue > &jsonValue)=0
 Add a value member to an Array.
 
virtual void PushBack (const std::string &member)=0
 Add a string member to an Array with the specified value.
 
virtual std::string SerializeToString () const =0
 Serialize the value and all children as a string.
 
virtual size_t Size () const =0
 return number of child elements.
 

Detailed Description

Definition at line 42 of file json_value.h.

Member Function Documentation

◆ AddMember() [1/5]

virtual void JsonValue::AddMember ( const std::string & key,
bool member )
pure virtual

Add a boolean member to an Object with the specified key and value.

Parameters
keyThe key of the member to add.
memberThe value of the member to add.

◆ AddMember() [2/5]

virtual void JsonValue::AddMember ( const std::string & key,
const std::shared_ptr< JsonValue > & jsonValue )
pure virtual

Add a value member to an Object.

The object should not be modified after being added.

◆ AddMember() [3/5]

virtual void JsonValue::AddMember ( const std::string & key,
const std::string & member )
pure virtual

◆ AddMember() [4/5]

virtual void JsonValue::AddMember ( const std::string & key,
int member )
pure virtual

Add a signed integer member to an Object with the specified key and value.

Parameters
keyThe key of the member to add.
memberThe value of the member to add.

◆ AddMember() [5/5]

virtual void JsonValue::AddMember ( const std::string & key,
unsigned int member )
pure virtual

Add an unsigned integer member to an Object with the specified key and value.

Parameters
keyThe key of the member to add.
memberThe value of the member to add.

◆ GetBool()

virtual bool JsonValue::GetBool ( ) const
pure virtual

If the current value is a bool, return it.

Returns
The current value if it is a bool.

◆ GetDouble()

virtual double JsonValue::GetDouble ( ) const
pure virtual

If the current value is a double, return it.

Returns
The current value if it is a double.

◆ GetInt()

virtual int JsonValue::GetInt ( ) const
pure virtual

If the current value is an int, return it.

Returns
The current value if it is an int.

◆ GetMember() [1/2]

virtual std::shared_ptr< JsonValue > JsonValue::GetMember ( const std::string & key) const
pure virtual

return child value with the specified key if this is an Object.

Returns
child value with the specified key if this is an Object.

◆ GetMember() [2/2]

virtual std::shared_ptr< JsonValue > JsonValue::GetMember ( unsigned int index) const
pure virtual

return child value at specified index if this is an Array.

Returns
child value at specified index if this is an Array.

◆ GetString()

virtual std::string JsonValue::GetString ( ) const
pure virtual

If the current value is a string, return it.

Returns
The current value if it is a string.

◆ GetStringArray()

virtual std::vector< std::string > JsonValue::GetStringArray ( ) const
pure virtual

return value array as strings, skip non string elements.

Returns
a vector of the string in a json array.

◆ GetStringObjectMembers()

virtual std::vector< std::pair< std::string, std::string > > JsonValue::GetStringObjectMembers ( ) const
pure virtual

Return all string members of this object and their keys, skip non string elements.

Example: for the json object {"a": "b", "c": "d", "e": 1, "f": {"g": "h"}} this method would return a vector of two pairs: ("a", "b") and ("c", "d").

Returns
all string members of this object and their keys as a vector of pairs.

◆ GetUint()

virtual unsigned int JsonValue::GetUint ( ) const
pure virtual

If the current value is a uint, return it.

Returns
The current value if it is a uint.

◆ HasMember()

virtual bool JsonValue::HasMember ( const std::string & key) const
pure virtual

return true if object has a child with the specified key.

Returns
true if object has a child with the specified key.

◆ IsArray()

virtual bool JsonValue::IsArray ( ) const
pure virtual

check if value is a json array.

Returns
true if json value is a json array.

◆ IsBool()

virtual bool JsonValue::IsBool ( ) const
pure virtual

Return true if the current value is a bool.

Returns
true if the current value is a bool.

◆ IsInt()

virtual bool JsonValue::IsInt ( ) const
pure virtual

Returns true if the current value is an int.

Returns
true if the current value is an int.

◆ IsNumber()

virtual bool JsonValue::IsNumber ( ) const
pure virtual

Return true if the current value is a number of any type.

Returns
true if the current value is a number of any type.

◆ IsObject()

virtual bool JsonValue::IsObject ( ) const
pure virtual

check if value is a json object.

Returns
true if json value is a json object.

◆ IsString()

virtual bool JsonValue::IsString ( ) const
pure virtual

check if value is a string.

Returns
true if json value is string.

◆ IsUint()

virtual bool JsonValue::IsUint ( ) const
pure virtual

Return true if the current value is an unsigned int.

Returns
true if the current value is an unsigned int.

◆ PushBack() [1/2]

virtual void JsonValue::PushBack ( const std::shared_ptr< JsonValue > & jsonValue)
pure virtual

Add a value member to an Array.

The object should not be modified after being added.

◆ PushBack() [2/2]

virtual void JsonValue::PushBack ( const std::string & member)
pure virtual

Add a string member to an Array with the specified value.

Parameters
memberThe value of the member to add.

◆ SerializeToString()

virtual std::string JsonValue::SerializeToString ( ) const
pure virtual

Serialize the value and all children as a string.

Returns
This json value and all children serialized as a string.

◆ Size()

virtual size_t JsonValue::Size ( ) const
pure virtual

return number of child elements.

Returns
number of child elements.

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