mtoc++  1.5
mtoc++: Doxygen filter for MatLab .m files
 All Classes Namespaces Variables Pages
confscanner.h
1 #ifndef CONFSCANNER_H_
2 
3 #define CONFSCANNER_H_
4 
5 #include <cstring>
6 #include <cstdlib>
7 #include <iostream>
8 #include <string>
9 #include <fstream>
10 #include <vector>
11 #include <map>
12 #include <set>
13 
14 // 160 KB
15 #define BUFSIZE 100*16384
16 
18 private:
19  typedef std :: vector< std :: string > DocuBlock;
20  typedef std :: map< std :: string, DocuBlock > DocuList;
21  typedef std :: map< std :: string, DocuList > DocuListMap;
22  typedef std :: set< std :: string > GroupSet;
23  typedef std :: vector< std :: string > GlobList;
24  typedef std :: map< std :: string, GlobList > GlobListMap;
25  typedef std :: vector< GlobList > GlobListStack;
26 
27 
28 public:
29  ConfFileScanner(const std.string & filename, const std.string & conffilename);
30 
31  virtual ~ConfFileScanner()
32  {
33  delete buf;
34  }
35 
36  int execute();
37 
38  const char * get_conffile();
39 
40 public:
41  DocuList param_list_;
42  DocuList return_list_;
43  DocuListMap field_docu_;
44  DocuBlock docuheader_;
45  DocuBlock docubody_;
46  DocuBlock docuextra_;
47  GroupSet groupset_;
48  DocuList vars_;
49 
50 private:
51 
52  void check_glob_level_up();
53 
54  void go_level_down();
55 
56  bool check_for_match(int l, const char * str);
57 
58 
59  bool check_glob_rec(int l, const std.string & s);
60 
61  void cerr_stack()
62  {
63  for (unsigned int i = 0; i < globlist_stack_.size(); i++) {
64  if (!globlist_stack_[i].empty()) {
65  std.cerr << globlist_stack_[i][0] << " ";
66  }
67  }
68  std.cerr << "current level: " << level_ << std.endl;
69  std.cerr << "size of globlist_stack: " << globlist_stack_.size() << std.endl;
70  std.cerr << std.endl;
71  }
72 
73  void clear_all()
74  {
75  param_list_.clear();
76  return_list_.clear();
77  field_docu_.clear();
78  docuheader_.clear();
79  docubody_.clear();
80  docuextra_.clear();
81  groupset_.clear();
82  }
83 
84 private:
85  /* ragel scanner variables */
86  char *buf;
87  int line , col;
88  int have;
89  int cs;
90  int top;
91  int stack[30];
92  bool opt;
93 
94  /* references to data from the confscanner */
95  const std.string filename_;
96 
97 private:
98  /* own data */
99  std.string conffile_;
100  std.ifstream confistream_;
101 
102  int level_;
103  bool arg_to_be_added_;
104  bool match_at_level_[30];
105  DocuBlock *cblock_;
106  DocuList *clist_;
107  DocuListMap *clistmap_;
108  GlobListMap globlist_map_;
109  GlobListStack globlist_stack_;
110  DocuBlock *arglist_;
111 
112 };
113 
114 /* vim: set et sw=2: */
115 #endif /* CONFSCANNER_H_ */