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 vcsn
00051 {
00052   namespace misc
00053   {
00054  
00064     template <class CharT>
00065     struct generic_int_type
00066     {
00067         typedef CharT char_type;
00068 
00069         generic_int_type ();
00070         generic_int_type (const char_type&);
00071 
00072         operator CharT () const;
00073 
00074         bool operator== (const generic_int_type<CharT>&) const;
00075         bool eof () const;
00076       protected:
00077         char_type val_;
00078         bool eof_;
00079     };
00080 
00088     template <typename CharT>
00089     struct char_traits
00090     {
00091         typedef CharT           char_type;
00092         typedef generic_int_type<char_type> int_type;
00093         typedef std::streamoff  off_type;
00094         typedef std::streampos  pos_type;
00095         typedef mbstate_t       state_type;
00096 
00097         static void             assign (char_type&, const char_type&);
00098         static bool             eq (const char_type&, const char_type&);
00099         static bool             lt (const char_type&, const char_type&);
00100         static int              compare (const char_type*,
00101                                          const char_type*,
00102                                          size_t);
00103         static size_t   length (const char_type*);
00104         static const char_type* find (const char_type*,
00105                                       size_t,
00106                                       const char_type&);
00107         static char_type*       move (char_type*, const char_type*, size_t);
00108         static char_type*       copy (char_type*, const char_type*, size_t);
00109         static char_type*       assign (char_type*, size_t, char_type);
00110         static int_type         not_eof (const int_type&);
00111         static char_type        to_char_type (const int_type&);
00112         static int_type         to_int_type (const char_type&);
00113         static bool             eq_int_type (const int_type&, const int_type&);
00114         static int_type         eof ();
00115     };
00116 
00118   } 
00119 } 
00120 
00121 
00122 # if !defined VCSN_USE_INTERFACE_ONLY || defined VCSN_USE_LIB
00123 #  include <vaucanson/misc/char_traits.hxx>
00124 # endif // VCSN_USE_INTERFACE_ONLY
00125 
00126 #endif // ! VCSN_MISC_CHAR_TRAITS_HH