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 
89  void Parse(const string& fileName, string& diagnostics,
90  const std::string& parseLogFileName = std::string());
91 
109  void ParseString(const string& cifString, string& diagnostics);
110 
124  virtual ~CifParser();
125 
130  void Error(const char*);
131 
136  void Clear();
137 
142  void Reset();
143 
148  int ProcessLoopDeclaration(void);
149 
154  int ProcessItemNameList(void);
155 
160  int ProcessValueList(void);
161 
166  int ProcessItemValuePair(void);
167 
172  void ProcessAssignments(void);
173 
178  void ProcessLoop(void);
179 
184  void ProcessItemName(void);
185 
190  void ProcessItemValue(void);
191 
196  void ProcessLsItemValue(void);
197 
202  void ProcessUnknownValue(void);
203 
208  void ProcessMissingValue(void);
209 
214  void ProcessDataBlockName(void);
215 
216  private:
217  CifFile *_fobj;
218  CifFileReadDef _readDef;
219  ISTable *_tbl;
220  int _afterLoop;
221  int _nTablesInBlock;
222  int _curItemNo, _curValueNo, _numDataBlocks, _fieldListAlloc, _curRow;
223  vector<string> _fieldList;
224  string _pBufValue;
225  string _tBufKeyword;
226  string _curCategoryName;
227  string _curDataBlockName;
228  string _prevDataBlockName;
229  void _ComplexWriteTable();
230 
231  int _err, _warn;
232 };
233 
234 #endif /* CIF_PARSER_BASE_H */