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 (char const *czstring)
 
constexpr operator char const * () const
 
constexpr char const * c_str () const
 

Private Attributes

char const * 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:63
Represents a JSON value.
Definition json_value.h:149

Definition at line 62 of file json_value.h.

Constructor & Destructor Documentation

◆ StaticString()

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

Definition at line 65 of file json_value.h.

Member Function Documentation

◆ operator char const *()

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

Definition at line 70 of file json_value.h.

◆ c_str()

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

Definition at line 76 of file json_value.h.

Member Data Documentation

◆ str_

char const* Json::StaticString::str_
private

Definition at line 82 of file json_value.h.