gcu::Formula Class Reference

#include <gcu/formula.h>

List of all members.

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 285 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

char const* gcu::Formula::GetMarkup (  ) 

Returns:
the original formula as a pango markup.

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.

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.

void gcu::Formula::Clear (  ) 

Clears all data.

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.

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.

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

Returns the parsed formula as a list of elements.

Definition at line 340 of file formula.h.

gcu::Formula::SetParseMode ( FormulaParseMode  ParseMode  )  [inline]

Parameters:
ParseMode the new FormulaParseMode.
Sets the way ambiguous symbols are interpreted.

Definition at line 368 of file formula.h.

gcu::Formula::GetParseMode ( void   )  const [inline]

Returns:
the current parse mode.

Definition at line 368 of file formula.h.

gcu::Formula::GetRefParseMode ( void   )  [inline]

Returns:
the current parse mode as a reference.

Definition at line 368 of file formula.h.


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

Generated on Sat Sep 13 18:32:55 2008 for The Gnome Chemistry Utils by  doxygen 1.5.6