Google APIs Client Library for C++
|
An abstract interface for data objects used to denote JSON compatability. More...
#include "client/data/serializable_json.h"
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 DataReader * | MakeJsonReader () 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. |
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.
virtual ~SerializableJson | ( | ) | [virtual] |
Standard destructor.
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.
[in] | reader | JSON-encoded byte stream. |
Implemented in JsonCppData.
virtual util::Status LoadFromJsonStream | ( | std::istream * | stream | ) | [virtual] |
Initializes this instance from a standard C++ istream.
[in] | stream | JSON-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.
Implemented in JsonCppData.
virtual util::Status StoreToJsonStream | ( | std::ostream * | stream | ) | const [virtual] |
Serialize the instance as a JSON document to an ostream.
[in] | stream | The output stream to write to. |
The default implementation calls MakeJsonReader() and writes the byte-stream to the output stream.
Reimplemented in JsonCppData.