RDKit
Open-source cheminformatics and machine learning.
MolSGroupParsing.h
Go to the documentation of this file.
1 //
2 // Copyright (C) 2002-2018 Greg Landrum and T5 Informatics GmbH
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 
12 #pragma once
14 #include <sstream>
15 
16 namespace RDKit {
17 
18 namespace SGroupParsing {
19 typedef std::map<int, SubstanceGroup> IDX_TO_SGROUP_MAP;
20 typedef std::map<int, STR_VECT> IDX_TO_STR_VECT_MAP;
21 
22 /* ------------------ V2000 Utils ------------------ */
23 
24 unsigned int ParseSGroupIntField(const std::string &text, unsigned int line,
25  unsigned int &pos,
26  bool isFieldCounter = false);
27 
28 double ParseSGroupDoubleField(const std::string &text, unsigned int line,
29  unsigned int &pos);
30 
32  const std::string &text, unsigned int line);
33 
35  const std::string &text, unsigned int line);
36 
38  const std::string &text, unsigned int line);
39 
41  const std::string &text, unsigned int line);
42 
44  const std::string &text, unsigned int line);
45 
47  const std::string &text, unsigned int line);
48 
50  const std::string &text, unsigned int line);
51 
53  const std::string &text, unsigned int line);
55  const std::string &text, unsigned int line);
56 
58  const std::string &text, unsigned int line);
59 
61  const std::string &text, unsigned int line);
62 
64  IDX_TO_STR_VECT_MAP &dataFieldsMap, RWMol *mol,
65  const std::string &text, unsigned int line,
66  bool strictParsing, unsigned int &counter,
67  unsigned int &lastDataSGroup,
68  std::ostringstream &currentDataField);
69 
71  const std::string &text, unsigned int line);
72 
74  const std::string &text, unsigned int line);
75 
77  const std::string &text, unsigned int line);
78 
80  const std::string &text, unsigned int line);
81 
83  const std::string &text, unsigned int line);
84 
85 /* ------------------ V3000 Utils ------------------ */
86 
87 template <class T>
88 std::vector<T> ParseV3000Array(std::stringstream &stream);
89 #if defined(WIN32) && defined(RDKIT_DYN_LINK)
90 template RDKIT_FILEPARSERS_EXPORT std::vector<int> ParseV3000Array(
91  std::stringstream &);
92 template RDKIT_FILEPARSERS_EXPORT std::vector<unsigned int> ParseV3000Array(
93  std::stringstream &);
94 #endif
95 template <class T>
96 std::vector<T> ParseV3000Array(const std::string &s) {
97  std::stringstream stream(s);
98  return ParseV3000Array<T>(stream);
99 }
100 
101 void ParseV3000CStateLabel(unsigned int line, const std::string &type,
102  SubstanceGroup *sgroup, std::stringstream &stream);
103 
105  std::stringstream &stream);
106 
107 std::string ParseV3000StringPropLabel(std::stringstream &stream);
108 
109 void ParseV3000SGroupsBlock(std::istream *inStream, unsigned int &line,
110  unsigned int nSgroups, RWMol *mol,
111  bool &strictParsing);
112 
113 } // namespace SGroupParsing
114 } // namespace RDKit
Defines the SubstanceGroup class.
RWMol is a molecule class that is intended to be edited.
Definition: RWMol.h:31
The class for representing SubstanceGroups.
#define RDKIT_FILEPARSERS_EXPORT
Definition: export.h:255
void ParseSGroupV2000SMTLine(IDX_TO_SGROUP_MAP &sGroupMap, RWMol *mol, const std::string &text, unsigned int line)
void ParseV3000CStateLabel(unsigned int line, const std::string &type, SubstanceGroup *sgroup, std::stringstream &stream)
unsigned int ParseSGroupIntField(const std::string &text, unsigned int line, unsigned int &pos, bool isFieldCounter=false)
void ParseSGroupV2000SBTLine(IDX_TO_SGROUP_MAP &sGroupMap, RWMol *mol, const std::string &text, unsigned int line)
void ParseSGroupV2000SDSLine(IDX_TO_SGROUP_MAP &sGroupMap, RWMol *mol, const std::string &text, unsigned int line)
void ParseSGroupV2000STYLine(IDX_TO_SGROUP_MAP &sGroupMap, RWMol *mol, const std::string &text, unsigned int line)
std::map< int, SubstanceGroup > IDX_TO_SGROUP_MAP
void ParseSGroupV2000SCDSEDLine(IDX_TO_SGROUP_MAP &sGroupMap, IDX_TO_STR_VECT_MAP &dataFieldsMap, RWMol *mol, const std::string &text, unsigned int line, bool strictParsing, unsigned int &counter, unsigned int &lastDataSGroup, std::ostringstream &currentDataField)
void ParseSGroupV2000SDDLine(IDX_TO_SGROUP_MAP &sGroupMap, RWMol *mol, const std::string &text, unsigned int line)
void ParseV3000SAPLabel(RWMol *mol, SubstanceGroup *sgroup, std::stringstream &stream)
std::vector< T > ParseV3000Array(std::stringstream &stream)
void ParseSGroupV2000SCLLine(IDX_TO_SGROUP_MAP &sGroupMap, RWMol *mol, const std::string &text, unsigned int line)
void ParseSGroupV2000SDILine(IDX_TO_SGROUP_MAP &sGroupMap, RWMol *mol, const std::string &text, unsigned int line)
void ParseSGroupV2000SAPLine(IDX_TO_SGROUP_MAP &sGroupMap, RWMol *mol, const std::string &text, unsigned int line)
void ParseSGroupV2000SCNLine(IDX_TO_SGROUP_MAP &sGroupMap, RWMol *mol, const std::string &text, unsigned int line)
void ParseSGroupV2000SSTLine(IDX_TO_SGROUP_MAP &sGroupMap, RWMol *mol, const std::string &text, unsigned int line)
void ParseSGroupV2000SDTLine(IDX_TO_SGROUP_MAP &sGroupMap, RWMol *mol, const std::string &text, unsigned int line)
void ParseSGroupV2000SNCLine(IDX_TO_SGROUP_MAP &sGroupMap, RWMol *mol, const std::string &text, unsigned int line)
void ParseSGroupV2000SPLLine(IDX_TO_SGROUP_MAP &sGroupMap, RWMol *mol, const std::string &text, unsigned int line)
std::string ParseV3000StringPropLabel(std::stringstream &stream)
void ParseV3000SGroupsBlock(std::istream *inStream, unsigned int &line, unsigned int nSgroups, RWMol *mol, bool &strictParsing)
std::map< int, STR_VECT > IDX_TO_STR_VECT_MAP
void ParseSGroupV2000SLBLine(IDX_TO_SGROUP_MAP &sGroupMap, RWMol *mol, const std::string &text, unsigned int line)
double ParseSGroupDoubleField(const std::string &text, unsigned int line, unsigned int &pos)
void ParseSGroupV2000SBVLine(IDX_TO_SGROUP_MAP &sGroupMap, RWMol *mol, const std::string &text, unsigned int line)
void ParseSGroupV2000VectorDataLine(IDX_TO_SGROUP_MAP &sGroupMap, RWMol *mol, const std::string &text, unsigned int line)
Std stuff.
Definition: Abbreviations.h:17