CMS 3D CMS Logo

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

Lightweight wrapper to tag static string. More...

#include <value.h>

Public Member Functions

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

Private Attributes

const char * str_
 

Detailed Description

Lightweight wrapper to tag static string.

Value constructor and objectValue member assignement 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") );
static const StaticString code("code");
object[code] = 1234;

Definition at line 60 of file value.h.

Constructor & Destructor Documentation

◆ StaticString()

Json::StaticString::StaticString ( const char *  czstring)
inlineexplicit

Definition at line 62 of file value.h.

62 : str_(czstring) {}
const char * str_
Definition: value.h:69

Member Function Documentation

◆ c_str()

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

Definition at line 66 of file value.h.

66 { return str_; }
const char * str_
Definition: value.h:69

◆ operator const char *()

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

Definition at line 64 of file value.h.

64 { return str_; }
const char * str_
Definition: value.h:69

Member Data Documentation

◆ str_

const char* Json::StaticString::str_
private

Definition at line 69 of file value.h.