Lolly 1.4.27
Loading...
Searching...
No Matches
parse_string.hpp
Go to the documentation of this file.
1
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 version 3 or later.
9 * It comes WITHOUT ANY WARRANTY WHATSOEVER. For details, see the file LICENSE
10 * in the root directory or <http://www.gnu.org/licenses/gpl-3.0.html>.
11 ******************************************************************************/
12
13#ifndef PARSE_STRING_H
14#define PARSE_STRING_H
15#include "list.hpp"
16#include "string.hpp"
17
18class parse_string;
20 list<string> l; // strings left to parse
21 list<int> p; // positions in each string
22
23public:
24 inline parse_string_rep () : l (), p () {}
25 inline parse_string_rep (string s) : l (s), p (0) {}
26 inline ~parse_string_rep () {}
27
28 void advance (int n);
29 string read (int n);
30 void write (string s);
31 char get_char (int n);
32 string get_string (int n);
33 bool test (string s);
34
35 friend class parse_string;
37 friend bool test (parse_string s, string what);
38};
39
43 inline parse_string (string s) : rep (tm_new<parse_string_rep> (s)) {}
44 inline char operator[] (int i) { return rep->get_char (i); }
45 inline operator bool () { return !is_nil (rep->l); }
46 inline void operator+= (int i) { rep->advance (i); }
47};
49
50bool test (parse_string s, string what);
51
52#endif // defined PARSE_STRING_H
bool is_nil(blackbox x)
Definition blackbox.hpp:29
#define CONCRETE_CODE(PTR)
Macro used to define the implementation of a concrete smart pointer.
Definition classdef.hpp:159
The list class represents a linked list.
Definition list.hpp:48
void write(string s)
parse_string_rep(string s)
string get_string(int n)
string read(int n)
friend tm_ostream & operator<<(tm_ostream &out, parse_string s)
friend bool test(parse_string s, string what)
void advance(int n)
char get_char(int n)
list< string > l
CONCRETE(parse_string)
char operator[](int i)
void operator+=(int i)
parse_string(string s)
C * tm_new()
bool test(parse_string s, string what)
Structure representing a concrete object with a reference count.
Definition classdef.hpp:24
base class of resources
Definition resource.hpp:23