LRFTypes.h Source File documentation

LRFTypes.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 LRFTYPES_H_INCLUDED
11 #define LRFTYPES_H_INCLUDED
12
13 #include <deque>
14 #include <map>
15 #include <string>
16
17 #include <boost/optional.hpp>
18
19 namespace libebook
20 {
21
22 enum LRFImageType
23 {
24 LRF_IMAGE_TYPE_UNKNOWN = 0,
25 LRF_IMAGE_TYPE_JPEG = 0x11,
26 LRF_IMAGE_TYPE_PNG = 0x12,
27 LRF_IMAGE_TYPE_BMP = 0x13,
28 LRF_IMAGE_TYPE_GIF = 0x14
29 };
30
31 enum LRFEmptyLinePosition
32 {
33 LRF_EMPTY_LINE_POSITION_UNKNOWN,
34 LRF_EMPTY_LINE_POSITION_BEFORE,
35 LRF_EMPTY_LINE_POSITION_AFTER
36 };
37
38 enum LRFEmptyLineMode
39 {
40 LRF_EMPTY_LINE_MODE_NONE,
41 LRF_EMPTY_LINE_MODE_SOLID,
42 LRF_EMPTY_LINE_MODE_DASHED,
43 LRF_EMPTY_LINE_MODE_DOUBLE,
44 LRF_EMPTY_LINE_MODE_DOTTED
45 };
46
47 enum LRFAlign
48 {
49 LRF_ALIGN_START,
50 LRF_ALIGN_END,
51 LRF_ALIGN_CENTER
52 };
53
54 struct LRFBookInfo
55 {
56 LRFBookInfo();
57
58 std::string author;
59 std::string title;
60 std::string bookID;
61 std::string publisher;
62 boost::optional<std::string> label;
63 std::deque<std::string> categories;
64 std::string classification;
65 boost::optional<std::string> freeText;
66 };
67
68 struct LRFDocInfo
69 {
70 LRFDocInfo();
71
72 std::string language;
73 std::string creator;
74 std::string creationDate;
75 std::string producer;
76 unsigned page;
77 };
78
79 struct LRFMetadata
80 {
81 LRFMetadata();
82
83 LRFBookInfo bookInfo;
84 LRFDocInfo docInfo;
85 boost::optional<std::string> keyword;
86 };
87
88 struct LRFColor
89 {
90 LRFColor();
91 explicit LRFColor(unsigned color);
92 LRFColor(unsigned char red, unsigned char green, unsigned char blue, unsigned char alpha = 0);
93
94 unsigned char r;
95 unsigned char g;
96 unsigned char b;
97 unsigned char a;
98 };
99
100 struct LRFEmptyLine
101 {
102 LRFEmptyLine();
103
104 LRFEmptyLinePosition m_position;
105 LRFEmptyLineMode m_mode;
106 };
107
108 struct LRFAttributes
109 {
110 LRFAttributes();
111
112 boost::optional<unsigned> fontSize;
113 boost::optional<unsigned> fontWidth;
114 boost::optional<unsigned> fontEscapement;
115 boost::optional<unsigned> fontOrientation;
116 boost::optional<unsigned> fontWeight;
117 boost::optional<std::string> fontFacename;
118 boost::optional<LRFColor> textColor;
119 boost::optional<LRFColor> textBgColor;
120 boost::optional<unsigned> wordSpace;
121 boost::optional<unsigned> letterSpace;
122 boost::optional<unsigned> baseLineSkip;
123 boost::optional<unsigned> lineSpace;
124 boost::optional<unsigned> parIndent;
125 boost::optional<unsigned> parSkip;
126 boost::optional<unsigned> height;
127 boost::optional<unsigned> width;
128 boost::optional<unsigned> locationX;
129 boost::optional<unsigned> locationY;
130 bool italic;
131 bool sup;
132 bool sub;
133 bool heading;
134 boost::optional<LRFEmptyLine> emptyLine;
135 boost::optional<LRFAlign> align;
136 boost::optional<unsigned> topSkip;
137 boost::optional<unsigned> topMargin;
138 boost::optional<unsigned> oddSideMargin;
139 boost::optional<unsigned> evenSideMargin;
140 };
141
142 typedef std::map<unsigned, LRFAttributes> LRFAttributeMap_t;
143
144 }
145
146 #endif // LRFTYPES_H_INCLUDED
147
148 /* vim:set shiftwidth=2 softtabstop=2 expandtab: */
libebook::LRFAttributes::parSkip
boost::optional< unsigned > parSkip
Definition: LRFTypes.h:125
libebook::LRF_EMPTY_LINE_MODE_DOUBLE
Definition: LRFTypes.h:43
libebook::LRFAttributes
Definition: LRFTypes.h:108
libebook::LRFAlign
LRFAlign
Definition: LRFTypes.h:47
libebook::LRF_EMPTY_LINE_POSITION_AFTER
Definition: LRFTypes.h:35
libebook::LRFAttributes::textBgColor
boost::optional< LRFColor > textBgColor
Definition: LRFTypes.h:119
libebook::LRFAttributes::topSkip
boost::optional< unsigned > topSkip
Definition: LRFTypes.h:136
libebook::LRFBookInfo::title
std::string title
Definition: LRFTypes.h:59
libebook::LRFBookInfo::author
std::string author
Definition: LRFTypes.h:58
libebook::LRF_EMPTY_LINE_MODE_NONE
Definition: LRFTypes.h:40
libebook::LRF_ALIGN_CENTER
Definition: LRFTypes.h:51
libebook::LRFBookInfo::publisher
std::string publisher
Definition: LRFTypes.h:61
libebook::LRFAttributes::fontEscapement
boost::optional< unsigned > fontEscapement
Definition: LRFTypes.h:114
libebook::LRF_ALIGN_END
Definition: LRFTypes.h:50
libebook::LRFAttributes::heading
bool heading
Definition: LRFTypes.h:133
libebook::LRFDocInfo::page
unsigned page
Definition: LRFTypes.h:76
libebook::LRFColor::b
unsigned char b
Definition: LRFTypes.h:96
libebook::LRFAttributes::oddSideMargin
boost::optional< unsigned > oddSideMargin
Definition: LRFTypes.h:138
libebook::LRF_EMPTY_LINE_MODE_DOTTED
Definition: LRFTypes.h:44
libebook::LRFImageType
LRFImageType
Definition: LRFTypes.h:22
libebook::EBOOKHTMLToken::green
Definition: EBOOKHTMLToken.h:287
libebook::LRFDocInfo::creationDate
std::string creationDate
Definition: LRFTypes.h:74
libebook::LRFAttributes::lineSpace
boost::optional< unsigned > lineSpace
Definition: LRFTypes.h:123
libebook::EBOOKHTMLToken::color
Definition: EBOOKHTMLToken.h:183
libebook::LRFAttributes::parIndent
boost::optional< unsigned > parIndent
Definition: LRFTypes.h:124
libebook::LRFAttributes::fontFacename
boost::optional< std::string > fontFacename
Definition: LRFTypes.h:117
libebook::LRFAttributes::evenSideMargin
boost::optional< unsigned > evenSideMargin
Definition: LRFTypes.h:139
libebook::LRFEmptyLine
Definition: LRFTypes.h:100
libebook::LRFDocInfo::language
std::string language
Definition: LRFTypes.h:72
libebook::LRF_ALIGN_START
Definition: LRFTypes.h:49
libebook::LRFEmptyLine::m_mode
LRFEmptyLineMode m_mode
Definition: LRFTypes.h:105
libebook::LRFColor::g
unsigned char g
Definition: LRFTypes.h:95
libebook::LRFBookInfo
Definition: LRFTypes.h:54
libebook::LRFColor::r
unsigned char r
Definition: LRFTypes.h:94
libebook::LRF_IMAGE_TYPE_UNKNOWN
Definition: LRFTypes.h:24
libebook::LRFAttributes::align
boost::optional< LRFAlign > align
Definition: LRFTypes.h:135
libebook::LRFAttributes::textColor
boost::optional< LRFColor > textColor
Definition: LRFTypes.h:118
libebook::LRFDocInfo::producer
std::string producer
Definition: LRFTypes.h:75
libebook::LRFAttributes::fontOrientation
boost::optional< unsigned > fontOrientation
Definition: LRFTypes.h:115
libebook::LRFAttributes::sub
bool sub
Definition: LRFTypes.h:132
libebook::LRFDocInfo
Definition: LRFTypes.h:68
libebook::LRFAttributes::height
boost::optional< unsigned > height
Definition: LRFTypes.h:126
libebook::LRF_EMPTY_LINE_MODE_DASHED
Definition: LRFTypes.h:42
libebook::LRFBookInfo::label
boost::optional< std::string > label
Definition: LRFTypes.h:62
libebook::LRFAttributes::locationX
boost::optional< unsigned > locationX
Definition: LRFTypes.h:128
libebook::LRFEmptyLinePosition
LRFEmptyLinePosition
Definition: LRFTypes.h:31
libebook::LRFBookInfo::freeText
boost::optional< std::string > freeText
Definition: LRFTypes.h:65
libebook::LRFColor::a
unsigned char a
Definition: LRFTypes.h:97
libebook::LRF_EMPTY_LINE_MODE_SOLID
Definition: LRFTypes.h:41
libebook::LRFMetadata::docInfo
LRFDocInfo docInfo
Definition: LRFTypes.h:84
libebook::LRF_IMAGE_TYPE_PNG
Definition: LRFTypes.h:26
libebook::LRF_IMAGE_TYPE_GIF
Definition: LRFTypes.h:28
libebook::LRFAttributes::baseLineSkip
boost::optional< unsigned > baseLineSkip
Definition: LRFTypes.h:122
libebook::LRFBookInfo::LRFBookInfo
LRFBookInfo()
Definition: LRFTypes.cpp:15
libebook::LRF_EMPTY_LINE_POSITION_UNKNOWN
Definition: LRFTypes.h:33
libebook::LRFMetadata::keyword
boost::optional< std::string > keyword
Definition: LRFTypes.h:85
libebook::LRF_IMAGE_TYPE_JPEG
Definition: LRFTypes.h:25
libebook::LRFMetadata::bookInfo
LRFBookInfo bookInfo
Definition: LRFTypes.h:83
libebook::LRFAttributes::italic
bool italic
Definition: LRFTypes.h:130
libebook::LRFAttributes::topMargin
boost::optional< unsigned > topMargin
Definition: LRFTypes.h:137
libebook::LRF_EMPTY_LINE_POSITION_BEFORE
Definition: LRFTypes.h:34
libebook::LRFAttributes::wordSpace
boost::optional< unsigned > wordSpace
Definition: LRFTypes.h:120
libebook::LRFAttributes::letterSpace
boost::optional< unsigned > letterSpace
Definition: LRFTypes.h:121
libebook::LRFAttributes::width
boost::optional< unsigned > width
Definition: LRFTypes.h:127
libebook::LRFBookInfo::bookID
std::string bookID
Definition: LRFTypes.h:60
libebook
Definition: CHMParser.cpp:20
libebook::LRFEmptyLineMode
LRFEmptyLineMode
Definition: LRFTypes.h:38
libebook::LRFMetadata
Definition: LRFTypes.h:79
libebook::LRFEmptyLine::m_position
LRFEmptyLinePosition m_position
Definition: LRFTypes.h:104
libebook::LRFAttributes::locationY
boost::optional< unsigned > locationY
Definition: LRFTypes.h:129
libebook::LRFAttributes::sup
bool sup
Definition: LRFTypes.h:131
libebook::EBOOKHTMLToken::blue
Definition: EBOOKHTMLToken.h:277
libebook::LRFAttributes::fontWidth
boost::optional< unsigned > fontWidth
Definition: LRFTypes.h:113
libebook::LRFColor
Definition: LRFTypes.h:88
libebook::LRF_IMAGE_TYPE_BMP
Definition: LRFTypes.h:27
libebook::LRFAttributes::emptyLine
boost::optional< LRFEmptyLine > emptyLine
Definition: LRFTypes.h:134
libebook::LRFDocInfo::creator
std::string creator
Definition: LRFTypes.h:73
libebook::EBOOKHTMLToken::red
Definition: EBOOKHTMLToken.h:308
libebook::LRFBookInfo::categories
std::deque< std::string > categories
Definition: LRFTypes.h:63
libebook::LRFAttributeMap_t
std::map< unsigned, LRFAttributes > LRFAttributeMap_t
Definition: LRFTypes.h:142
libebook::LRFAttributes::fontWeight
boost::optional< unsigned > fontWeight
Definition: LRFTypes.h:116
libebook::LRFBookInfo::classification
std::string classification
Definition: LRFTypes.h:64
libebook::LRFAttributes::fontSize
boost::optional< unsigned > fontSize
Definition: LRFTypes.h:112