OpenMS  2.7.0
Public Member Functions | List of all members
ParamXMLFile Class Reference

The file pendant of the Param class used to load and store the param datastructure as paramXML. More...

#include <OpenMS/FORMAT/ParamXMLFile.h>

Inheritance diagram for ParamXMLFile:
[legend]
Collaboration diagram for ParamXMLFile:
[legend]

Public Member Functions

 ParamXMLFile ()
 Constructor. More...
 
void store (const String &filename, const Param &param) const
 Write XML file. More...
 
void writeXMLToStream (std::ostream *os_ptr, const Param &param) const
 Write XML to output stream. More...
 
void load (const String &filename, Param &param)
 Read XML file. More...
 
- Public Member Functions inherited from XMLFile
 XMLFile ()
 Default constructor. More...
 
 XMLFile (const String &schema_location, const String &version)
 Constructor that sets the schema location. More...
 
virtual ~XMLFile ()
 Destructor. More...
 
bool isValid (const String &filename, std::ostream &os)
 Checks if a file validates against the XML schema. More...
 
const StringgetVersion () const
 return the version of the schema More...
 

Additional Inherited Members

- Protected Member Functions inherited from XMLFile
void parse_ (const String &filename, XMLHandler *handler)
 Parses the XML file given by filename using the handler given by handler. More...
 
void parseBuffer_ (const std::string &buffer, XMLHandler *handler)
 Parses the in-memory buffer given by buffer using the handler given by handler. More...
 
void save_ (const String &filename, XMLHandler *handler) const
 Stores the contents of the XML handler given by handler in the file given by filename. More...
 
void enforceEncoding_ (const String &encoding)
 
- Protected Attributes inherited from XMLFile
String schema_location_
 XML schema file location. More...
 
String schema_version_
 Version string. More...
 
String enforced_encoding_
 Encoding string that replaces the encoding (system dependent or specified in the XML). Disabled if empty. Used as a workaround for XTandem output xml. More...
 

Detailed Description

The file pendant of the Param class used to load and store the param datastructure as paramXML.

A documented schema for this format can be found at https://github.com/OpenMS/OpenMS/tree/develop/share/OpenMS/SCHEMAS

Constructor & Destructor Documentation

◆ ParamXMLFile()

Constructor.

Member Function Documentation

◆ load()

void load ( const String filename,
Param param 
)

Read XML file.

Parameters
filenameThe file from where to read the Param object.
paramThe param object where the read data should be stored.
Exceptions
Exception::FileNotFoundis thrown if the file could not be found
Exception::ParseErroris thrown if an error occurs during parsing

Referenced by TOPPASBase::loadPreferences(), TOPPViewBase::loadPreferences(), main(), INIFileEditorWindow::openFile(), and DigestionEnzymeDB< DigestionEnzymeType, InstanceType >::readEnzymesFromFile_().

◆ store()

void store ( const String filename,
const Param param 
) const

Write XML file.

Parameters
filenameThe filename where the param data structure should be stored.
paramThe Param class that should be stored in the file.
Exceptions
Exception::UnableToCreateFileis thrown if the file could not be created

Referenced by INIFileEditorWindow::saveFile(), INIFileEditorWindow::saveFileAs(), TOPPASBase::savePreferences(), and TOPPViewBase::savePreferences().

◆ writeXMLToStream()

void writeXMLToStream ( std::ostream *  os_ptr,
const Param param 
) const

Write XML to output stream.

Parameters
os_ptrThe stream where the param class should be written to.
paramThe Param class that should be written to the stream.