rippled
Public Member Functions | Private Attributes | List of all members
Json::StaticString Class Reference

Lightweight wrapper to tag static string. More...

Public Member Functions

constexpr StaticString (const char *czstring)
 
constexpr operator const char * () const
 
constexpr const char * c_str () const
 

Private Attributes

const char * str_
 

Detailed Description

Lightweight wrapper to tag static string.

Value constructor and objectValue member assignment takes advantage of the StaticString and avoid the cost of string duplication when storing the string or the member name.

Example of usage:

Json::Value aValue( StaticString("some text") );
Json::Value object;
static const StaticString code("code");
object[code] = 1234;

Definition at line 60 of file json_value.h.

Constructor & Destructor Documentation

◆ StaticString()

constexpr Json::StaticString::StaticString ( const char *  czstring)
explicitconstexpr

Definition at line 63 of file json_value.h.

Member Function Documentation

◆ operator const char *()

constexpr Json::StaticString::operator const char * ( ) const
constexpr

Definition at line 67 of file json_value.h.

◆ c_str()

constexpr const char* Json::StaticString::c_str ( ) const
constexpr

Definition at line 73 of file json_value.h.

Member Data Documentation

◆ str_

const char* Json::StaticString::str_
private

Definition at line 79 of file json_value.h.

Json::StaticString::StaticString
constexpr StaticString(const char *czstring)
Definition: json_value.h:63
Json::Value
Represents a JSON value.
Definition: json_value.h:145