Source-highlight Library
langelems.h
1 //
2 // Author: Lorenzo Bettini, (C) 1999-2009
3 //
4 // Copyright: See COPYING file that comes with this distribution
5 //
6 //
7 #ifndef LANGELEMS_H
8 #define LANGELEMS_H
9 
10 #include "langelem.h"
11 
12 #include <list>
13 #include <map>
14 #include <string>
15 
16 using std::list;
17 using std::map;
18 using std::string;
19 
20 namespace srchilite {
21 
23 typedef list<LangElem *> LangElemsBase;
24 
29 // doublecpp: forward declarations, DO NOT MODIFY
30 class LangElemsPrinter; // file: langelemsprinter.h
31 // doublecpp: end, DO NOT MODIFY
32 
33 class LangElems : protected list<LangElem *>
34 {
35  typedef LangElemsBase base;
36  typedef base::iterator Pointer;
37  typedef list<Pointer> PointerList;
38  typedef map<string, PointerList> ElemMap;
39 
40  ElemMap elem_map;
41 
42  public:
43  using base::const_iterator;
44  using base::begin;
45  using base::end;
46  using base::size;
47 
48  LangElems();
49 
50  virtual ~LangElems();
51 
56  void add(LangElem *el);
57 
63  void redef(LangElem *el);
64 
70  void subst(LangElem *el);
71 
76  const std::string toString() const;
77 
83  const std::string toStringOriginal() const;
84 // doublecpp: dispatch methods, DO NOT MODIFY
85 public:
86 virtual void dispatch_collect_const(LangElemsPrinter *);
87 // doublecpp: end, DO NOT MODIFY
88 };
89 
90 }
91 
92 #endif
Definition: langelem.h:23
collection of LangElem objects
Definition: langelems.h:33
void redef(LangElem *el)
Redefines all the possible occurrences of elements (which will be removed) with the same name with th...
C++ class: doctemplate.h.
Definition: bufferedoutput.cpp:13
const std::string toStringOriginal() const
return the original representation (without any preprocessing) of all the elements; this is useful fo...
void subst(LangElem *el)
Replaces the first occurrence of element (with the same name) with the new one; all the other possibl...
const std::string toString() const
return the string representation (with preprocessing) of all the elements
list< LangElem * > LangElemsBase
the base class for LangElems
Definition: langelems.h:23
Prints all the language elements.
Definition: langelemsprinter.h:26
void add(LangElem *el)
Adds a new element at the end of this collection.