RDKit: FeatureParser.h Source File

| RDKit Open-source cheminformatics and machine learning.

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