~ubuntu-branches/ubuntu/quantal/texmacs/quantal

« back to all changes in this revision

Viewing changes to src/Classes/Atomic/parse_string.hpp

  • Committer: Bazaar Package Importer
  • Author(s): Atsuhito KOHDA, Kamaraju Kusumanchi, kohda
  • Date: 2008-04-06 15:11:41 UTC
  • mfrom: (1.1.7 upstream) (4.1.1 lenny)
  • Revision ID: james.westby@ubuntu.com-20080406151141-w0sg20jnv86mlt6f
Tags: 1:1.0.6.14-1
[Kamaraju Kusumanchi <kamaraju@gmail.com>]
* New upstream release
* 01_american.dpatch is updated
* Since thread support in guile-1.8 is now disabled, the segmentation faults
  should not arise anymore. More info at #439923. (Closes: #450499, #458685)
[kohda]
* This version fixed menu problem.  (Closes: #447083)
* Reverted orig.tar.gz to the upstream tarball.

Show diffs side-by-side

added added

removed removed

Lines of Context:
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 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
 
******************************************************************************/
13
 
 
14
 
#ifndef PARSE_STRING_H
15
 
#define PARSE_STRING_H
16
 
#include "string.hpp"
17
 
#include "list.hpp"
18
 
 
19
 
class parse_string;
20
 
class parse_string_rep: concrete_struct {
21
 
  list<string> l;   // strings left to parse
22
 
  list<int>    p;   // positions in each string
23
 
 
24
 
public:
25
 
  inline parse_string_rep (): l (), p () {}
26
 
  inline parse_string_rep (string s): l (s), p (0) {}
27
 
  inline ~parse_string_rep () {}
28
 
 
29
 
  void advance (int n);
30
 
  string read (int n);
31
 
  void write (string s);
32
 
  char get_char (int n);
33
 
  string get_string (int n);
34
 
  bool test (string s);
35
 
 
36
 
  friend class parse_string;
37
 
  friend ostream& operator << (ostream& out, parse_string s);
38
 
  friend bool test (parse_string s, string what);
39
 
};
40
 
 
41
 
class parse_string {
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); }
48
 
};
49
 
CONCRETE_CODE(parse_string);
50
 
 
51
 
bool test (parse_string s, string what);
52
 
 
53
 
#endif // defined PARSE_STRING_H