File indexing completed on 2024-03-24 03:44:18
0001 /* 0002 SPDX-FileCopyrightText: 2006 Carsten Niehaus <cniehaus@kde.org> 0003 SPDX-FileCopyrightText: 2007-2008 Marcus D. Hanwell <marcus@cryos.org> 0004 SPDX-FileCopyrightText: 2016 Andreas Cord-Landwehr <cordlandwehr@kde.org> 0005 SPDX-License-Identifier: GPL-2.0-or-later 0006 */ 0007 0008 #ifndef IOWRAPPER_H 0009 #define IOWRAPPER_H 0010 0011 #include <avogadro/io/fileformat.h> 0012 #include <avogadro/qtgui/molecule.h> 0013 0014 #include "compoundviewer_export.h" 0015 0016 #include <memory> 0017 0018 /** 0019 * @author Carsten Niehaus 0020 */ 0021 class COMPOUNDVIEWER_EXPORT IoWrapper 0022 { 0023 public: 0024 /** 0025 * This class reads the molecule in the file @p filename. It returns 0 if 0026 * the file couldn't be read. 0027 */ 0028 static std::unique_ptr<Avogadro::Core::Molecule> readMolecule(const QString &filename); 0029 0030 static bool writeMolecule(const QString &filename, Avogadro::Core::Molecule *); 0031 0032 static QString getFormula(Avogadro::QtGui::Molecule *molecule); 0033 0034 static QString getPrettyFormula(Avogadro::QtGui::Molecule *molecule); 0035 0036 private: 0037 /** 0038 * Get file format reader appropriate for the file format 0039 */ 0040 static std::unique_ptr<Avogadro::Io::FileFormat> getFileReader(const QString &format); 0041 }; 0042 0043 #endif