Vaucanson  1.4.1
char_traits.hh
Go to the documentation of this file.
1 // char_traits.hh: this file is part of the Vaucanson project.
2 //
3 // Vaucanson, a generic library for finite state machines.
4 //
5 // Copyright (C) 2004, 2005, 2006 The Vaucanson Group.
6 //
7 // This program is free software; you can redistribute it and/or
8 // modify it under the terms of the GNU General Public License
9 // as published by the Free Software Foundation; either version 2
10 // of the License, or (at your option) any later version.
11 //
12 // The complete GNU General Public Licence Notice can be found as the
13 // `COPYING' file in the root directory.
14 //
15 // The Vaucanson Group consists of people listed in the `AUTHORS' file.
16 //
17 #ifndef VCSN_MISC_CHAR_TRAITS_HH
18 # define VCSN_MISC_CHAR_TRAITS_HH
19 
48 # include <string>
49 
50 namespace vcsn
51 {
52  namespace misc
53  {
54 
64  template <class CharT>
66  {
67  typedef CharT char_type;
68 
70  generic_int_type (const char_type&);
71 
72  operator CharT () const;
73 
74  bool operator== (const generic_int_type<CharT>&) const;
75  bool eof () const;
76  protected:
77  char_type val_;
78  bool eof_;
79  };
80 
88  template <typename CharT>
89  struct char_traits
90  {
91  typedef CharT char_type;
93  typedef std::streamoff off_type;
94  typedef std::streampos pos_type;
95  typedef mbstate_t state_type;
96 
97  static void assign (char_type&, const char_type&);
98  static bool eq (const char_type&, const char_type&);
99  static bool lt (const char_type&, const char_type&);
100  static int compare (const char_type*,
101  const char_type*,
102  size_t);
103  static size_t length (const char_type*);
104  static const char_type* find (const char_type*,
105  size_t,
106  const char_type&);
107  static char_type* move (char_type*, const char_type*, size_t);
108  static char_type* copy (char_type*, const char_type*, size_t);
109  static char_type* assign (char_type*, size_t, char_type);
110  static int_type not_eof (const int_type&);
111  static char_type to_char_type (const int_type&);
112  static int_type to_int_type (const char_type&);
113  static bool eq_int_type (const int_type&, const int_type&);
114  static int_type eof ();
115  };
116 
118  } // end of namespace misc
119 } // end of namespace vcsn
120 
121 
122 # if !defined VCSN_USE_INTERFACE_ONLY || defined VCSN_USE_LIB
123 # include <vaucanson/misc/char_traits.hxx>
124 # endif // VCSN_USE_INTERFACE_ONLY
125 
126 #endif // ! VCSN_MISC_CHAR_TRAITS_HH