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 <memory>
14 #include <vector>
15 
16 #include <unicode/ucnv.h>
17 
18 namespace libebook
19 {
20 
22 {
23  // disable copying
26 
27 public:
28  explicit EBOOKCharsetConverter(const char *encoding = nullptr);
30 
31  bool guessEncoding(const char *in, unsigned length);
32 
33  bool convertBytes(const char *in, unsigned length, std::vector<char> &out);
34 
35 private:
36  using UConverterPtr_t = std::unique_ptr<UConverter, void (*)(UConverter *)>;
39 };
40 
41 }
42 
43 #endif // EBOOKCHARSETCONVERTER_H_INCLUDED
44 
45 /* vim:set shiftwidth=2 softtabstop=2 expandtab: */
EBOOKCharsetConverter & operator=(const EBOOKCharsetConverter &other)
Definition: EBOOKCharsetConverter.h:21
std::unique_ptr< UConverter, void(*)(UConverter *)> UConverterPtr_t
Definition: EBOOKCharsetConverter.h:36
UConverterPtr_t m_converterToUnicode
Definition: EBOOKCharsetConverter.h:37
bool convertBytes(const char *in, unsigned length, std::vector< char > &out)
Definition: EBOOKCharsetConverter.cpp:109
unsigned length
Definition: SoftBookParser.cpp:73
~EBOOKCharsetConverter()
Definition: EBOOKCharsetConverter.cpp:87
bool guessEncoding(const char *in, unsigned length)
Definition: EBOOKCharsetConverter.cpp:91
Definition: BBeBCollector.cpp:18
EBOOKCharsetConverter(const EBOOKCharsetConverter &other)
UConverterPtr_t m_converterToUTF8
Definition: EBOOKCharsetConverter.h:38
const char * encoding
Definition: EBOOKHTMLParser.cpp:166

Generated for libe-book by doxygen 1.8.14