IOFormat 1.12.0
Loading...
Searching...
No Matches
ioformat::WriterPlugin Class Referenceabstract

Writer plugin interface. More...

#include <ioformat/plugin/WriterPlugin.h>

Inherits ioformat::FormatPlugin.

Public Member Functions

uint64_t api () const final override
 Get the API version of the plugin.
 
virtual std::shared_ptr< iolink::Writer > open (std::shared_ptr< iolink::View > src, const std::string &dst, const std::string &format, const OptionMap &options)=0
 Open a file for writing.
 
virtual std::shared_ptr< iolink::Writer > open (std::shared_ptr< iolink::View > src, std::shared_ptr< iolink::StreamAccess > dst, const std::string &format, const OptionMap &options)=0
 Open a stream for writing.
 
- Public Member Functions inherited from ioformat::FormatPlugin
virtual const StringSet & supportedFormats () const =0
 Get the formats supported by the plugin.
 
virtual const StringMap & extensionMap () const =0
 Retrieve a mapping that associates file extensions with formats.
 
- Public Member Functions inherited from ioformat::Plugin
virtual const std::string & name () const =0
 Get the name of the plugin.
 
virtual const PluginVersionversion () const =0
 Get the version of the plugin.
 
virtual void initLog (iolink::LogLevel level)=0
 Initialize the plugin's logger.
 

Static Public Attributes

static constexpr uint64_t PLUGIN_API_VERSION = 2
 The actual API version of that plugin.
 

Additional Inherited Members

- Public Types inherited from ioformat::Plugin
using StringSet = std::unordered_set< std::string >
 
using StringMap = std::unordered_map< std::string, std::string >
 

Detailed Description

Writer plugin interface.

To create a writer plugin used by ioformat to write formats, the plugin must implement this interface.

Member Function Documentation

◆ api()

uint64_t ioformat::WriterPlugin::api ( ) const
inlinefinaloverridevirtual

Get the API version of the plugin.

This is used internally to check compatibility between the plugin and the ioformat plugin loader.

Implements ioformat::Plugin.

◆ open() [1/2]

virtual std::shared_ptr< iolink::Writer > ioformat::WriterPlugin::open ( std::shared_ptr< iolink::View >  src,
const std::string &  dst,
const std::string &  format,
const OptionMap options 
)
pure virtual

Open a file for writing.

Parameters
srcThe source view to write.
dstThe destination file path.
formatThe format to write.
optionsThe options to use.
Returns
A writer instance.
Exceptions
InvalidArgumentIf the source view is not valid.
InvalidArgumentIf the destination is not supported.
UnsupportedFormatIf the format is not supported.
Errorif an internal error occurs.

◆ open() [2/2]

virtual std::shared_ptr< iolink::Writer > ioformat::WriterPlugin::open ( std::shared_ptr< iolink::View >  src,
std::shared_ptr< iolink::StreamAccess >  dst,
const std::string &  format,
const OptionMap options 
)
pure virtual

Open a stream for writing.

Parameters
srcThe source view to write.
dstThe destination stream.
formatThe format to write.
optionsThe options to use.
Returns
A writer instance.
Exceptions
InvalidArgumentIf the source view is not valid.
InvalidArgumentIf the destination is not supported.
UnsupportedFormatIf the format is not supported.
Errorif an internal error occurs.

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