1
// ---------------------------------------------------------------------------
3
// - standard object library - string stream class definition -
4
// ---------------------------------------------------------------------------
5
// - This program is free software; you can redistribute it and/or modify -
6
// - it provided that this copyright notice is kept intact. -
8
// - This program is distributed in the hope that it will be useful, but -
9
// - without any warranty; without even the implied warranty of -
10
// - merchantability or fitness for a particular purpose. In no event shall -
11
// - the copyright holder be liable for any direct, indirect, incidental or -
12
// - special damages arising in any way out of the use of this software. -
13
// ---------------------------------------------------------------------------
14
// - copyright (c) 1999-2007 amaury darsch -
15
// ---------------------------------------------------------------------------
18
#ifndef AFNIX_INPUTSTRING_HPP
19
#define AFNIX_INPUTSTRING_HPP
21
#ifndef AFNIX_INPUT_HPP
27
/// The InputString class implements a simple string based mechanism for
28
/// an input stream. The stream can be loaded at construction or by using
29
/// the "set" method. The stream supports the standard Input class methods.
30
/// @author amaury darsch
32
class InputString : public Input {
34
/// create a new string stream without data
37
/// create a new string stream with a buffer
38
/// @param data the data in this input stream
39
InputString (const String& data);
41
/// @return the class name
42
String repr (void) const;
44
/// @return the next character but do not remove it
45
char get (void) const;
47
/// @return the new character on the input stream
50
/// @return true if we are at the end of the input string
51
bool iseof (void) const;
53
/// check if we can read a character
54
/// @param tout the timeout value
55
bool valid (const long tout) const;
57
/// set the stream with a new string
58
/// @param data the string to set to this stream
59
void set (const String& data);
62
// make the copy constructor private
63
InputString (const InputString&);
64
// make the assignment operator private
65
InputString& operator = (const InputString&);
68
/// create a new object in a generic way
69
/// @param argv the argument vector
70
static Object* mknew (Vector* argv);
72
/// @return true if the given quark is defined
73
bool isquark (const long quark, const bool hflg) const;
75
/// apply this object with a set of arguments and a quark
76
/// @param robj the current runnable
77
/// @param nset the current nameset
78
/// @param quark the quark to apply these arguments
79
/// @param argv the arguments to apply
80
Object* apply (Runnable* robj, Nameset* nset, const long quark,