2
/******************************************************************************
3
* MODULE : parse_string.hpp
4
* DESCRIPTION: strings from which it is both easy to read and write characters
5
* they are used for entity replacement in the XML parser
6
* COPYRIGHT : (C) 2005 Joris van der Hoeven
7
*******************************************************************************
8
* This software falls under the GNU general public license and comes WITHOUT
9
* ANY WARRANTY WHATSOEVER. See the file $TEXMACS_PATH/LICENSE for more details.
10
* If you don't have this file, write to the Free Software Foundation, Inc.,
11
* 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
12
******************************************************************************/
14
#ifndef PARSE_STRING_H
15
#define PARSE_STRING_H
20
class parse_string_rep: concrete_struct {
21
list<string> l; // strings left to parse
22
list<int> p; // positions in each string
25
inline parse_string_rep (): l (), p () {}
26
inline parse_string_rep (string s): l (s), p (0) {}
27
inline ~parse_string_rep () {}
31
void write (string s);
32
char get_char (int n);
33
string get_string (int n);
36
friend class parse_string;
37
friend ostream& operator << (ostream& out, parse_string s);
38
friend bool test (parse_string s, string what);
42
CONCRETE(parse_string);
43
inline parse_string (): rep (new parse_string_rep ()) {}
44
inline parse_string (string s): rep (new parse_string_rep (s)) {}
45
inline char operator [] (int i) { return rep->get_char (i); }
46
inline operator bool () { return !nil (rep->l); }
47
inline void operator += (int i) { rep->advance (i); }
49
CONCRETE_CODE(parse_string);
51
bool test (parse_string s, string what);
53
#endif // defined PARSE_STRING_H