The Battle for Wesnoth  1.13.4+dev
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Modules Pages
unicode_types.hpp
Go to the documentation of this file.
1 /*
2  Copyright (C) 2003 - 2016 by David White <[email protected]>
3  Part of the Battle for Wesnoth Project http://www.wesnoth.org/
4 
5  This program is free software; you can redistribute it and/or modify
6  it under the terms of the GNU General Public License as published by
7  the Free Software Foundation; either version 2 of the License, or
8  (at your option) any later version.
9  This program is distributed in the hope that it will be useful,
10  but WITHOUT ANY WARRANTY.
11 
12  See the COPYING file for more details.
13 */
14 
15 #ifndef SERIALIZATION_UNICODE_TYPES_HPP_INCLUDED
16 #define SERIALIZATION_UNICODE_TYPES_HPP_INCLUDED
17 
18 #include <string>
19 #include <vector>
20 #include <exception>
21 #include <boost/cstdint.hpp>
22 
23 namespace ucs4 {
25  typedef std::vector<char_t> string;
26 }
27 
28 namespace utf8 {
29  typedef char char_t;
31 
32  /**
33  * Thrown by operations encountering invalid UTF-8 data.
34  *
35  * Also used for invalid UTF-16 and UCS-4 data.
36  *
37  * @todo FIXME: This clearly needs a better name for that reason.
38  */
39  class invalid_utf8_exception : public std::exception {};
40 }
41 
42 /**
43  * For Win32 API.
44  *
45  * On windows, wchar_t is defined as Uint16.
46  * Wide strings are expected to be UTF-16.
47  */
48 namespace utf16 {
49  typedef wchar_t char_t;
50  typedef std::vector<char_t> string;
51 }
52 
53 #endif
std::vector< char_t > string
char char_t
std::vector< char_t > string
boost::uint32_t uint32_t
Definition: xbrz.hpp:45
For Win32 API.
Definition: unicode.hpp:33
Functions for converting Unicode wide-char strings to UTF-8 encoded strings, back and forth...
Definition: unicode.cpp:36
Thrown by operations encountering invalid UTF-8 data.
wchar_t char_t
boost::uint32_t char_t
GLsizei const GLcharARB ** string
Definition: glew.h:4503
std::string string