Mapper  0.9.0
API documentation
Public Member Functions | Friends | List of all members
OpenOrienteering::ImportExport Class Reference

Abstract base class for both importer and exporters. More...

#include <file_import_export.h>

Inheritance diagram for OpenOrienteering::ImportExport:
Inheritance graph
[legend]

Public Member Functions

 ImportExport (QIODevice *device=nullptr)
 Creates a new importer or exporter with the given IO device. More...
 
 ImportExport (const ImportExport &)=delete
 
 ImportExport (ImportExport &&)=delete
 
virtual ~ImportExport ()
 Destroys an importer or exporter. More...
 
virtual bool supportsQIODevice () const noexcept
 Returns true when the importer/exporter supports QIODevice. More...
 
QIODevicedevice () const noexcept
 Returns the input device if it has been set or created. More...
 
void setDevice (QIODevice *device)
 Sets a custom input device to be used for import. More...
 
void setOption (const QString &name, const QVariant &value)
 Sets an option in this importer or exporter. More...
 
QVariant option (const QString &name) const
 Retrieves the value of an option in this instance. More...
 
void addWarning (const QString &str)
 Adds a string to the current list of warnings. More...
 
const std::vector< QString > & warnings () const noexcept
 Returns the current list of warnings collected by this object. More...
 

Friends

class Exporter
 
class Importer
 

Detailed Description

Abstract base class for both importer and exporters.

This class provides support for setting and retrieving options, for collecting a list of warnings, and for storing a final error message.

Subclass constructors need to define default values for options they use, by calling setOption().

Constructor & Destructor Documentation

◆ ImportExport() [1/3]

OpenOrienteering::ImportExport::ImportExport ( QIODevice device = nullptr)
inline

Creates a new importer or exporter with the given IO device.

◆ ImportExport() [2/3]

OpenOrienteering::ImportExport::ImportExport ( const ImportExport )
delete

◆ ImportExport() [3/3]

OpenOrienteering::ImportExport::ImportExport ( ImportExport &&  )
delete

◆ ~ImportExport()

OpenOrienteering::ImportExport::~ImportExport ( )
virtualdefault

Destroys an importer or exporter.

Member Function Documentation

◆ addWarning()

void OpenOrienteering::ImportExport::addWarning ( const QString str)
inline

Adds a string to the current list of warnings.

The provided message should be translated.

◆ device()

QIODevice* OpenOrienteering::ImportExport::device ( ) const
inlinenoexcept

Returns the input device if it has been set or created.

◆ option()

QVariant OpenOrienteering::ImportExport::option ( const QString name) const

Retrieves the value of an option in this instance.

The option's value must have been set before this function is called, either in the constructor, or later through setOption(). Otherwise a FormatException will be thrown.

◆ setDevice()

void OpenOrienteering::ImportExport::setDevice ( QIODevice device)

Sets a custom input device to be used for import.

Not all importers may be able to use such devices.

See also
ImportExport::supportQIODevice()

◆ setOption()

void OpenOrienteering::ImportExport::setOption ( const QString name,
const QVariant value 
)

Sets an option in this importer or exporter.

◆ supportsQIODevice()

bool OpenOrienteering::ImportExport::supportsQIODevice ( ) const
virtualnoexcept

Returns true when the importer/exporter supports QIODevice.

The default implementation returns true. Some exporters or importers might wish to use other ways of accessing the output/input path. In these cases, the default implementation should be overwritten to return false.

Reimplemented in OpenOrienteering::OgrFileExport, and OpenOrienteering::OgrFileImport.

◆ warnings()

const std::vector<QString>& OpenOrienteering::ImportExport::warnings ( ) const
inlinenoexcept

Returns the current list of warnings collected by this object.

Friends And Related Function Documentation

◆ Exporter

friend class Exporter
friend

◆ Importer

friend class Importer
friend

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