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:45
Represents a JSON value.
Definition json_value.h:131

Definition at line 44 of file json_value.h.

Constructor & Destructor Documentation

◆ StaticString()

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

Definition at line 47 of file json_value.h.

Member Function Documentation

◆ operator char const *()

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

Definition at line 52 of file json_value.h.

◆ c_str()

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

Definition at line 58 of file json_value.h.

Member Data Documentation

◆ str_

char const* Json::StaticString::str_
private

Definition at line 64 of file json_value.h.