Chemical Data Processing Library C++ API - Version 1.2.0
|
Provides meta-information about a particular data storage format. More...
#include <DataFormat.hpp>
Public Types | |
typedef FileExtensionList::const_iterator | ConstFileExtensionIterator |
A constant random access iterator used to iterate over the list of file extensions. More... | |
typedef FileExtensionList::iterator | FileExtensionIterator |
A mutable random access iterator used to iterate over the list of file extensions. More... | |
Public Member Functions | |
template<typename Iter > | |
DataFormat (const std::string &name, const std::string &descr, const std::string &mime_type, Iter file_ext_begin, Iter file_ext_end, bool multi_rec) | |
Constructs and initializes a DataFormat object with the given attributes. More... | |
DataFormat () | |
Default constructor. More... | |
const std::string & | getDescription () const |
Returns the description of the data format. More... | |
void | setDescription (const std::string &descr) |
Sets the description of the data format. More... | |
const std::string & | getName () const |
Returns the short-name of the data format. More... | |
void | setName (const std::string &name) |
Sets the short-name of the data format. More... | |
const std::string & | getMimeType () const |
Returns the mime-type of the data format. More... | |
void | setMimeType (const std::string &mime_type) |
Sets the mime-type of the data format. More... | |
std::size_t | getNumFileExtensions () const |
Returns the number of registered file extensions. More... | |
ConstFileExtensionIterator | getFileExtensionsBegin () const |
Returns a constant iterator pointing to the beginning of the file extension list. More... | |
ConstFileExtensionIterator | getFileExtensionsEnd () const |
Returns a constant iterator pointing to the end of the file extension list. More... | |
FileExtensionIterator | getFileExtensionsBegin () |
Returns a mutable iterator pointing to the beginning of the file extension list. More... | |
FileExtensionIterator | getFileExtensionsEnd () |
Returns a mutable iterator pointing to the end of the file extension list. More... | |
ConstFileExtensionIterator | begin () const |
Returns a constant iterator pointing to the beginning of the file extension list. More... | |
ConstFileExtensionIterator | end () const |
Returns a constant iterator pointing to the end of the file extension list. More... | |
FileExtensionIterator | begin () |
Returns a mutable iterator pointing to the beginning of the file extension list. More... | |
FileExtensionIterator | end () |
Returns a mutable iterator pointing to the end of the file extension list. More... | |
DataFormat & | addFileExtension (const std::string &file_ext) |
Adds file_ext to the current list of file extensions. More... | |
const std::string & | getFileExtension (std::size_t idx) const |
Returns the file extension list entry at index idx. More... | |
void | setFileExtension (std::size_t idx, const std::string &file_ext) |
Sets the file extension list entry at index idx to file_ext. More... | |
void | removeFileExtension (std::size_t idx) |
Removes the file extension list entry at index idx. More... | |
FileExtensionIterator | removeFileExtension (const FileExtensionIterator &it) |
Removes the file extension list entry pointed to by the iterator it. More... | |
void | clearFileExtensions () |
Clears the file extension list. More... | |
bool | isMultiRecordFormat () const |
Tells whether or not the data format supports the storage of multiple data records. More... | |
void | setMultiRecordFormat (bool multi_rec) |
Specifies whether or not the data format supports the storage of multiple data records. More... | |
bool | matchesName (const std::string &name) const |
Tells whether the name of this data format matches the name specified by name. More... | |
bool | matchesMimeType (const std::string &mime_type) const |
Tells whether the mime-type of this data format matches the mime-type specified by mime_type. More... | |
bool | matchesFileExtension (const std::string &file_ext) const |
Tells whether file_ext is contained in the list of file extensions. More... | |
bool | operator== (const DataFormat &fmt) const |
Equality comparison operator. More... | |
bool | operator!= (const DataFormat &fmt) const |
Inequality comparison operator. More... | |
Provides meta-information about a particular data storage format.
typedef FileExtensionList::const_iterator CDPL::Base::DataFormat::ConstFileExtensionIterator |
A constant random access iterator used to iterate over the list of file extensions.
typedef FileExtensionList::iterator CDPL::Base::DataFormat::FileExtensionIterator |
A mutable random access iterator used to iterate over the list of file extensions.
|
inline |
Constructs and initializes a DataFormat
object with the given attributes.
name | The short-name of the data format, e.g. "PNG". |
descr | A string providing a brief human readable description of the data format, e.g. "Portable Network Graphics". |
mime_type | The mime-type associated with the data format (e.g. "image/png"), or an empty string if the mime-type is not available. |
file_ext_begin | An iterator pointing to the beginning of the file extension list. |
file_ext_end | An iterator pointing to the end of the file extension list. |
multi_rec | true if the data format supports the storage of multiple data records, and false otherwise. |
|
inline |
Default constructor.
All string attributes are initialized to an empty string, and the multi record format flag is set to false
.
const std::string& CDPL::Base::DataFormat::getDescription | ( | ) | const |
Returns the description of the data format.
void CDPL::Base::DataFormat::setDescription | ( | const std::string & | descr | ) |
Sets the description of the data format.
descr | The data format description. |
const std::string& CDPL::Base::DataFormat::getName | ( | ) | const |
Returns the short-name of the data format.
void CDPL::Base::DataFormat::setName | ( | const std::string & | name | ) |
Sets the short-name of the data format.
name | The short-name of the data format. |
const std::string& CDPL::Base::DataFormat::getMimeType | ( | ) | const |
Returns the mime-type of the data format.
void CDPL::Base::DataFormat::setMimeType | ( | const std::string & | mime_type | ) |
Sets the mime-type of the data format.
mime_type | The mime-type of the data format. |
std::size_t CDPL::Base::DataFormat::getNumFileExtensions | ( | ) | const |
Returns the number of registered file extensions.
ConstFileExtensionIterator CDPL::Base::DataFormat::getFileExtensionsBegin | ( | ) | const |
Returns a constant iterator pointing to the beginning of the file extension list.
ConstFileExtensionIterator CDPL::Base::DataFormat::getFileExtensionsEnd | ( | ) | const |
Returns a constant iterator pointing to the end of the file extension list.
FileExtensionIterator CDPL::Base::DataFormat::getFileExtensionsBegin | ( | ) |
Returns a mutable iterator pointing to the beginning of the file extension list.
FileExtensionIterator CDPL::Base::DataFormat::getFileExtensionsEnd | ( | ) |
Returns a mutable iterator pointing to the end of the file extension list.
ConstFileExtensionIterator CDPL::Base::DataFormat::begin | ( | ) | const |
Returns a constant iterator pointing to the beginning of the file extension list.
ConstFileExtensionIterator CDPL::Base::DataFormat::end | ( | ) | const |
Returns a constant iterator pointing to the end of the file extension list.
FileExtensionIterator CDPL::Base::DataFormat::begin | ( | ) |
Returns a mutable iterator pointing to the beginning of the file extension list.
FileExtensionIterator CDPL::Base::DataFormat::end | ( | ) |
Returns a mutable iterator pointing to the end of the file extension list.
DataFormat& CDPL::Base::DataFormat::addFileExtension | ( | const std::string & | file_ext | ) |
Adds file_ext to the current list of file extensions.
file_ext | The file extension to add. |
const std::string& CDPL::Base::DataFormat::getFileExtension | ( | std::size_t | idx | ) | const |
Returns the file extension list entry at index idx.
idx | The zero-based index of the requested file extension list entry. |
Base::IndexError | if idx is out of bounds. |
void CDPL::Base::DataFormat::setFileExtension | ( | std::size_t | idx, |
const std::string & | file_ext | ||
) |
Sets the file extension list entry at index idx to file_ext.
idx | The zero-based index of the file extension list entry to set. |
file_ext | The new file extension list entry. |
Base::IndexError | if idx is out of bounds. |
void CDPL::Base::DataFormat::removeFileExtension | ( | std::size_t | idx | ) |
Removes the file extension list entry at index idx.
idx | The zero-based index of the file extension list entry to remove. |
Base::IndexError | if idx is out of bounds. |
FileExtensionIterator CDPL::Base::DataFormat::removeFileExtension | ( | const FileExtensionIterator & | it | ) |
Removes the file extension list entry pointed to by the iterator it.
it | An iterator pointing to the extension list entry to remove. |
Base::RangeError | if it is not in the range [getFileExtensionsBegin(), getFileExtensionsEnd() - 1]. |
void CDPL::Base::DataFormat::clearFileExtensions | ( | ) |
Clears the file extension list.
bool CDPL::Base::DataFormat::isMultiRecordFormat | ( | ) | const |
Tells whether or not the data format supports the storage of multiple data records.
true
if the data format supports the storage of multiple data records, and false
otherwise. void CDPL::Base::DataFormat::setMultiRecordFormat | ( | bool | multi_rec | ) |
Specifies whether or not the data format supports the storage of multiple data records.
multi_rec | true if the data format supports the storage of multiple data records, and false otherwise. |
bool CDPL::Base::DataFormat::matchesName | ( | const std::string & | name | ) | const |
Tells whether the name of this data format matches the name specified by name.
name | The name to match. |
true
if the name of the data format matches the argument, and false
otherwise. bool CDPL::Base::DataFormat::matchesMimeType | ( | const std::string & | mime_type | ) | const |
Tells whether the mime-type of this data format matches the mime-type specified by mime_type.
mime_type | The mime-type to match. |
true
if the mime-type of the data format matches the argument, and false
otherwise. bool CDPL::Base::DataFormat::matchesFileExtension | ( | const std::string & | file_ext | ) | const |
Tells whether file_ext is contained in the list of file extensions.
file_ext | The file extension to search for. |
true
if file_ext is contained in the list of file extensions, and false
otherwise. bool CDPL::Base::DataFormat::operator== | ( | const DataFormat & | fmt | ) | const |
Equality comparison operator.
fmt | The other DataFormat object to be compared with. |
true
if the names and mime-types compare equal (case-insensitive!), and false
otherwise. bool CDPL::Base::DataFormat::operator!= | ( | const DataFormat & | fmt | ) | const |
Inequality comparison operator.
The result is equivalent to !(*this == fmt)
.
fmt | The other DataFormat object to be compared with. |
true
if the names and/or mime-types compare non-equal (case-insensitive!), and false
otherwise.