The Gnome Chemistry Utils  0.14.0
Public Member Functions | List of all members
gcu::Formula Class Reference

#include <gcu/formula.h>

Public Member Functions

 Formula (std::string entry, FormulaParseMode mode=GCU_FORMULA_PARSE_GUESS) throw (parse_error)
virtual ~Formula ()
char const * GetMarkup ()
std::map< int, int > & GetRawFormula ()
char const * GetRawMarkup ()
void SetFormula (std::string entry) throw (parse_error)
void Clear ()
DimensionalValue GetMolecularWeight (bool &artificial)
void CalculateIsotopicPattern (IsotopicPattern &pattern)
std::list< FormulaElt * > const & GetElements () const
void SetParseMode (FormulaParseMode val)
FormulaParseMode GetParseMode (void) const
FormulaParseModeGetRefParseMode (void)

Detailed Description

This class interprets a chemical formula provided as a string and make some calculations using it. Currently, it is able to calculate the raw formula, the molecular weight and the isotopic pattern.

Definition at line 288 of file formula.h.

Constructor & Destructor Documentation

gcu::Formula::Formula ( std::string  entry,
FormulaParseMode  mode = GCU_FORMULA_PARSE_GUESS 
) throw (parse_error)
Parameters
entry,:the formula to parse as a string.
mode,:the way ambiguous symbols shoud be interpreted. The constructor will emit a parse_error exception. if it cannot parse the given formula.
virtual gcu::Formula::~Formula ( )
virtual

The destructor.

Member Function Documentation

void gcu::Formula::CalculateIsotopicPattern ( IsotopicPattern pattern)
Parameters
pattern,:the IsotopicPattern to be filled This method evaluates the isotopic pattern and fills the pattern parameter with the calculated data.
void gcu::Formula::Clear ( )

Clears all data.

std::list<FormulaElt *> const& gcu::Formula::GetElements ( ) const
inline

Returns the parsed formula as a list of elements.

Definition at line 343 of file formula.h.

char const* gcu::Formula::GetMarkup ( )
Returns
the original formula as a pango markup.
DimensionalValue gcu::Formula::GetMolecularWeight ( bool &  artificial)
Parameters
artificial,:will be true if the formula contains an artificial element (with no natural isotope).
Returns
the molecular weight corresponding to the formula.
gcu::Formula::GetParseMode ( void  ) const
inline
Returns
the current parse mode.

Definition at line 371 of file formula.h.

std::map<int,int>& gcu::Formula::GetRawFormula ( )
Returns
the raw formula as a map of atoms numbers indexed by atomic number Z.
char const* gcu::Formula::GetRawMarkup ( )
Returns
the raw formula as a pango markup.
gcu::Formula::GetRefParseMode ( void  )
inline
Returns
the current parse mode as a reference.

Definition at line 371 of file formula.h.

void gcu::Formula::SetFormula ( std::string  entry) throw (parse_error)
Parameters
entry,:the formula to parse as a string. Calls Formula::Clear before parsing the new formula. The method will emit a parse_error exception if it cannot parse the given formula.
gcu::Formula::SetParseMode ( FormulaParseMode  ParseMode)
inline
Parameters
ParseModethe new FormulaParseMode.

Sets the way ambiguous symbols are interpreted.

Definition at line 371 of file formula.h.


The documentation for this class was generated from the following file: