• Skip to content
  • Skip to link menu
KDE API Reference
  • KDE API Reference
  • kdeedu API Reference
  • KDE Home
  • Contact Us
 

kalzium/libscience

Public Member Functions | Protected Member Functions | List of all members
MoleculeParser Class Reference

#include <moleculeparser.h>

Inheritance diagram for MoleculeParser:
Inheritance graph
[legend]

Public Member Functions

 MoleculeParser (const QList< Element * > &list)
 
 MoleculeParser (const QString &_str)
 
virtual ~MoleculeParser ()
 
QSet< QString > aliasList ()
 
bool weight (const QString &_moleculeString, double *_resultMass, ElementCountMap *_resultMap)
 
- Public Member Functions inherited from Parser
 Parser ()
 
 Parser (const QString &_str)
 
virtual ~Parser ()
 
float floatVal () const
 
int intVal () const
 
int nextChar () const
 
int nextToken () const
 
void start (const QString &_str)
 

Protected Member Functions

virtual int getNextToken ()
 
- Protected Member Functions inherited from Parser
int getNextChar ()
 
int skipWhitespace ()
 

Additional Inherited Members

- Protected Attributes inherited from Parser
double m_floatVal
 
int m_intVal
 
int m_nextToken
 
- Static Protected Attributes inherited from Parser
static const int FLOAT_TOKEN = 258
 
static const int INT_TOKEN = 257
 

Detailed Description

Parse molecule formulas.

Usage:

MoleculeParser parser;
QString chemical_formula = "C2H5OH";
double weight;
if (parser.weight(chemical_formula, &weight))
cout << "Weight of " << chemical_formula << " = " << weight << ".\n";
else
cout << "Parse error\n";

If a short form of a compound is specified, it will be expanded. Example :- EtOH -> (C2H5OH)

MoleculeParser parser;
QString chemical_formula = "EtOH";
double weight;
if (parser.weight(chemical_formula, &weight))
cout << "Weight of " << chemical_formula << " = " << weight << ".\n";
else
cout << "Parse error\n";
Author
Inge Wallin
Kashyap R Puranik

Definition at line 182 of file moleculeparser.h.

Constructor & Destructor Documentation

MoleculeParser::MoleculeParser ( const QList< Element * > &  list)
Parameters
listThis list of chemical elements will be used internally for searching and matching with searched strings Constructor

Definition at line 100 of file moleculeparser.cpp.

MoleculeParser::MoleculeParser ( const QString &  _str)

Constructor.

Parameters
_strParser::start the parsing with _str

Definition at line 108 of file moleculeparser.cpp.

MoleculeParser::~MoleculeParser ( )
virtual

Destructor.

Definition at line 115 of file moleculeparser.cpp.

Member Function Documentation

QSet< QString > MoleculeParser::aliasList ( )

Definition at line 166 of file moleculeparser.cpp.

int MoleculeParser::getNextToken ( )
protectedvirtual

Extends the standard tokenizer in Parser::getNextToken().

Reimplemented from Parser.

Definition at line 263 of file moleculeparser.cpp.

bool MoleculeParser::weight ( const QString &  _moleculeString,
double *  _resultMass,
ElementCountMap *  _resultMap 
)

Try to parse the molecule molecule and get the weight of it.

The calculated weight is stored in _result.

Parameters
_moleculeString
_resultMass
_resultMap
Returns
whether the parsing was successful or not

Definition at line 130 of file moleculeparser.cpp.


The documentation for this class was generated from the following files:
  • moleculeparser.h
  • moleculeparser.cpp
This file is part of the KDE documentation.
Documentation copyright © 1996-2014 The KDE developers.
Generated on Tue Oct 14 2014 22:35:31 by doxygen 1.8.7 written by Dimitri van Heesch, © 1997-2006

KDE's Doxygen guidelines are available online.

kalzium/libscience

Skip menu "kalzium/libscience"
  • Main Page
  • Alphabetical List
  • Class List
  • Class Hierarchy
  • Class Members
  • File List
  • File Members

kdeedu API Reference

Skip menu "kdeedu API Reference"
  • Analitza
  •     lib
  • kalgebra
  • kalzium
  •   libscience
  • kanagram
  • kig
  •   lib
  • klettres
  • kstars
  • libkdeedu
  •   keduvocdocument
  • marble
  • parley
  • rocs
  •   App
  •   RocsCore
  •   VisualEditor
  •   stepcore

Search



Report problems with this website to our bug tracking system.
Contact the specific authors with questions and comments about the page contents.

KDE® and the K Desktop Environment® logo are registered trademarks of KDE e.V. | Legal