libXpertMass Developer Documentation
  • libXpertMass
  • IsotopicDataUserConfigHandler
  • IsotopicDataUserConfigHandler Class

    class MsXpS::libXpertMass::IsotopicDataUserConfigHandler

    The IsotopicDataUserConfigHandler class handles user-defined IsotopicData. More...

    Header: #include <IsotopicDataUserConfigHandler.hpp>
    Inherits: MsXpS::libXpertMass::IsotopicDataBaseHandler

    Public Functions

    IsotopicDataUserConfigHandler(const QString &file_name = QString())
    IsotopicDataUserConfigHandler(IsotopicDataSPtr isotopic_data_sp, const QString &file_name = QString())
    virtual ~IsotopicDataUserConfigHandler()

    Reimplemented Public Functions

    virtual std::size_t loadData(const QString &file_name) override
    virtual std::size_t writeData(const QString &file_name = QString()) override

    Detailed Description

    The data can be loaded and written to file. The format of the data is based on the Isotope::toString() implementation that outputs each Isotope's data in a separate line.

    Comments are allowed and are on lines that start with the '#' character. These lines are ignored when loading data.

    See also IsotopicDataLibraryHandler, IsotopicDataManualConfigHandler, and Isotope::toString().

    Member Function Documentation

    IsotopicDataUserConfigHandler::IsotopicDataUserConfigHandler(const QString &file_name = QString())

    Constructs the IsotopicDataUserConfigHandler.

    m_fileName is set to file_name

    IsotopicDataUserConfigHandler::IsotopicDataUserConfigHandler(IsotopicDataSPtr isotopic_data_sp, const QString &file_name = QString())

    Constructs the IsotopicDataUserConfigHandler.

    The instance will have its isotopic data member pointing to isotopic_data_sp.

    m_fileName is set to file_name

    [virtual noexcept] IsotopicDataUserConfigHandler::~IsotopicDataUserConfigHandler()

    Destructs the IsotopicDataUserConfigHandler.

    Nothing is explicitely deleted in the destructor.

    [override virtual] std::size_t IsotopicDataUserConfigHandler::loadData(const QString &file_name)

    Loads isotopic data from file_name.

    The format of the file consists in a single line of data per Isotope as created using the Isotope::toString() function. Each line is used to create an Isotope with the text-based constructor.

    Returns the count of Isotopes created or 0 if the file does not exist or is not readable.

    See also Isotope::Isotope(const QString &text).

    [override virtual] std::size_t IsotopicDataUserConfigHandler::writeData(const QString &file_name = QString())

    Writes isotopic data to file_name.

    If file_name is empty, m_fileName is tried. If both are empty, the function returns 0. If any one of the file names are correct (file_name takes precedence over m_fileName), then m_fileName is set to that file name.

    The format of the file consists in a single line of data per Isotope as created using the Isotope::toString() function. Each isotope is output to its own line.

    Returns the count of Isotopes written to file or 0 if the file does not exist or is not readable.

    See also Isotope::Isotope(const QString &text).