-
-
Notifications
You must be signed in to change notification settings - Fork 181
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add a Chem MessagePack format as a subclass of CJSON
Signed-off-by: Geoff Hutchison <[email protected]>
- Loading branch information
Showing
5 changed files
with
98 additions
and
2 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,30 @@ | ||
/****************************************************************************** | ||
This source file is part of the Avogadro project. | ||
This source code is released under the 3-Clause BSD License, (see "LICENSE"). | ||
******************************************************************************/ | ||
|
||
#include "cmsgpackformat.h" | ||
|
||
using namespace std; | ||
|
||
namespace Avogadro::Io { | ||
|
||
CMsgPackFormat::CMsgPackFormat() = default; | ||
|
||
CMsgPackFormat::~CMsgPackFormat() = default; | ||
|
||
vector<std::string> CMsgPackFormat::fileExtensions() const | ||
{ | ||
vector<std::string> ext; | ||
ext.emplace_back("cmpk"); | ||
return ext; | ||
} | ||
|
||
vector<std::string> CMsgPackFormat::mimeTypes() const | ||
{ | ||
vector<std::string> mime; | ||
mime.emplace_back("chemical/x-cmpack"); | ||
return mime; | ||
} | ||
|
||
} // namespace Avogadro::Io |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,58 @@ | ||
/****************************************************************************** | ||
This source file is part of the Avogadro project. | ||
This source code is released under the 3-Clause BSD License, (see "LICENSE"). | ||
******************************************************************************/ | ||
|
||
#ifndef AVOGADRO_IO_CMSGPACKFORMAT_H | ||
#define AVOGADRO_IO_CMSGPACKFORMAT_H | ||
|
||
#include "fileformat.h" | ||
#include "cjsonformat.h" | ||
|
||
namespace Avogadro { | ||
namespace Core { | ||
class GaussianSet; | ||
} | ||
namespace Io { | ||
|
||
/** | ||
* @class CMsgPackFormat cmsgpackformat.h <avogadro/io/cmsgpackformat.h> | ||
* @brief Implementation of the Chemical MessagePack format. | ||
*/ | ||
|
||
class AVOGADROIO_EXPORT CMsgPackFormat : public CjsonFormat | ||
{ | ||
public: | ||
CMsgPackFormat(); | ||
~CMsgPackFormat() override; | ||
|
||
Operations supportedOperations() const override | ||
{ | ||
return ReadWrite | File | Stream | String; | ||
} | ||
|
||
FileFormat* newInstance() const override { return new CMsgPackFormat; } | ||
std::string identifier() const override { return "Avogadro: CMsgPack"; } | ||
std::string name() const override { return "Chemical MessagePack"; } | ||
std::string description() const override | ||
{ | ||
return "CMsgPack format is a lightweight intermediate format used to exchange " | ||
"information between Avogadro and other data parsing applications"; | ||
} | ||
|
||
std::string specificationUrl() const override | ||
{ | ||
return "https://github.com/openchemistry/chemicaljson"; | ||
} | ||
|
||
std::vector<std::string> fileExtensions() const override; | ||
std::vector<std::string> mimeTypes() const override; | ||
|
||
// write MessagePack | ||
bool m_json = false; | ||
}; | ||
|
||
} // end Io namespace | ||
} // end Avogadro namespace | ||
|
||
#endif // AVOGADRO_IO_CMSGPACKFORMAT_H |