RDKit
Open-source cheminformatics and machine learning.
FeatureParser.h
Go to the documentation of this file.
1 //
2 // Copyright (C) 2004-2006 Rational Discovery LLC
3 //
4 // @@ All Rights Reserved @@
5 // This file is part of the RDKit.
6 // The contents are covered by the terms of the BSD license
7 // which is included in the file license.txt, found at the root
8 // of the RDKit source tree.
9 //
10 #include <RDGeneral/export.h>
11 #ifndef __FEATUREPARSER_H_02122004_1810__
12 #define __FEATUREPARSER_H_02122004_1810__
13 
14 #include <iostream>
15 #include <string>
16 #include <map>
17 #include "MolChemicalFeatureDef.h"
18 
19 namespace RDKit {
20 //! \brief class used to indicate errors in parsing feature definition
21 //! files.
23  public:
24  FeatureFileParseException(unsigned int lineNo, std::string line,
25  std::string msg)
26  : d_lineNo(lineNo), d_line(line), d_msg(msg){};
27  unsigned int lineNo() const { return d_lineNo; };
28  std::string line() const { return d_line; };
29  std::string message() const { return d_msg; };
31 
32  private:
33  unsigned int d_lineNo;
34  std::string d_line, d_msg;
35 };
36 
37 RDKIT_MOLCHEMICALFEATURES_EXPORT int parseFeatureData(const std::string &defnText,
39 RDKIT_MOLCHEMICALFEATURES_EXPORT int parseFeatureData(std::istream &istream,
41 RDKIT_MOLCHEMICALFEATURES_EXPORT int parseFeatureFile(const std::string &fileName,
43 
44 namespace Local {
45 // these functions are exposed only so they can be tested
46 RDKIT_MOLCHEMICALFEATURES_EXPORT void parseAtomType(const std::string &inLine,
47  std::map<std::string, std::string> &atomTypeDefs,
48  const unsigned int &lineNo);
50  std::istream &inStream, const std::string &inLine, unsigned int &lineNo,
51  const std::map<std::string, std::string> &atomTypeDefs);
52 }
53 } // end of namespace RDKit
54 #endif
unsigned int lineNo() const
Definition: FeatureParser.h:27
RDKIT_MOLCHEMICALFEATURES_EXPORT int parseFeatureData(const std::string &defnText, MolChemicalFeatureDef::CollectionType &featDefs)
class used to indicate errors in parsing feature definition files.
Definition: FeatureParser.h:22
RDKIT_MOLCHEMICALFEATURES_EXPORT int parseFeatureFile(const std::string &fileName, MolChemicalFeatureDef::CollectionType &featDefs)
std::list< boost::shared_ptr< MolChemicalFeatureDef > > CollectionType
Std stuff.
Definition: Atom.h:30
static void parseAtomType(int val, int &atomic_num, bool &aromatic)
Definition: QueryOps.h:123
#define RDKIT_MOLCHEMICALFEATURES_EXPORT
Definition: export.h:372
RDKIT_MOLCHEMICALFEATURES_EXPORT MolChemicalFeatureDef * parseFeatureDef(std::istream &inStream, const std::string &inLine, unsigned int &lineNo, const std::map< std::string, std::string > &atomTypeDefs)
FeatureFileParseException(unsigned int lineNo, std::string line, std::string msg)
Definition: FeatureParser.h:24