PageRenderTime 18ms CodeModel.GetById 10ms app.highlight 5ms RepoModel.GetById 1ms app.codeStats 0ms

/Src/Dependencies/Boost/boost/spirit/home/support/detail/lexer/char_traits.hpp

http://hadesmem.googlecode.com/
C++ Header | 54 lines | 40 code | 8 blank | 6 comment | 0 complexity | e1b124c984226a5fed40a69ea8eb022f MD5 | raw file
 1// char_traits.hpp
 2// Copyright (c) 2007-2009 Ben Hanson (http://www.benhanson.net/)
 3//
 4// Distributed under the Boost Software License, Version 1.0. (See accompanying
 5// file licence_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
 6#ifndef BOOST_LEXER_CHAR_TRAITS_H
 7#define BOOST_LEXER_CHAR_TRAITS_H
 8
 9// Make sure wchar_t is defined
10#include <string>
11
12namespace boost
13{
14namespace lexer
15{
16template<typename CharT>
17struct char_traits
18{
19    typedef CharT char_type;
20    typedef CharT index_type;
21
22    static index_type call (CharT ch)
23    {
24       return ch;
25    }
26};
27
28template<>
29struct char_traits<char>
30{
31    typedef char char_type;
32    typedef unsigned char index_type;
33        
34    static index_type call (char ch)
35    {
36        return static_cast<index_type>(ch);
37    }
38};
39
40template<>
41struct char_traits<wchar_t>
42{
43    typedef wchar_t char_type;
44    typedef wchar_t index_type;
45
46    static index_type call (wchar_t ch)
47    {
48        return ch;
49    }
50};
51}
52}
53
54#endif