BBeBTypes.h Source File documentation

BBeBTypes.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 BBEBTYPES_H_INCLUDED
11 #define BBEBTYPES_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 BBeBImageType
23 {
24 BBEB_IMAGE_TYPE_UNKNOWN = 0,
25 BBEB_IMAGE_TYPE_JPEG = 0x11,
26 BBEB_IMAGE_TYPE_PNG = 0x12,
27 BBEB_IMAGE_TYPE_BMP = 0x13,
28 BBEB_IMAGE_TYPE_GIF = 0x14
29 };
30
31 enum BBeBEmptyLinePosition
32 {
33 BBEB_EMPTY_LINE_POSITION_UNKNOWN,
34 BBEB_EMPTY_LINE_POSITION_BEFORE,
35 BBEB_EMPTY_LINE_POSITION_AFTER
36 };
37
38 enum BBeBEmptyLineMode
39 {
40 BBEB_EMPTY_LINE_MODE_NONE,
41 BBEB_EMPTY_LINE_MODE_SOLID,
42 BBEB_EMPTY_LINE_MODE_DASHED,
43 BBEB_EMPTY_LINE_MODE_DOUBLE,
44 BBEB_EMPTY_LINE_MODE_DOTTED
45 };
46
47 enum BBeBAlign
48 {
49 BBEB_ALIGN_START,
50 BBEB_ALIGN_END,
51 BBEB_ALIGN_CENTER
52 };
53
54 struct BBeBBookInfo
55 {
56 BBeBBookInfo();
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 BBeBDocInfo
69 {
70 BBeBDocInfo();
71
72 std::string language;
73 std::string creator;
74 std::string creationDate;
75 std::string producer;
76 unsigned page;
77 };
78
79 struct BBeBMetadata
80 {
81 BBeBMetadata();
82
83 BBeBBookInfo bookInfo;
84 BBeBDocInfo docInfo;
85 boost::optional<std::string> keyword;
86 };
87
88 struct BBeBColor
89 {
90 BBeBColor();
91 explicit BBeBColor(unsigned color);
92 BBeBColor(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 BBeBEmptyLine
101 {
102 BBeBEmptyLine();
103
104 BBeBEmptyLinePosition m_position;
105 BBeBEmptyLineMode m_mode;
106 };
107
108 struct BBeBAttributes
109 {
110 BBeBAttributes();
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<BBeBColor> textColor;
119 boost::optional<BBeBColor> 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<BBeBEmptyLine> emptyLine;
135 boost::optional<BBeBAlign> 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, BBeBAttributes> BBeBAttributeMap_t;
143
144 }
145
146 #endif // BBEBTYPES_H_INCLUDED
147
148 /* vim:set shiftwidth=2 softtabstop=2 expandtab: */
libebook::BBeBAttributes::emptyLine
boost::optional< BBeBEmptyLine > emptyLine
Definition: BBeBTypes.h:134
libebook::BBeBEmptyLineMode
BBeBEmptyLineMode
Definition: BBeBTypes.h:38
libebook::BBeBDocInfo::creationDate
std::string creationDate
Definition: BBeBTypes.h:74
libebook::BBEB_EMPTY_LINE_POSITION_AFTER
Definition: BBeBTypes.h:35
libebook::BBEB_EMPTY_LINE_POSITION_BEFORE
Definition: BBeBTypes.h:34
libebook::BBeBAttributes::evenSideMargin
boost::optional< unsigned > evenSideMargin
Definition: BBeBTypes.h:139
libebook::BBEB_EMPTY_LINE_POSITION_UNKNOWN
Definition: BBeBTypes.h:33
libebook::BBeBAttributes::topSkip
boost::optional< unsigned > topSkip
Definition: BBeBTypes.h:136
libebook::BBEB_EMPTY_LINE_MODE_DOTTED
Definition: BBeBTypes.h:44
libebook::BBEB_EMPTY_LINE_MODE_DOUBLE
Definition: BBeBTypes.h:43
libebook::BBeBAttributes::heading
bool heading
Definition: BBeBTypes.h:133
libebook::BBeBAttributes::italic
bool italic
Definition: BBeBTypes.h:130
libebook::BBeBEmptyLine::BBeBEmptyLine
BBeBEmptyLine()
Definition: BBeBTypes.cpp:67
libebook::BBeBAttributes::oddSideMargin
boost::optional< unsigned > oddSideMargin
Definition: BBeBTypes.h:138
libebook::BBeBAttributes::textColor
boost::optional< BBeBColor > textColor
Definition: BBeBTypes.h:118
libebook::BBeBDocInfo::page
unsigned page
Definition: BBeBTypes.h:76
libebook::BBeBImageType
BBeBImageType
Definition: BBeBTypes.h:22
libebook::BBeBAttributes::width
boost::optional< unsigned > width
Definition: BBeBTypes.h:127
libebook::BBeBAttributes::fontOrientation
boost::optional< unsigned > fontOrientation
Definition: BBeBTypes.h:115
libebook::BBeBAttributes::fontEscapement
boost::optional< unsigned > fontEscapement
Definition: BBeBTypes.h:114
libebook::BBEB_IMAGE_TYPE_PNG
Definition: BBeBTypes.h:26
libebook::EBOOKHTMLToken::green
Definition: EBOOKHTMLToken.h:285
libebook::BBeBAttributes::sub
bool sub
Definition: BBeBTypes.h:132
libebook::BBeBEmptyLine::m_position
BBeBEmptyLinePosition m_position
Definition: BBeBTypes.h:104
libebook::BBeBAttributes::parSkip
boost::optional< unsigned > parSkip
Definition: BBeBTypes.h:125
libebook::BBeBAttributes::fontWeight
boost::optional< unsigned > fontWeight
Definition: BBeBTypes.h:116
libebook::BBeBBookInfo::freeText
boost::optional< std::string > freeText
Definition: BBeBTypes.h:65
libebook::BBeBMetadata::BBeBMetadata
BBeBMetadata()
Definition: BBeBTypes.cpp:36
libebook::BBeBAttributeMap_t
std::map< unsigned, BBeBAttributes > BBeBAttributeMap_t
Definition: BBeBTypes.h:142
libebook::BBeBBookInfo::categories
std::deque< std::string > categories
Definition: BBeBTypes.h:63
libebook::EBOOKHTMLToken::color
Definition: EBOOKHTMLToken.h:181
libebook::BBeBAttributes::wordSpace
boost::optional< unsigned > wordSpace
Definition: BBeBTypes.h:120
libebook::BBEB_EMPTY_LINE_MODE_SOLID
Definition: BBeBTypes.h:41
libebook::BBeBEmptyLinePosition
BBeBEmptyLinePosition
Definition: BBeBTypes.h:31
libebook::BBeBEmptyLine
Definition: BBeBTypes.h:100
libebook::BBeBAttributes::locationY
boost::optional< unsigned > locationY
Definition: BBeBTypes.h:129
libebook::BBEB_EMPTY_LINE_MODE_NONE
Definition: BBeBTypes.h:40
libebook::BBeBColor::r
unsigned char r
Definition: BBeBTypes.h:94
libebook::BBeBAttributes
Definition: BBeBTypes.h:108
libebook::BBeBAttributes::height
boost::optional< unsigned > height
Definition: BBeBTypes.h:126
libebook::BBeBColor::b
unsigned char b
Definition: BBeBTypes.h:96
libebook::BBeBBookInfo::classification
std::string classification
Definition: BBeBTypes.h:64
libebook::BBEB_IMAGE_TYPE_UNKNOWN
Definition: BBeBTypes.h:24
libebook::BBeBAttributes::fontSize
boost::optional< unsigned > fontSize
Definition: BBeBTypes.h:112
libebook::BBeBColor::g
unsigned char g
Definition: BBeBTypes.h:95
libebook::BBeBAttributes::BBeBAttributes
BBeBAttributes()
Definition: BBeBTypes.cpp:73
libebook::BBEB_IMAGE_TYPE_BMP
Definition: BBeBTypes.h:27
libebook::BBEB_IMAGE_TYPE_JPEG
Definition: BBeBTypes.h:25
libebook::BBeBColor::BBeBColor
BBeBColor()
Definition: BBeBTypes.cpp:43
libebook::BBeBAttributes::sup
bool sup
Definition: BBeBTypes.h:131
libebook::BBeBBookInfo::bookID
std::string bookID
Definition: BBeBTypes.h:60
libebook::BBeBAttributes::baseLineSkip
boost::optional< unsigned > baseLineSkip
Definition: BBeBTypes.h:122
libebook::BBEB_ALIGN_END
Definition: BBeBTypes.h:50
libebook::BBeBAttributes::letterSpace
boost::optional< unsigned > letterSpace
Definition: BBeBTypes.h:121
libebook::BBeBMetadata
Definition: BBeBTypes.h:79
libebook::BBeBDocInfo::creator
std::string creator
Definition: BBeBTypes.h:73
libebook::BBeBBookInfo::label
boost::optional< std::string > label
Definition: BBeBTypes.h:62
libebook::BBEB_EMPTY_LINE_MODE_DASHED
Definition: BBeBTypes.h:42
libebook::BBeBBookInfo
Definition: BBeBTypes.h:54
libebook::BBeBColor::a
unsigned char a
Definition: BBeBTypes.h:97
libebook::BBeBAttributes::lineSpace
boost::optional< unsigned > lineSpace
Definition: BBeBTypes.h:123
libebook::BBeBDocInfo::BBeBDocInfo
BBeBDocInfo()
Definition: BBeBTypes.cpp:27
libebook::BBeBAttributes::align
boost::optional< BBeBAlign > align
Definition: BBeBTypes.h:135
libebook::BBEB_IMAGE_TYPE_GIF
Definition: BBeBTypes.h:28
libebook::BBeBMetadata::keyword
boost::optional< std::string > keyword
Definition: BBeBTypes.h:85
libebook::BBeBAttributes::topMargin
boost::optional< unsigned > topMargin
Definition: BBeBTypes.h:137
libebook::BBEB_ALIGN_START
Definition: BBeBTypes.h:49
libebook
Definition: BBeBCollector.cpp:18
libebook::BBeBBookInfo::BBeBBookInfo
BBeBBookInfo()
Definition: BBeBTypes.cpp:15
libebook::BBeBAttributes::fontFacename
boost::optional< std::string > fontFacename
Definition: BBeBTypes.h:117
libebook::EBOOKHTMLToken::blue
Definition: EBOOKHTMLToken.h:275
libebook::BBeBBookInfo::publisher
std::string publisher
Definition: BBeBTypes.h:61
libebook::BBeBEmptyLine::m_mode
BBeBEmptyLineMode m_mode
Definition: BBeBTypes.h:105
libebook::BBeBAttributes::locationX
boost::optional< unsigned > locationX
Definition: BBeBTypes.h:128
libebook::BBeBMetadata::bookInfo
BBeBBookInfo bookInfo
Definition: BBeBTypes.h:83
libebook::BBeBColor
Definition: BBeBTypes.h:88
libebook::BBeBAttributes::fontWidth
boost::optional< unsigned > fontWidth
Definition: BBeBTypes.h:113
libebook::BBeBDocInfo::language
std::string language
Definition: BBeBTypes.h:72
libebook::BBeBAttributes::textBgColor
boost::optional< BBeBColor > textBgColor
Definition: BBeBTypes.h:119
libebook::BBeBAlign
BBeBAlign
Definition: BBeBTypes.h:47
libebook::BBEB_ALIGN_CENTER
Definition: BBeBTypes.h:51
libebook::BBeBAttributes::parIndent
boost::optional< unsigned > parIndent
Definition: BBeBTypes.h:124
libebook::EBOOKHTMLToken::red
Definition: EBOOKHTMLToken.h:306
libebook::BBeBDocInfo
Definition: BBeBTypes.h:68
libebook::BBeBBookInfo::author
std::string author
Definition: BBeBTypes.h:58
libebook::BBeBDocInfo::producer
std::string producer
Definition: BBeBTypes.h:75
libebook::BBeBBookInfo::title
std::string title
Definition: BBeBTypes.h:59
libebook::BBeBMetadata::docInfo
BBeBDocInfo docInfo
Definition: BBeBTypes.h:84