This repository has been archived by the owner on Jan 8, 2024. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 17
/
pdf-unicode.hh
90 lines (73 loc) · 1.86 KB
/
pdf-unicode.hh
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
/* Copyright © 2007-2019 Jakub Wilk <[email protected]>
*
* This file is part of pdf2djvu.
*
* pdf2djvu is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License version 2 as
* published by the Free Software Foundation.
*
* pdf2djvu is distributed in the hope that it will be useful, but
* WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* General Public License for more details.
*/
#ifndef PDF2DJVU_PDF_UNICODE_H
#define PDF2DJVU_PDF_UNICODE_H
#include <ostream>
#include <string>
#include <CharTypes.h>
#include "pdf-backend.hh"
namespace pdf
{
/* Unicode → UTF-8 conversion
* ==========================
*/
void write_as_utf8(std::ostream &stream, Unicode unicode_char);
std::string string_as_utf8(const pdf::String *);
std::string string_as_utf8(pdf::Object &);
/* class pdf::NFKC
* ===============
*/
class NFKC
{
public:
virtual int length() const = 0;
virtual operator const Unicode*() const = 0;
virtual ~NFKC()
{ }
};
/* class pdf::FullNFKC
* ===================
*/
class FullNFKC : public NFKC
{
protected:
Unicode* data;
int length_;
public:
explicit FullNFKC(const Unicode *, int length);
~FullNFKC();
int length() const
{
return this->length_;
}
operator const Unicode*() const
{
return this->data;
}
};
/* class pdf::MinimalNFKC
* ======================
*/
class MinimalNFKC : public NFKC
{
protected:
std::basic_string<Unicode> string;
public:
explicit MinimalNFKC(const Unicode *, int length);
int length() const;
operator const Unicode*() const;
};
}
#endif
// vim:ts=4 sts=4 sw=4 et