The Power in your Hands
Search Site:
About
Features
Documentation
Download
Community
Main
Classes
Namespaces
Modules
include
Pt
Utf16Codec.h
1
/*
2
* Copyright (C) 2013 by Marc Boris Duerner
3
*
4
* This library is free software; you can redistribute it and/or
5
* modify it under the terms of the GNU Lesser General Public
6
* License as published by the Free Software Foundation; either
7
* version 2.1 of the License, or (at your option) any later version.
8
*
9
* As a special exception, you may use this file as part of a free
10
* software library without restriction. Specifically, if other files
11
* instantiate templates or use macros or inline functions from this
12
* file, or you compile this file and link it with other files to
13
* produce an executable, this file does not by itself cause the
14
* resulting executable to be covered by the GNU General Public
15
* License. This exception does not however invalidate any other
16
* reasons why the executable file might be covered by the GNU Library
17
* General Public License.
18
*
19
* This library is distributed in the hope that it will be useful,
20
* but WITHOUT ANY WARRANTY; without even the implied warranty of
21
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
22
* Lesser General Public License for more details.
23
*
24
* You should have received a copy of the GNU Lesser General Public
25
* License along with this library; if not, write to the Free Software
26
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
27
*/
28
29
#ifndef Pt_Utf16Codec_h
30
#define Pt_Utf16Codec_h
31
32
#include <Pt/Api.h>
33
#include <Pt/Types.h>
34
#include <Pt/TextCodec.h>
35
36
namespace
Pt {
37
42
class
PT_API
Utf16BECodec
:
public
TextCodec
<Char, char>
43
{
44
public
:
46
explicit
Utf16BECodec
(std::size_t ref = 0);
47
49
virtual
~
Utf16BECodec
();
50
51
// inheritdoc
52
virtual
result do_in(MBState& s,
53
const
char
* from,
const
char
* fromEnd,
const
char
*& fromNext,
54
Char
* to,
Char
* toEnd,
Char
*& toNext)
const
;
55
56
// inheritdoc
57
virtual
result do_out(MBState& s,
const
Char
* fromBegin,
58
const
Char
* fromEnd,
const
Char
*& fromNext,
59
char
* toBegin,
char
* toEnd,
char
*& toNext)
const
;
60
61
// inheritdoc
62
virtual
bool
do_always_noconv()
const
throw
();
63
64
// inheritdoc
65
virtual
int
do_length(MBState& s,
const
char
* fromBegin,
66
const
char
* fromEnd, std::size_t max)
const
;
67
// inheritdoc
68
virtual
int
do_max_length()
const
throw
();
69
70
// inheritdoc
71
std::codecvt_base::result do_unshift(Pt::MBState&,
char
*,
char
*,
char
*&)
const
;
72
73
// inheritdoc
74
int
do_encoding()
const
throw
();
75
};
76
81
class
PT_API
Utf16LECodec
:
public
TextCodec
<Char, char>
82
{
83
public
:
85
explicit
Utf16LECodec
(std::size_t ref = 0);
86
88
virtual
~
Utf16LECodec
();
89
90
// inheritdoc
91
virtual
result do_in(MBState& s,
92
const
char
* from,
const
char
* fromEnd,
const
char
*& fromNext,
93
Char
* to,
Char
* toEnd,
Char
*& toNext)
const
;
94
95
// inheritdoc
96
virtual
result do_out(MBState& s,
const
Char
* fromBegin,
97
const
Char
* fromEnd,
const
Char
*& fromNext,
98
char
* toBegin,
char
* toEnd,
char
*& toNext)
const
;
99
100
// inheritdoc
101
virtual
bool
do_always_noconv()
const
throw
();
102
103
// inheritdoc
104
virtual
int
do_length(MBState& s,
const
char
* fromBegin,
105
const
char
* fromEnd, std::size_t max)
const
;
106
// inheritdoc
107
virtual
int
do_max_length()
const
throw
();
108
109
// inheritdoc
110
std::codecvt_base::result do_unshift(Pt::MBState&,
char
*,
char
*,
char
*&)
const
;
111
112
// inheritdoc
113
int
do_encoding()
const
throw
();
114
};
115
116
}
//namespace Pt
117
118
#endif // Pt_Utf16Codec_h
Pt::Utf16BECodec
UTF-16 big endian codec.
Definition:
Utf16Codec.h:42
Pt::TextCodec
Converts between character encodings.
Definition:
TextCodec.h:38
Pt::Utf16LECodec
UTF-16 little endian codec.
Definition:
Utf16Codec.h:81
Pt::Char
Unicode character type.
Definition:
String.h:66