Go to the documentation of this file.00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017 #ifndef VCSN_MISC_WINDOW_HH
00018 # define VCSN_MISC_WINDOW_HH
00019
00031 # include <iostream>
00032 # include <string>
00033
00034 namespace vcsn {
00035 namespace misc {
00036
00059 template <class InputIterator, class Letter>
00060 struct Window
00061 {
00062 typedef InputIterator iterator_t;
00063 typedef Letter letter_t;
00064 typedef typename std::basic_string<letter_t> string_t;
00065 typedef unsigned int length_t;
00066
00080 Window (const iterator_t& stream,
00081 const iterator_t& eof,
00082 letter_t eol,
00083 length_t length);
00084
00086 bool eof () const;
00088 bool eol () const;
00089
00095 void shift (unsigned int n);
00097 void shift ();
00098
00100
00101 void moveto (length_t offset);
00102 void moveto (iterator_t position);
00104
00106 length_t size () const;
00107
00109 letter_t operator[] (length_t i) const;
00110
00112 std::ostream& print (std::ostream& ostr) const;
00113
00115
00116
00117 iterator_t begin () const;
00119 iterator_t stream () const;
00121 iterator_t end () const;
00123 size_t offset () const;
00125 letter_t eol_value () const;
00127 length_t length () const;
00129 string_t window () const;
00131 protected:
00132 void compute_size ();
00133
00134 iterator_t begin_;
00135 iterator_t stream_;
00136 iterator_t end_;
00137 letter_t eol_;
00138 length_t length_;
00139 length_t size_;
00140 };
00141
00142 template <class InputIterator, class Letter>
00143 std::ostream&
00144 operator<< (std::ostream& ostr, const Window<InputIterator, Letter>& w);
00145
00148 }
00149 }
00150
00151 # if !defined VCSN_USE_INTERFACE_ONLY || defined VCSN_USE_LIB
00152 # include <vaucanson/misc/window.hxx>
00153 # endif // VCSN_USE_INTERFACE_ONLY
00154
00155 #endif // ! VCSN_MISC_WINDOW_HH