EBOOKCharsetConverter.h
Go to the documentation of this file.
1 /* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
2 /*
3 * This file is part of the libe-book project.
4 *
5 * This Source Code Form is subject to the terms of the Mozilla Public
6 * License, v. 2.0. If a copy of the MPL was not distributed with this
7 * file, You can obtain one at http://mozilla.org/MPL/2.0/.
8 */
9
10 #ifndef EBOOKCHARSETCONVERTER_H_INCLUDED
11 #define EBOOKCHARSETCONVERTER_H_INCLUDED
12
13 #include <vector>
14
15 #include <unicode/ucnv.h>
16
17 namespace libebook
18 {
19
20 class EBOOKCharsetConverter
21 {
22 // disable copying
23 EBOOKCharsetConverter(const EBOOKCharsetConverter &other);
24 EBOOKCharsetConverter &operator=(const EBOOKCharsetConverter &other);
25
26 public:
27 explicit EBOOKCharsetConverter(const char *encoding = 0);
28 ~EBOOKCharsetConverter();
29
30 bool guessEncoding(const char *in, unsigned length);
31
32 bool convertBytes(const char *in, unsigned length, std::vector<char> &out);
33
34 private:
35 UConverter *m_converterToUnicode;
36 UConverter *m_converterToUTF8;
37 };
38
39 }
40
41 #endif // EBOOKCHARSETCONVERTER_H_INCLUDED
42
43 /* vim:set shiftwidth=2 softtabstop=2 expandtab: */
libebook::EBOOKCharsetConverter::operator=
EBOOKCharsetConverter & operator=(const EBOOKCharsetConverter &other)
libebook::EBOOKCharsetConverter
Definition: EBOOKCharsetConverter.h:20
libebook::EBOOKCharsetConverter::convertBytes
bool convertBytes(const char *in, unsigned length, std::vector< char > &out)
Definition: EBOOKCharsetConverter.cpp:117
libebook::EBOOKCharsetConverter::~EBOOKCharsetConverter
~EBOOKCharsetConverter()
Definition: EBOOKCharsetConverter.cpp:91
libebook::EBOOKCharsetConverter::guessEncoding
bool guessEncoding(const char *in, unsigned length)
Definition: EBOOKCharsetConverter.cpp:99
libebook
Definition: CHMParser.cpp:20
libebook::EBOOKCharsetConverter::EBOOKCharsetConverter
EBOOKCharsetConverter(const EBOOKCharsetConverter &other)
length
unsigned length
Definition: IMPParser.cpp:72
libebook::EBOOKCharsetConverter::m_converterToUnicode
UConverter * m_converterToUnicode
Definition: EBOOKCharsetConverter.h:35
encoding
const char * encoding
Definition: EBOOKHTMLParser.cpp:172
libebook::EBOOKCharsetConverter::m_converterToUTF8
UConverter * m_converterToUTF8
Definition: EBOOKCharsetConverter.h:36