Google APIs Client Library for C++
SerializableJson Class Reference

An abstract interface for data objects used to denote JSON compatability. More...

#include "client/data/serializable_json.h"

+ Inheritance diagram for SerializableJson:

List of all members.

Public Member Functions

virtual ~SerializableJson ()
 Standard destructor.
virtual void Clear ()=0
 Clear the instance data back to default state.
virtual util::Status LoadFromJsonReader (DataReader *reader)=0
 Initialize instance from a reader.
virtual DataReaderMakeJsonReader () const =0
 Creates a reader that contains the serialized json for this object.
virtual util::Status LoadFromJsonStream (std::istream *stream)
 Initializes this instance from a standard C++ istream.
virtual util::Status StoreToJsonStream (std::ostream *stream) const
 Serialize the instance as a JSON document to an ostream.

Detailed Description

An abstract interface for data objects used to denote JSON compatability.

This is just an interface for a data object. At least at this time. For a concrete class, see JsonCppData in jsoncpp_data.h. The intent of making this an interface is to allow other underlying implementations for experimentation without impacting much code that just passes through data or converts to/from json wire protocol.


Constructor & Destructor Documentation

virtual ~SerializableJson ( ) [virtual]

Standard destructor.


Member Function Documentation

virtual void Clear ( ) [pure virtual]

Clear the instance data back to default state.

Implemented in JsonCppData.

virtual util::Status LoadFromJsonReader ( DataReader reader) [pure virtual]

Initialize instance from a reader.

Parameters:
[in]readerJSON-encoded byte stream.

Implemented in JsonCppData.

virtual util::Status LoadFromJsonStream ( std::istream *  stream) [virtual]

Initializes this instance from a standard C++ istream.

Parameters:
[in]streamJSON-encoded istream

The default implementation creates an IstreamDataReader and calls the Load() method.

Reimplemented in JsonCppData.

virtual DataReader* MakeJsonReader ( ) const [pure virtual]

Creates a reader that contains the serialized json for this object.

Returns:
A JSON-encoded byte stream with this object's state. If there is an error, the details will be in the reader status().

Implemented in JsonCppData.

virtual util::Status StoreToJsonStream ( std::ostream *  stream) const [virtual]

Serialize the instance as a JSON document to an ostream.

Parameters:
[in]streamThe output stream to write to.

The default implementation calls MakeJsonReader() and writes the byte-stream to the output stream.

Reimplemented in JsonCppData.


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