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 <utility>
18 #include "MolChemicalFeatureDef.h"
19 
20 namespace RDKit {
21 //! \brief class used to indicate errors in parsing feature definition
22 //! files.
24  : public std::exception {
25  public:
26  FeatureFileParseException(unsigned int lineNo, std::string line,
27  std::string msg)
28  : d_lineNo(lineNo), d_line(std::move(line)), d_msg(std::move(msg)) {}
29  unsigned int lineNo() const { return d_lineNo; }
30  std::string line() const { return d_line; }
31  const char *what() const noexcept override { return d_msg.c_str(); }
32  ~FeatureFileParseException() noexcept override = default;
33 
34  private:
35  unsigned int d_lineNo;
36  std::string d_line, d_msg;
37 };
38 
40  const std::string &defnText,
41  MolChemicalFeatureDef::CollectionType &featDefs);
43  std::istream &istream, MolChemicalFeatureDef::CollectionType &featDefs);
45  const std::string &fileName,
46  MolChemicalFeatureDef::CollectionType &featDefs);
47 
48 namespace Local {
49 // these functions are exposed only so they can be tested
51  const std::string &inLine, std::map<std::string, std::string> &atomTypeDefs,
52  const unsigned int &lineNo);
54  std::istream &inStream, const std::string &inLine, unsigned int &lineNo,
55  const std::map<std::string, std::string> &atomTypeDefs);
56 } // namespace Local
57 } // end of namespace RDKit
58 #endif
class used to indicate errors in parsing feature definition files.
Definition: FeatureParser.h:24
const char * what() const noexcept override
Definition: FeatureParser.h:31
~FeatureFileParseException() noexcept override=default
FeatureFileParseException(unsigned int lineNo, std::string line, std::string msg)
Definition: FeatureParser.h:26
unsigned int lineNo() const
Definition: FeatureParser.h:29
#define RDKIT_MOLCHEMICALFEATURES_EXPORT
Definition: export.h:257
RDKIT_MOLCHEMICALFEATURES_EXPORT MolChemicalFeatureDef * parseFeatureDef(std::istream &inStream, const std::string &inLine, unsigned int &lineNo, const std::map< std::string, std::string > &atomTypeDefs)
Std stuff.
Definition: Abbreviations.h:18
RDKIT_MOLCHEMICALFEATURES_EXPORT int parseFeatureData(const std::string &defnText, MolChemicalFeatureDef::CollectionType &featDefs)
RDKIT_MOLCHEMICALFEATURES_EXPORT int parseFeatureFile(const std::string &fileName, MolChemicalFeatureDef::CollectionType &featDefs)
static void parseAtomType(int val, int &atomic_num, bool &aromatic)
Definition: QueryOps.h:135