Utf32Codec.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_Utf32Codec_h
30#define Pt_Utf32Codec_h
31
32#include <Pt/Api.h>
33#include <Pt/Types.h>
34#include <Pt/TextCodec.h>
35
36namespace Pt {
37
42class PT_API Utf32BECodec : public TextCodec<Char, char>
43{
44 public:
46 explicit Utf32BECodec(std::size_t ref = 0);
47
49 virtual ~Utf32BECodec();
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
77
82class PT_API Utf32LECodec : public TextCodec<Char, char>
83{
84 public:
86 explicit Utf32LECodec(std::size_t ref = 0);
87
89 virtual ~Utf32LECodec();
90
91 // inheritdoc
92 virtual result do_in(MBState& s,
93 const char* from, const char* fromEnd, const char*& fromNext,
94 Char* to, Char* toEnd, Char*& toNext) const ;
95
96 // inheritdoc
97 virtual result do_out(MBState& s, const Char* fromBegin,
98 const Char* fromEnd, const Char*& fromNext,
99 char* toBegin, char* toEnd, char*& toNext) const;
100
101 // inheritdoc
102 virtual int do_length(MBState& s, const char* fromBegin,
103 const char* fromEnd, std::size_t max) const;
104
105 // inheritdoc
106 virtual bool do_always_noconv() const throw();
107
108 // inheritdoc
109 virtual int do_max_length() const throw() ;
110
111 // inheritdoc
112 std::codecvt_base::result do_unshift(Pt::MBState&, char*, char*, char*&) const;
113
114 // inheritdoc
115 int do_encoding() const throw();
116};
117
118} // namespace Pt
119
120#endif //Pt_Utf32Codec_h
TextCodec(std::size_t ref=0)
virtual ~Utf32BECodec()
Destructor.
Utf32BECodec(std::size_t ref=0)
Constructor.
virtual ~Utf32LECodec()
Destructor.
Utf32LECodec(std::size_t ref=0)
Constructor.
Core module.
Definition Allocator.h:33
Unicode character type.
Definition String.h:67