Gnash
0.8.11dev
Main Page
Related Pages
Namespaces
Classes
Files
Examples
File List
File Members
libbase
utf8.h
Go to the documentation of this file.
1
// utf8.h: utilities for converting to and from UTF-8
2
//
3
// Copyright (C) 2008, 2009, 2010, 2011, 2012 Free Software Foundation, Inc.
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 3 of the License, or
8
// (at your option) any later version.
9
//
10
// This program is distributed in the hope that it will be useful,
11
// but WITHOUT ANY WARRANTY; without even the implied warranty of
12
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13
// GNU General Public License for more details.
14
//
15
// You should have received a copy of the GNU General Public License
16
// along with this program; if not, write to the Free Software
17
// Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
18
//
19
// Based on the public domain work of Thatcher Ulrich <tu@tulrich.com> 2004
20
21
#ifndef UTF8_H
22
#define UTF8_H
23
24
#include <string>
25
#include <boost/cstdint.hpp>
// for C99 int types
26
#include <vector>
27
28
#include "
dsodefs.h
"
// For DSOEXPORT
29
30
namespace
gnash {
31
33
//
55
//
59
namespace
utf8 {
60
62
//
66
//
69
DSOEXPORT
std::wstring
decodeCanonicalString
(
const
std::string& str,
int
version);
70
72
//
82
DSOEXPORT
std::string
encodeCanonicalString
(
const
std::wstring& wstr,
int
version);
83
85
//
90
DSOEXPORT
boost::uint32_t
decodeNextUnicodeCharacter
(std::string::const_iterator& it,
91
const
std::string::const_iterator&
e
);
92
95
DSOEXPORT
std::string
encodeUnicodeCharacter
(boost::uint32_t ucs_character);
96
98
//
101
DSOEXPORT
std::string
encodeLatin1Character
(boost::uint32_t ucsCharacter);
102
103
enum
TextEncoding
{
104
encUNSPECIFIED
,
105
encUTF8
,
106
encUTF16BE
,
107
encUTF16LE
,
108
encUTF32BE
,
109
encUTF32LE
,
110
encSCSU
,
111
encUTF7
,
112
encUTFEBCDIC
,
113
encBOCU1
114
};
115
117
//
140
DSOEXPORT
char
*
stripBOM
(
char
* in,
size_t
& size,
TextEncoding
& encoding);
141
143
DSOEXPORT
const
char
*
textEncodingName
(
TextEncoding
enc);
144
145
enum
EncodingGuess
{
146
ENCGUESS_UNICODE
= 0,
147
ENCGUESS_JIS
= 1,
148
ENCGUESS_OTHER
= 2
149
};
150
152
// Shift-Jis, UTF8, and other. Puts the DisplayObject count in length,
153
// and the offsets to the DisplayObjects in offsets, if offsets is not NULL.
154
// If not NULL, offsets should be at least s.length().
155
// offsets are not accurate if the return value is GUESSENC_OTHER
156
//
159
DSOEXPORT
EncodingGuess
guessEncoding
(
const
std::string&
s
,
int
&
length
,
160
std::vector<int>& offsets);
161
162
163
}
// namespace utf8
164
}
// namespace gnash
165
166
#endif // UTF8_H
167
168
169
// Local Variables:
170
// mode: C++
171
// c-basic-offset: 8
172
// tab-width: 8
173
// indent-tabs-mode: t
174
// End:
Generated on Wed Oct 23 2013 11:31:10 for Gnash by
1.8.4