rippled
Loading...
Searching...
No Matches
Public Member Functions | Private Attributes | List of all members
Json::StaticString Class Reference

Lightweight wrapper to tag static string. More...

#include <json_value.h>

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;
Lightweight wrapper to tag static string.
Definition: json_value.h:62
Represents a JSON value.
Definition: json_value.h:148

Definition at line 61 of file json_value.h.

Constructor & Destructor Documentation

◆ StaticString()

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

Definition at line 64 of file json_value.h.

Member Function Documentation

◆ operator const char *()

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

Definition at line 69 of file json_value.h.

◆ c_str()

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

Definition at line 75 of file json_value.h.

Member Data Documentation

◆ str_

const char* Json::StaticString::str_
private

Definition at line 81 of file json_value.h.