char_traits.hh

Go to the documentation of this file.
00001 // char_traits.hh: this file is part of the Vaucanson project.
00002 //
00003 // Vaucanson, a generic library for finite state machines.
00004 //
00005 // Copyright (C) 2004, 2005, 2006 The Vaucanson Group.
00006 //
00007 // This program is free software; you can redistribute it and/or
00008 // modify it under the terms of the GNU General Public License
00009 // as published by the Free Software Foundation; either version 2
00010 // of the License, or (at your option) any later version.
00011 //
00012 // The complete GNU General Public Licence Notice can be found as the
00013 // `COPYING' file in the root directory.
00014 //
00015 // The Vaucanson Group consists of people listed in the `AUTHORS' file.
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   } // end of namespace misc
00119 } // end of namespace vcsn
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

Generated on Wed Jun 13 17:00:21 2007 for Vaucanson by  doxygen 1.5.1