ConfigDB::Format Class Referenceabstract

Abstract base class wrapping support for a specific storage format, such as JSON. More...

#include <Format.h>

Inheritance diagram for ConfigDB::Format:

Public Member Functions

virtual std::unique_ptr< ExportStreamcreateExportStream (Database &db, const ExportOptions &options={}) const =0
 Create a stream to serialize the entire database. More...
 
virtual std::unique_ptr< ExportStreamcreateExportStream (StoreRef store, const Object &object, const ExportOptions &options={}) const =0
 Create a stream to serialize an Object. More...
 
virtual size_t exportToStream (const Object &object, Print &output, const ExportOptions &options={}) const =0
 Print object. More...
 
virtual size_t exportToStream (Database &database, Print &output, const ExportOptions &options={}) const =0
 Serialise entire database directly to an output stream. More...
 
virtual std::unique_ptr< ImportStreamcreateImportStream (Database &db) const =0
 Create a stream for de-serialising (writing) into the database Used when updating a database from a remote web client, for example via HttpRequest. More...
 
virtual std::unique_ptr< ImportStreamcreateImportStream (StoreUpdateRef &store, Object &object) const =0
 Create a stream for de-serialising (writing) into a store. More...
 
virtual Status importFromStream (Object &object, Stream &source) const =0
 De-serialise content from stream into object (RAM) More...
 
virtual Status importFromStream (Database &database, Stream &source) const =0
 De-serialise content from stream into database Each store is overwritten as it is loadded. If a store entry is not represented in the data then it is left untouched. More...
 
virtual String getFileExtension () const =0
 Get the standard file extension for the reader implementation. More...
 
virtual MimeType getMimeType () const =0
 Get the MIME type for this reader format. More...
 

Detailed Description

Abstract base class wrapping support for a specific storage format, such as JSON.

Member Function Documentation

◆ createExportStream() [1/2]

virtual std::unique_ptr<ExportStream> ConfigDB::Format::createExportStream ( Database db,
const ExportOptions options = {} 
) const
pure virtual

Create a stream to serialize the entire database.

Parameters
databaseThe database to serialize
optionsAdvanced settings for adjusting output

This is used for streaming asychronously to a web client, for example in an HttpResponse.

Implemented in ConfigDB::Json::Format.

◆ createExportStream() [2/2]

virtual std::unique_ptr<ExportStream> ConfigDB::Format::createExportStream ( StoreRef  store,
const Object object,
const ExportOptions options = {} 
) const
pure virtual

Create a stream to serialize an Object.

Parameters
storeShared pointer to store
objectObject to start streaming from
optionsAdvanced settings for adjusting output

Used for streaming asychronously to a web client, for example in an HttpResponse.

Implemented in ConfigDB::Json::Format.

◆ createImportStream() [1/2]

virtual std::unique_ptr<ImportStream> ConfigDB::Format::createImportStream ( Database db) const
pure virtual

Create a stream for de-serialising (writing) into the database Used when updating a database from a remote web client, for example via HttpRequest.

Implemented in ConfigDB::Json::Format.

◆ createImportStream() [2/2]

virtual std::unique_ptr<ImportStream> ConfigDB::Format::createImportStream ( StoreUpdateRef store,
Object object 
) const
pure virtual

Create a stream for de-serialising (writing) into a store.

Parameters
storeShared pointer to store with write access
objectObject to start streaming to

Used when updating a store from a remote web client, for example via HttpRequest

Implemented in ConfigDB::Json::Format.

◆ exportToStream() [1/2]

virtual size_t ConfigDB::Format::exportToStream ( const Object object,
Print output,
const ExportOptions options = {} 
) const
pure virtual

Print object.

Parameters
objectThe object to serialize
outputWhere to write output
optionsAdvanced settings for adjusting output
Return values
size_tNumber of characters written

Implemented in ConfigDB::Json::Format.

◆ exportToStream() [2/2]

virtual size_t ConfigDB::Format::exportToStream ( Database database,
Print output,
const ExportOptions options = {} 
) const
pure virtual

Serialise entire database directly to an output stream.

Parameters
databaseThe database to serialize
outputWhere to write output
optionsAdvanced settings for adjusting output
Return values
size_tNumber of bytes written to the stream

Implemented in ConfigDB::Json::Format.

◆ getFileExtension()

virtual String ConfigDB::Format::getFileExtension ( ) const
pure virtual

Get the standard file extension for the reader implementation.

Implemented in ConfigDB::Json::Format.

◆ getMimeType()

virtual MimeType ConfigDB::Format::getMimeType ( ) const
pure virtual

Get the MIME type for this reader format.

Implemented in ConfigDB::Json::Format.

◆ importFromStream() [1/2]

virtual Status ConfigDB::Format::importFromStream ( Database database,
Stream source 
) const
pure virtual

De-serialise content from stream into database Each store is overwritten as it is loadded. If a store entry is not represented in the data then it is left untouched.

Implemented in ConfigDB::Json::Format.

◆ importFromStream() [2/2]

virtual Status ConfigDB::Format::importFromStream ( Object object,
Stream source 
) const
pure virtual

De-serialise content from stream into object (RAM)

Implemented in ConfigDB::Json::Format.


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