JsonCpp project page | Classes | Namespace | JsonCpp home page

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

Lightweight wrapper to tag static string. More...

`#include <json/value.h>`

Collaboration diagram for Json::StaticString:

## Public Member Functions
| StaticString (const char *czstring)
| operator const char * () const
const char * | c_str () const

## 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;
Json::StaticString
Lightweight wrapper to tag static string.
Definition value.h:147
Json::StaticString::StaticString
StaticString(const char *czstring)
Definition value.h:149
Json::Value
Represents a JSON value.
Definition value.h:193

Definition at line 147 of file value.h.

## Constructor & Destructor Documentation

## ◆ StaticString()

Json::StaticString::StaticString | ( | const char * | czstring | ) |
| inline explicit

Definition at line 149 of file value.h.

## Member Function Documentation

## ◆ c_str()

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

Definition at line 153 of file value.h.

Referenced by Json::Value::operator[](), and Json::Value::Value().

Here is the caller graph for this function:

## ◆ operator const char *()

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

Definition at line 151 of file value.h.

The documentation for this class was generated from the following file:

- include/json/value.h