| 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_CMSGPACKFORMAT_H |
| 7 |
#define AVOGADRO_IO_CMSGPACKFORMAT_H |
| 8 |
|
| 9 |
#include "cjsonformat.h" |
| 10 |
#include "fileformat.h" |
| 11 |
|
| 12 |
namespace Avogadro { |
| 13 |
namespace Core { |
| 14 |
class GaussianSet; |
| 15 |
} |
| 16 |
namespace Io { |
| 17 |
|
| 18 |
/** |
| 19 |
* @class CMsgPackFormat cmsgpackformat.h <avogadro/io/cmsgpackformat.h> |
| 20 |
* @brief Implementation of the Chemical MessagePack format. |
| 21 |
*/ |
| 22 |
|
| 23 |
class AVOGADROIO_EXPORT CMsgPackFormat : public CjsonFormat |
| 24 |
{ |
| 25 |
public: |
| 26 |
// Base class constructors are called automatically |
| 27 |
CMsgPackFormat() = default; |
| 28 |
~CMsgPackFormat() override = default; |
| 29 |
|
| 30 |
Operations supportedOperations() const override |
| 31 |
{ |
| 32 |
return ReadWrite | File | Stream | String; |
| 33 |
} |
| 34 |
|
| 35 |
FileFormat* newInstance() const override { return new CMsgPackFormat; } |
| 36 |
std::string identifier() const override { return "Avogadro: CMsgPack"; } |
| 37 |
std::string name() const override { return "Chemical MessagePack"; } |
| 38 |
std::string description() const override |
| 39 |
{ |
| 40 |
return "CMsgPack format is a lightweight intermediate format used to " |
| 41 |
"exchange " |
| 42 |
"information between Avogadro and other data parsing applications"; |
| 43 |
} |
| 44 |
|
| 45 |
std::string specificationUrl() const override |
| 46 |
{ |
| 47 |
return "https://github.com/openchemistry/chemicaljson"; |
| 48 |
} |
| 49 |
|
| 50 |
std::vector<std::string> fileExtensions() const override; |
| 51 |
std::vector<std::string> mimeTypes() const override; |
| 52 |
|
| 53 |
[[nodiscard]] bool read(std::istream& in, Core::Molecule& molecule) override; |
| 54 |
[[nodiscard]] bool write(std::ostream& out, |
| 55 |
const Core::Molecule& molecule) override; |
| 56 |
|
| 57 |
// write MessagePack |
| 58 |
bool m_json = false; |
| 59 |
}; |
| 60 |
|
| 61 |
} // namespace Io |
| 62 |
} // namespace Avogadro |
| 63 |
|
| 64 |
#endif // AVOGADRO_IO_CMSGPACKFORMAT_H |