1 //
2 // C++ Interface: StringDef
3 //
4 // Description: a string definition that is used by all the language elements.
5 //
6 //
7 // Author: Lorenzo Bettini, 1999-2007 <http://www.lorenzobettini.it>
8 //
9 // Copyright: See COPYING file that comes with this distribution
10 //
11 //
12 #ifndef STRINGDEF_H
13 #define STRINGDEF_H
14
15 #include <string>
16 #include <list>
17
19
20 class StringDefs;
21
26 private:
35
36 public:
42 StringDef(
const std::string &s,
const std::string &o) :
43 stringdef(s), orig(o), doubleQuotedString(false), hasBackRef_(false) {
44 }
45
52 StringDef(
const std::string &s,
bool doubleQuotes =
false) :
53 stringdef(s), doubleQuotedString(doubleQuotes), hasBackRef_(false) {
54 }
55
61
69 }
70
77 }
78
84 }
85
90 hasBackRef_ = b;
91 }
92
101
102 };
103
104 typedef std::list<StringDef *> StringDefsBase;
105
111 public:
113 for (StringDefsBase::iterator it = begin(); it != end(); ++it)
114 delete *it;
115 }
116 };
117
118 }
119
120 #endif
A collection (list) of StringDef's.
Definition: stringdef.h:110
const std::string toStringOriginal() const
return the original representation (without any preprocessing); this is useful for printing errors ...
Definition: stringdef.h:67
represent a string for a language definition file's element
Definition: stringdef.h:25
void setBackRef(bool b)
Definition: stringdef.h:89
std::string stringdef
the actual content
Definition: stringdef.h:28
C++ class: doctemplate.h.
Definition: bufferedoutput.cpp:13
StringDef(const std::string &s, bool doubleQuotes=false)
constructs a StringDef and record whether it comes from a double quoted string.
Definition: stringdef.h:52
bool doubleQuotedString
whether the string was specified with double quotes
Definition: stringdef.h:32
const std::string toString() const
return the string representation (after preprocessing)
Definition: stringdef.cpp:38
bool isDoubleQuoted() const
whether this comes from a double quoted string
Definition: stringdef.h:75
bool hasBackRef_
whether this is contains a back reference to a matched subexpression
Definition: stringdef.h:34
std::string orig
the original representation (without any preprocessing)
Definition: stringdef.h:30
bool hasBackRef() const
Definition: stringdef.h:82
StringDef(const std::string &s, const std::string &o)
constructs a StringDef and store also the original representation
Definition: stringdef.h:42
static StringDef * concat(const StringDef *s1, const StringDef *s2)
Given two StringDef produces a new StringDef (keeping properties such as hasBackRef) ...
Definition: stringdef.cpp:30