Hazelcast C++ Client
Hazelcast C++ Client Library
Loading...
Searching...
No Matches
hazelcast::client::hazelcast_json_value Class Reference

hazelcast_json_value is a wrapper for Json formatted strings. More...

#include <hazelcast_json_value.h>

Public Member Functions

 hazelcast_json_value (std::string json_string)
 Create a hazelcast_json_value from a string.
const std::string & to_string () const
 This method returns a Json representation of the object.
bool operator== (const hazelcast_json_value &rhs) const
bool operator!= (const hazelcast_json_value &rhs) const
bool operator< (const hazelcast_json_value &rhs) const

Friends

std::ostream HAZELCAST_API & operator<< (std::ostream &os, const hazelcast_json_value &value)

Detailed Description

hazelcast_json_value is a wrapper for Json formatted strings.

It is preferred to store hazelcast_json_value instead of std::string for Json formatted strings. Users can run predicates and use indexes on the attributes of the underlying Json strings.

hazelcast_json_value is queried using Hazelcast's querying language. See query::Predicate.

In terms of querying, numbers in Json strings are treated as either int64_t or double. Strings, bools and NULL are treated as their C++ counterparts.

hazelcast_json_value keeps given string as it is.

Definition at line 47 of file hazelcast_json_value.h.

Constructor & Destructor Documentation

◆ hazelcast_json_value()

hazelcast::client::hazelcast_json_value::hazelcast_json_value ( std::string json_string)

Create a hazelcast_json_value from a string.

This method does not the check validity of the underlying Json string. Invalid Json strings may cause wrong results in queries.

Parameters
jsonStringThe json string
Returns
The hazelcast_json_value representing the json string.

Definition at line 32 of file serialization.cpp.

33 : json_string_(std::move(json_string))
34{}

Member Function Documentation

◆ operator!=()

bool hazelcast::client::hazelcast_json_value::operator!= ( const hazelcast_json_value & rhs) const

Definition at line 51 of file serialization.cpp.

52{
53 return !(rhs == *this);
54}

◆ operator<()

bool hazelcast::client::hazelcast_json_value::operator< ( const hazelcast_json_value & rhs) const

Definition at line 56 of file serialization.cpp.

58{
59 return json_string_ < rhs.json_string_;
60}

◆ operator==()

bool hazelcast::client::hazelcast_json_value::operator== ( const hazelcast_json_value & rhs) const

Definition at line 45 of file serialization.cpp.

46{
47 return json_string_ == rhs.json_string_;
48}

◆ to_string()

const std::string & hazelcast::client::hazelcast_json_value::to_string ( ) const

This method returns a Json representation of the object.

Returns
Json string representation of the object

Definition at line 39 of file serialization.cpp.

40{
41 return json_string_;
42}

◆ operator<<

std::ostream HAZELCAST_API & operator<< ( std::ostream & os,
const hazelcast_json_value & value )
friend

Definition at line 62 of file serialization.cpp.

64{
65 os << "jsonString: " << value.json_string_;
66 return os;
67}

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