osgEarth 2.1.1
Public Member Functions | Private Attributes

osgEarth::Json::StaticString Class Reference

Lightweight wrapper to tag static string. More...

List of all members.

Public Member Functions

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

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") );
 Json::Value object;
 static const StaticString code("code");
 object[code] = 1234;

Definition at line 119 of file JsonUtils.


Constructor & Destructor Documentation

osgEarth::Json::StaticString::StaticString ( const char *  czstring) [inline, explicit]

Definition at line 122 of file JsonUtils.

         : str_( czstring )
      {
      }

Member Function Documentation

const char* osgEarth::Json::StaticString::c_str ( ) const [inline]

Definition at line 132 of file JsonUtils.

      {
         return str_;
      }

Here is the caller graph for this function:

osgEarth::Json::StaticString::operator const char * ( ) const [inline]

Definition at line 127 of file JsonUtils.

      {
         return str_;
      }

Member Data Documentation

const char* osgEarth::Json::StaticString::str_ [private]

Definition at line 138 of file JsonUtils.


The documentation for this class was generated from the following file:
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Defines