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
16using std::list;
17using std::map;
18using std::string;
19
20namespace srchilite {
21
23typedef list<LangElem *> LangElemsBase;
24
29// doublecpp: forward declarations, DO NOT MODIFY
30class LangElemsPrinter; // file: langelemsprinter.h
31// doublecpp: end, DO NOT MODIFY
32
33class 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
85public:
86virtual void dispatch_collect_const(LangElemsPrinter *);
87// doublecpp: end, DO NOT MODIFY
88};
89
90}
91
92#endif
Definition: langelem.h:24
Prints all the language elements.
Definition: langelemsprinter.h:27
collection of LangElem objects
Definition: langelems.h:34
void redef(LangElem *el)
Redefines all the possible occurrences of elements (which will be removed) with the same name with th...
Definition: langelems.cpp:57
const std::string toString() const
return the string representation (with preprocessing) of all the elements
Definition: langelems.cpp:38
const std::string toStringOriginal() const
return the original representation (without any preprocessing) of all the elements; this is useful fo...
Definition: langelems.cpp:44
void subst(LangElem *el)
Replaces the first occurrence of element (with the same name) with the new one; all the other possibl...
Definition: langelems.cpp:67
void add(LangElem *el)
Adds a new element at the end of this collection.
Definition: langelems.cpp:49
C++ class: doctemplate.h.
Definition: bufferedoutput.cpp:13
list< LangElem * > LangElemsBase
the base class for LangElems
Definition: langelems.h:23