File: cdxml_reader.h

package info (click to toggle)
xdrawchem 1.0-0.1
  • links: PTS
  • area: main
  • in suites: woody
  • size: 2,820 kB
  • ctags: 2,389
  • sloc: cpp: 17,801; makefile: 263; ansic: 168
file content (82 lines) | stat: -rw-r--r-- 1,897 bytes parent folder | download | duplicates (2)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
// CDXML_Reader:  XML Reader for CDXML type.

#include <qstring.h>
#include <qcolor.h>
#include <qfont.h>

#include "chemdata.h"
#include "dpoint.h"
#include "xml_reader.h"

class ColorTableEntry {
 public:
  ColorTableEntry() { }
  int index;
  QColor color;
};

class FontTableEntry {
 public:
  FontTableEntry() { }
  QString id;
  QString fam;
};

class CDXML_Object {
 public:
  CDXML_Object() { }
  QString id; // XML ID
  QString start_id; // id of start and end points for bonds
  QString end_id;
  DPoint *start; // start and end points for non-bonds
  DPoint *end;
  int type;
  int idata1, idata2;
  double ddata1, ddata2;
  QString sdata;
  QColor color;
  QFont font;
};

class CDXML_Reader : public XML_Reader {
 public:
  CDXML_Reader(ChemData *);
  bool ReadFile(QString);
 private:
  // basically, all member functions are private.  Not necessary but
  // probably a good idea
  void ParseDocument(QString);
  void ParseColorTable(QString);
  QColor ParseColor(QString);
  void ParseFontTable(QString);
  FontTableEntry *ParseFont(QString);
  void ParsePage(QString);
  void ParseFragment(QString);
  QString ParseText(QString);
  void ParseGraphic(QString);
  void ParseNode(QString);
  void ParseBond(QString);
  DPoint *FindNode(QString);
  void Build();
  // ----
  // data
  // ----
  // color table and temporary pointer to access it
  ColorTableEntry *tmp_color;
  QList<ColorTableEntry> colors;
  // font table and temporary pointer to access it
  FontTableEntry *tmp_font;
  QList<FontTableEntry> fonts;
  // node list (atoms) and temp object
  QList<DPoint> nodelist;
  DPoint *tmp_node;
  // CDXML object list and temp object
  QList<CDXML_Object> objectlist;
  CDXML_Object *tmp_obj;
  // ChemData object we are reading into
  ChemData *c;
  // how many levels of node/fragment are we in
  int nodedepth, fragdepth;
  // for passing data
  double globalx, globaly;
};