librcsb-core-wrapper  1.000
CifParserBase.h
Go to the documentation of this file.
1 //$$FILE$$
2 //$$VERSION$$
3 //$$DATE$$
4 //$$LICENSE$$
5 
6 
14 #ifndef CIF_PARSER_BASE_H
15 #define CIF_PARSER_BASE_H
16 
17 
18 #include <iostream>
19 #include <stdio.h>
20 #include <stdlib.h>
21 #include <string.h>
22 #include <rcsb/ISTable.h>
23 #include <rcsb/CifFile.h>
24 #include <rcsb/CifScannerBase.h>
25 #include <rcsb/CifParserInt.h>
26 #include <rcsb/CifFileReadDef.h>
27 
28 
29 #define DATA_TAG "data_"
30 
31 
41 class CifParser : public CifScanner
42 {
43  public:
61  CifParser(CifFile* cifFileP, bool verbose = false);
62 
67  CifParser(CifFile* cifFileP, CifFileReadDef readDef,
68  bool verbose = false);
69 
91  void Parse(const string& fileName, string& diagnostics,
92  const std::string& parseLogFileName = std::string());
93 
111  void ParseString(const string& cifString, string& diagnostics);
112 
126  virtual ~CifParser();
127 
132  void Error(const char*);
133 
138  void Clear();
139 
144  void Reset();
145 
150  int ProcessLoopDeclaration(void);
151 
156  int ProcessItemNameList(void);
157 
162  int ProcessValueList(void);
163 
168  int ProcessItemValuePair(void);
169 
174  void ProcessAssignments(void);
175 
180  void ProcessLoop(void);
181 
186  void ProcessItemName(void);
187 
192  void ProcessItemValue(void);
193 
198  void ProcessLsItemValue(void);
199 
204  void ProcessUnknownValue(void);
205 
210  void ProcessMissingValue(void);
211 
216  void ProcessDataBlockName(void);
217 
218  private:
219  CifFile *_fobj;
220  CifFileReadDef _readDef;
221  ISTable *_tbl;
222  int _afterLoop;
223  int _nTablesInBlock;
224  int _curItemNo, _curValueNo, _numDataBlocks, _fieldListAlloc, _curRow;
225  vector<string> _fieldList;
226  string _pBufValue;
227  string _tBufKeyword;
228  string _curCategoryName;
229  string _curDataBlockName;
230  string _prevDataBlockName;
231  void _ComplexWriteTable();
232 
233  int _err, _warn;
234 };
235 
236 #endif /* CIF_PARSER_BASE_H */