| 1 |
/****************************************************************************** |
| 2 |
This source file is part of the Avogadro project. |
| 3 |
This source code is released under the 3-Clause BSD License, (see "LICENSE"). |
| 4 |
******************************************************************************/ |
| 5 |
|
| 6 |
#ifndef AVOGADRO_IO_MDLFORMAT_H |
| 7 |
#define AVOGADRO_IO_MDLFORMAT_H |
| 8 |
|
| 9 |
#include "fileformat.h" |
| 10 |
|
| 11 |
namespace Avogadro::Io { |
| 12 |
|
| 13 |
/** |
| 14 |
* @class MdlFormat mdlformat.h <avogadro/io/mdlformat.h> |
| 15 |
* @brief Implementation of the generic MDL format. |
| 16 |
* @author Marcus D. Hanwell |
| 17 |
* |
| 18 |
* Currently just supports V2000 of the format. |
| 19 |
*/ |
| 20 |
|
| 21 |
class AVOGADROIO_EXPORT MdlFormat : public FileFormat |
| 22 |
{ |
| 23 |
public: |
| 24 |
MdlFormat() = default; |
| 25 |
~MdlFormat() override = default; |
| 26 |
|
| 27 |
Operations supportedOperations() const override |
| 28 |
{ |
| 29 |
return ReadWrite | MultiMolecule | File | Stream | String; |
| 30 |
} |
| 31 |
|
| 32 |
FileFormat* newInstance() const override { return new MdlFormat; } |
| 33 |
std::string identifier() const override { return "Avogadro: MDL"; } |
| 34 |
std::string name() const override { return "MDL"; } |
| 35 |
std::string description() const override |
| 36 |
{ |
| 37 |
return "Generic format that contains atoms, bonds, positions."; |
| 38 |
} |
| 39 |
|
| 40 |
std::string specificationUrl() const override |
| 41 |
{ |
| 42 |
return "https://web.archive.org/web/20210219065450/https://" |
| 43 |
"discover.3ds.com/sites/default/files/2020-08/" |
| 44 |
"biovia_ctfileformats_2020.pdf"; |
| 45 |
// http://help.accelrysonline.com/ulm/onelab/1.0/content/ulm_pdfs/direct/reference/ctfileformats2016.pdf |
| 46 |
/* for previous (2011) version, see: |
| 47 |
https://web.archive.org/web/20180329184712/http://download.accelrys.com/freeware/ctfile-formats/ctfile-formats.zip |
| 48 |
*/ |
| 49 |
} |
| 50 |
|
| 51 |
std::vector<std::string> fileExtensions() const override; |
| 52 |
std::vector<std::string> mimeTypes() const override; |
| 53 |
|
| 54 |
[[nodiscard]] bool read(std::istream& in, Core::Molecule& molecule) override; |
| 55 |
[[nodiscard]] bool readV3000(std::istream& in, Core::Molecule& molecule); |
| 56 |
[[nodiscard]] bool write(std::ostream& out, |
| 57 |
const Core::Molecule& molecule) override; |
| 58 |
[[nodiscard]] bool writeV3000(std::ostream& out, |
| 59 |
const Core::Molecule& molecule); |
| 60 |
|
| 61 |
protected: |
| 62 |
bool m_writeProperties = false; |
| 63 |
bool m_is2D = false; |
| 64 |
}; |
| 65 |
|
| 66 |
} // namespace Avogadro::Io |
| 67 |
|
| 68 |
#endif // AVOGADRO_IO_MDLFORMAT_H |