OpenStructure
Public Member Functions
ChemdictParser Class Reference

#include <chemdict_parser.hh>

Inherits StarParser, and StarParser.

Public Member Functions

 ChemdictParser (std::istream &stream, conop::Compound::Dialect dialect, bool ignore_reserved=false, bool ignore_obsolete=false)
 
virtual bool OnBeginData (const StringRef &data_name)
 
virtual bool OnBeginLoop (const StarLoopDesc &header)
 
virtual void OnDataRow (const StarLoopDesc &header, const std::vector< StringRef > &columns)
 
virtual void OnDataItem (const StarDataItem &item)
 
virtual void OnEndData ()
 
void SetCompoundLib (const conop::CompoundLibPtr &lib)
 
 ChemdictParser (std::istream &stream, conop::Compound::Dialect dialect, bool ignore_reserved=false, bool ignore_obsolete=false)
 
virtual bool OnBeginData (const StringRef &data_name)
 
virtual bool OnBeginLoop (const StarLoopDesc &header)
 
virtual void OnDataRow (const StarLoopDesc &header, const std::vector< StringRef > &columns)
 
virtual void OnDataItem (const StarDataItem &item)
 
virtual void OnEndData ()
 
void SetCompoundLib (const conop::CompoundLibPtr &lib)
 
- Public Member Functions inherited from StarParser
 StarParser (std::istream &stream, bool items_as_row=false)
 
 StarParser (const String &filename, bool items_as_row=false)
 
virtual ~StarParser ()
 
virtual void OnEndLoop ()
 
Real TryGetReal (const StringRef &data, const String &name) const
 
Real GetRealOrDefault (const StringRef &data, const String &name, Real alt, bool(*is_default)(StringRef)) const
 
float TryGetFloat (const StringRef &data, const String &name) const
 
std::pair< bool, float > TryGetFloat (const StringRef &data, const String &name, bool may_fail) const
 
int TryGetInt (const StringRef &data, const String &name) const
 
std::pair< bool, int > TryGetInt (const StringRef &data, const String &name, bool may_fail) const
 
bool TryGetBool (const StringRef &data, const String &name) const
 
String FormatDiagnostic (StarDiagType type, const String &message, int line=-1) const
 
void SetFilename (const String &filename)
 
int GetCurrentLinenum () const
 
void Parse ()
 
 StarParser (std::istream &stream, bool items_as_row=false)
 
 StarParser (const String &filename, bool items_as_row=false)
 
virtual ~StarParser ()
 
virtual void OnEndLoop ()
 
Real TryGetReal (const StringRef &data, const String &name) const
 
Real GetRealOrDefault (const StringRef &data, const String &name, Real alt, bool(*is_default)(StringRef)) const
 
float TryGetFloat (const StringRef &data, const String &name) const
 
std::pair< bool, float > TryGetFloat (const StringRef &data, const String &name, bool may_fail) const
 
int TryGetInt (const StringRef &data, const String &name) const
 
std::pair< bool, int > TryGetInt (const StringRef &data, const String &name, bool may_fail) const
 
bool TryGetBool (const StringRef &data, const String &name) const
 
String FormatDiagnostic (StarDiagType type, const String &message, int line=-1) const
 
void SetFilename (const String &filename)
 
int GetCurrentLinenum () const
 
void Parse ()
 

Additional Inherited Members

- Static Public Member Functions inherited from StarParser
static bool SplitLine (const StringRef &line, std::vector< StringRef > &parts, bool clear=true)
 
static bool SplitLine (const StringRef &line, std::vector< StringRef > &parts, bool clear=true)
 

Detailed Description

Definition at line 41 of file chemdict_parser.hh.

Constructor & Destructor Documentation

◆ ChemdictParser() [1/2]

ChemdictParser ( std::istream &  stream,
conop::Compound::Dialect  dialect,
bool  ignore_reserved = false,
bool  ignore_obsolete = false 
)
inline

Definition at line 43 of file chemdict_parser.hh.

◆ ChemdictParser() [2/2]

ChemdictParser ( std::istream &  stream,
conop::Compound::Dialect  dialect,
bool  ignore_reserved = false,
bool  ignore_obsolete = false 
)
inline

Definition at line 43 of file chemdict_parser.hh.

Member Function Documentation

◆ OnBeginData() [1/2]

virtual bool OnBeginData ( const StringRef data_name)
virtual

invoked when a new data control structure is encountered

Returns
When true, for each data-item belonging to the data block, OnDataItem() is invoked. For every loop, OnBeginLoop() is called.

Reimplemented from StarParser.

◆ OnBeginData() [2/2]

virtual bool OnBeginData ( const StringRef data_name)
virtual

invoked when a new data control structure is encountered

Returns
When true, for each data-item belonging to the data block, OnDataItem() is invoked. For every loop, OnBeginLoop() is called.

Reimplemented from StarParser.

◆ OnBeginLoop() [1/2]

virtual bool OnBeginLoop ( const StarLoopDesc header)
virtual

called when a loop is encountered

Returns
When true, for each row in the loop, OnDataRow() is returned. If false, the loop is skipped.

Reimplemented from StarParser.

◆ OnBeginLoop() [2/2]

virtual bool OnBeginLoop ( const StarLoopDesc header)
virtual

called when a loop is encountered

Returns
When true, for each row in the loop, OnDataRow() is returned. If false, the loop is skipped.

Reimplemented from StarParser.

◆ OnDataItem() [1/2]

virtual void OnDataItem ( const StarDataItem item)
virtual

invoked when a data item is encountered

Reimplemented from StarParser.

◆ OnDataItem() [2/2]

virtual void OnDataItem ( const StarDataItem item)
virtual

invoked when a data item is encountered

Reimplemented from StarParser.

◆ OnDataRow() [1/2]

virtual void OnDataRow ( const StarLoopDesc header,
const std::vector< StringRef > &  columns 
)
virtual

invoked when a data row in a loop is encountered.

Parameters
headerdescribes the row format
columnscontains the data columns

Reimplemented from StarParser.

◆ OnDataRow() [2/2]

virtual void OnDataRow ( const StarLoopDesc header,
const std::vector< StringRef > &  columns 
)
virtual

invoked when a data row in a loop is encountered.

Parameters
headerdescribes the row format
columnscontains the data columns

Reimplemented from StarParser.

◆ OnEndData() [1/2]

virtual void OnEndData ( )
virtual

called when leaving a datasection. Will only be invoked when OnBeginData() returned true.

Reimplemented from StarParser.

◆ OnEndData() [2/2]

virtual void OnEndData ( )
virtual

called when leaving a datasection. Will only be invoked when OnBeginData() returned true.

Reimplemented from StarParser.

◆ SetCompoundLib() [1/2]

void SetCompoundLib ( const conop::CompoundLibPtr lib)
inline

Definition at line 64 of file chemdict_parser.hh.

◆ SetCompoundLib() [2/2]

void SetCompoundLib ( const conop::CompoundLibPtr lib)
inline

Definition at line 64 of file chemdict_parser.hh.


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