00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017 #ifndef VCSN_MISC_CHAR_TRAITS_HH
00018 # define VCSN_MISC_CHAR_TRAITS_HH
00019
00048 # include <string>
00049
00050 namespace utility
00051 {
00052
00062 template <class CharT>
00063 struct generic_int_type
00064 {
00065 typedef CharT char_type;
00066
00067 generic_int_type();
00068 generic_int_type(const char_type&);
00069
00070 operator CharT () const;
00071
00072 bool operator == (const generic_int_type<CharT>&) const;
00073 bool eof() const;
00074 protected:
00075 char_type val_;
00076 bool eof_;
00077 };
00078
00086 template <typename CharT>
00087 struct char_traits
00088 {
00089 typedef CharT char_type;
00090 typedef generic_int_type<char_type> int_type;
00091 typedef std::streamoff off_type;
00092 typedef std::streampos pos_type;
00093 typedef mbstate_t state_type;
00094
00095 static void assign(char_type&, const char_type&);
00096 static bool eq(const char_type&, const char_type&);
00097 static bool lt(const char_type&, const char_type&);
00098 static int compare(const char_type*,
00099 const char_type*,
00100 size_t);
00101 static size_t length(const char_type*);
00102 static const char_type* find(const char_type*,
00103 size_t,
00104 const char_type&);
00105 static char_type* move(char_type*, const char_type*, size_t);
00106 static char_type* copy(char_type*, const char_type*, size_t);
00107 static char_type* assign(char_type*, size_t, char_type);
00108 static int_type not_eof(const int_type&);
00109 static char_type to_char_type(const int_type&);
00110 static int_type to_int_type(const char_type&);
00111 static bool eq_int_type(const int_type&, const int_type&);
00112 static int_type eof();
00113 };
00114
00116 }
00117
00118 # ifndef VCSN_USE_INTERFACE_ONLY
00119 # include <vaucanson/misc/char_traits.hxx>
00120 # endif // VCSN_USE_INTERFACE_ONLY
00121
00122 #endif // ! VCSN_MISC_CHAR_TRAITS_HH