1 : #ifndef TAGCOLL_INPUT_MEMORY_H
2 : #define TAGCOLL_INPUT_MEMORY_H
3 :
4 : /** \file
5 : * Parser input using a buffer as input
6 : */
7 :
8 : /*
9 : * Copyright (C) 2003-2006 Enrico Zini <enrico@debian.org>
10 : *
11 : * This library is free software; you can redistribute it and/or
12 : * modify it under the terms of the GNU Lesser General Public
13 : * License as published by the Free Software Foundation; either
14 : * version 2.1 of the License, or (at your option) any later version.
15 : *
16 : * This library is distributed in the hope that it will be useful,
17 : * but WITHOUT ANY WARRANTY; without even the implied warranty of
18 : * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
19 : * Lesser General Public License for more details.
20 : *
21 : * You should have received a copy of the GNU Lesser General Public
22 : * License along with this library; if not, write to the Free Software
23 : * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
24 : */
25 :
26 : #include <tagcoll/input/base.h>
27 : #include <string>
28 :
29 : namespace tagcoll {
30 : namespace input {
31 :
32 : /**
33 : * Parser input using a std::string as input
34 : */
35 : class Memory : public Input
36 : {
37 : protected:
38 : const std::string fname;
39 : const char* buf;
40 : int pos;
41 : int len;
42 : int _line;
43 :
44 : public:
45 : Memory(const std::string& fname, const char* buf, int len) throw ();
46 : Memory(const char* buf, int len) throw ();
47 1301 : virtual ~Memory() throw () {}
48 :
49 : virtual const std::string& fileName() const throw () { return fname; }
50 : virtual int lineNumber() const throw () { return _line; }
51 :
52 : virtual int nextChar() throw ();
53 : virtual void pushChar(int c) throw ();
54 : };
55 :
56 : }
57 : }
58 :
59 : // vim:set ts=4 sw=4:
60 : #endif
|