~ubuntu-branches/ubuntu/wily/afnix/wily

« back to all changes in this revision

Viewing changes to src/lib/std/shl/obj/InputString.hpp

  • Committer: Bazaar Package Importer
  • Author(s): Anibal Monsalve Salazar
  • Date: 2011-03-16 21:31:18 UTC
  • mfrom: (1.1.2 upstream)
  • Revision ID: james.westby@ubuntu.com-20110316213118-gk4k3ez3e5d2huna
Tags: 2.0.0-1
* QA upload.
* New upstream release
* Debian source format is 3.0 (quilt)
* Fix debhelper-but-no-misc-depends
* Fix ancient-standards-version
* Fix package-contains-linda-override
* debhelper compatibility is 7
* Fix dh-clean-k-is-deprecated

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
 
// ---------------------------------------------------------------------------
2
 
// - InputString.hpp                                                         -
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.                  -
7
 
// -                                                                         -
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
 
// ---------------------------------------------------------------------------
16
 
 
17
 
 
18
 
#ifndef  AFNIX_INPUTSTRING_HPP
19
 
#define  AFNIX_INPUTSTRING_HPP
20
 
 
21
 
#ifndef  AFNIX_INPUT_HPP
22
 
#include "Input.hpp"
23
 
#endif
24
 
 
25
 
namespace afnix {
26
 
 
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
31
 
 
32
 
  class InputString : public Input {
33
 
  public:
34
 
    /// create a new string stream without data
35
 
    InputString (void);
36
 
 
37
 
    /// create a new string stream with a buffer
38
 
    /// @param data the data in this input stream
39
 
    InputString (const String& data);
40
 
 
41
 
    /// @return the class name
42
 
    String repr (void) const;
43
 
 
44
 
    /// @return the next character but do not remove it
45
 
    char get (void) const;
46
 
 
47
 
    /// @return the new character on the input stream
48
 
    char read (void);
49
 
 
50
 
    /// @return true if we are at the end of the input string
51
 
    bool iseof (void) const;
52
 
 
53
 
    /// check if we can read a character
54
 
    /// @param tout the timeout value
55
 
    bool valid (const long tout) const;
56
 
  
57
 
    /// set the stream with a new string
58
 
    /// @param data the string to set to this stream
59
 
    void set (const String& data);
60
 
 
61
 
  private:
62
 
    // make the copy constructor private
63
 
    InputString (const InputString&);
64
 
    // make the assignment operator private
65
 
    InputString& operator = (const InputString&);
66
 
 
67
 
  public:
68
 
    /// create a new object in a generic way
69
 
    /// @param argv the argument vector
70
 
    static Object* mknew (Vector* argv);
71
 
    
72
 
    /// @return true if the given quark is defined
73
 
    bool isquark (const long quark, const bool hflg) const;
74
 
 
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,
81
 
                   Vector* argv);
82
 
  };
83
 
}
84
 
 
85
 
#endif