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
Definition BBeBCollector.cpp:19
libebook::BBeBImageType
BBeBImageType
Definition BBeBTypes.h:23
libebook::BBEB_IMAGE_TYPE_PNG
@ BBEB_IMAGE_TYPE_PNG
Definition BBeBTypes.h:26
libebook::BBEB_IMAGE_TYPE_UNKNOWN
@ BBEB_IMAGE_TYPE_UNKNOWN
Definition BBeBTypes.h:24
libebook::BBEB_IMAGE_TYPE_GIF
@ BBEB_IMAGE_TYPE_GIF
Definition BBeBTypes.h:28
libebook::BBEB_IMAGE_TYPE_JPEG
@ BBEB_IMAGE_TYPE_JPEG
Definition BBeBTypes.h:25
libebook::BBEB_IMAGE_TYPE_BMP
@ BBEB_IMAGE_TYPE_BMP
Definition BBeBTypes.h:27
libebook::BBeBAttributeMap_t
std::map< unsigned, BBeBAttributes > BBeBAttributeMap_t
Definition BBeBTypes.h:142
libebook::BBeBEmptyLinePosition
BBeBEmptyLinePosition
Definition BBeBTypes.h:32
libebook::BBEB_EMPTY_LINE_POSITION_BEFORE
@ BBEB_EMPTY_LINE_POSITION_BEFORE
Definition BBeBTypes.h:34
libebook::BBEB_EMPTY_LINE_POSITION_UNKNOWN
@ BBEB_EMPTY_LINE_POSITION_UNKNOWN
Definition BBeBTypes.h:33
libebook::BBEB_EMPTY_LINE_POSITION_AFTER
@ BBEB_EMPTY_LINE_POSITION_AFTER
Definition BBeBTypes.h:35
libebook::BBeBEmptyLineMode
BBeBEmptyLineMode
Definition BBeBTypes.h:39
libebook::BBEB_EMPTY_LINE_MODE_DASHED
@ BBEB_EMPTY_LINE_MODE_DASHED
Definition BBeBTypes.h:42
libebook::BBEB_EMPTY_LINE_MODE_DOTTED
@ BBEB_EMPTY_LINE_MODE_DOTTED
Definition BBeBTypes.h:44
libebook::BBEB_EMPTY_LINE_MODE_NONE
@ BBEB_EMPTY_LINE_MODE_NONE
Definition BBeBTypes.h:40
libebook::BBEB_EMPTY_LINE_MODE_DOUBLE
@ BBEB_EMPTY_LINE_MODE_DOUBLE
Definition BBeBTypes.h:43
libebook::BBEB_EMPTY_LINE_MODE_SOLID
@ BBEB_EMPTY_LINE_MODE_SOLID
Definition BBeBTypes.h:41
libebook::BBeBAlign
BBeBAlign
Definition BBeBTypes.h:48
libebook::BBEB_ALIGN_END
@ BBEB_ALIGN_END
Definition BBeBTypes.h:50
libebook::BBEB_ALIGN_START
@ BBEB_ALIGN_START
Definition BBeBTypes.h:49
libebook::BBEB_ALIGN_CENTER
@ BBEB_ALIGN_CENTER
Definition BBeBTypes.h:51
libebook::BBeBAttributes
Definition BBeBTypes.h:109
libebook::BBeBAttributes::fontWidth
boost::optional< unsigned > fontWidth
Definition BBeBTypes.h:113
libebook::BBeBAttributes::parSkip
boost::optional< unsigned > parSkip
Definition BBeBTypes.h:125
libebook::BBeBAttributes::fontSize
boost::optional< unsigned > fontSize
Definition BBeBTypes.h:112
libebook::BBeBAttributes::topSkip
boost::optional< unsigned > topSkip
Definition BBeBTypes.h:136
libebook::BBeBAttributes::fontFacename
boost::optional< std::string > fontFacename
Definition BBeBTypes.h:117
libebook::BBeBAttributes::align
boost::optional< BBeBAlign > align
Definition BBeBTypes.h:135
libebook::BBeBAttributes::height
boost::optional< unsigned > height
Definition BBeBTypes.h:126
libebook::BBeBAttributes::locationY
boost::optional< unsigned > locationY
Definition BBeBTypes.h:129
libebook::BBeBAttributes::heading
bool heading
Definition BBeBTypes.h:133
libebook::BBeBAttributes::evenSideMargin
boost::optional< unsigned > evenSideMargin
Definition BBeBTypes.h:139
libebook::BBeBAttributes::fontWeight
boost::optional< unsigned > fontWeight
Definition BBeBTypes.h:116
libebook::BBeBAttributes::emptyLine
boost::optional< BBeBEmptyLine > emptyLine
Definition BBeBTypes.h:134
libebook::BBeBAttributes::width
boost::optional< unsigned > width
Definition BBeBTypes.h:127
libebook::BBeBAttributes::textColor
boost::optional< BBeBColor > textColor
Definition BBeBTypes.h:118
libebook::BBeBAttributes::fontOrientation
boost::optional< unsigned > fontOrientation
Definition BBeBTypes.h:115
libebook::BBeBAttributes::oddSideMargin
boost::optional< unsigned > oddSideMargin
Definition BBeBTypes.h:138
libebook::BBeBAttributes::parIndent
boost::optional< unsigned > parIndent
Definition BBeBTypes.h:124
libebook::BBeBAttributes::sub
bool sub
Definition BBeBTypes.h:132
libebook::BBeBAttributes::sup
bool sup
Definition BBeBTypes.h:131
libebook::BBeBAttributes::BBeBAttributes
BBeBAttributes()
Definition BBeBTypes.cpp:73
libebook::BBeBAttributes::italic
bool italic
Definition BBeBTypes.h:130
libebook::BBeBAttributes::letterSpace
boost::optional< unsigned > letterSpace
Definition BBeBTypes.h:121
libebook::BBeBAttributes::topMargin
boost::optional< unsigned > topMargin
Definition BBeBTypes.h:137
libebook::BBeBAttributes::wordSpace
boost::optional< unsigned > wordSpace
Definition BBeBTypes.h:120
libebook::BBeBAttributes::baseLineSkip
boost::optional< unsigned > baseLineSkip
Definition BBeBTypes.h:122
libebook::BBeBAttributes::textBgColor
boost::optional< BBeBColor > textBgColor
Definition BBeBTypes.h:119
libebook::BBeBAttributes::fontEscapement
boost::optional< unsigned > fontEscapement
Definition BBeBTypes.h:114
libebook::BBeBAttributes::lineSpace
boost::optional< unsigned > lineSpace
Definition BBeBTypes.h:123
libebook::BBeBAttributes::locationX
boost::optional< unsigned > locationX
Definition BBeBTypes.h:128
libebook::BBeBBookInfo
Definition BBeBTypes.h:55
libebook::BBeBBookInfo::classification
std::string classification
Definition BBeBTypes.h:64
libebook::BBeBBookInfo::freeText
boost::optional< std::string > freeText
Definition BBeBTypes.h:65
libebook::BBeBBookInfo::BBeBBookInfo
BBeBBookInfo()
Definition BBeBTypes.cpp:15
libebook::BBeBBookInfo::categories
std::deque< std::string > categories
Definition BBeBTypes.h:63
libebook::BBeBBookInfo::publisher
std::string publisher
Definition BBeBTypes.h:61
libebook::BBeBBookInfo::author
std::string author
Definition BBeBTypes.h:58
libebook::BBeBBookInfo::label
boost::optional< std::string > label
Definition BBeBTypes.h:62
libebook::BBeBBookInfo::bookID
std::string bookID
Definition BBeBTypes.h:60
libebook::BBeBBookInfo::title
std::string title
Definition BBeBTypes.h:59
libebook::BBeBColor
Definition BBeBTypes.h:89
libebook::BBeBColor::r
unsigned char r
Definition BBeBTypes.h:94
libebook::BBeBColor::BBeBColor
BBeBColor()
Definition BBeBTypes.cpp:43
libebook::BBeBColor::a
unsigned char a
Definition BBeBTypes.h:97
libebook::BBeBColor::g
unsigned char g
Definition BBeBTypes.h:95
libebook::BBeBColor::b
unsigned char b
Definition BBeBTypes.h:96
libebook::BBeBDocInfo
Definition BBeBTypes.h:69
libebook::BBeBDocInfo::creationDate
std::string creationDate
Definition BBeBTypes.h:74
libebook::BBeBDocInfo::page
unsigned page
Definition BBeBTypes.h:76
libebook::BBeBDocInfo::language
std::string language
Definition BBeBTypes.h:72
libebook::BBeBDocInfo::creator
std::string creator
Definition BBeBTypes.h:73
libebook::BBeBDocInfo::BBeBDocInfo
BBeBDocInfo()
Definition BBeBTypes.cpp:27
libebook::BBeBDocInfo::producer
std::string producer
Definition BBeBTypes.h:75
libebook::BBeBEmptyLine
Definition BBeBTypes.h:101
libebook::BBeBEmptyLine::m_mode
BBeBEmptyLineMode m_mode
Definition BBeBTypes.h:105
libebook::BBeBEmptyLine::BBeBEmptyLine
BBeBEmptyLine()
Definition BBeBTypes.cpp:67
libebook::BBeBEmptyLine::m_position
BBeBEmptyLinePosition m_position
Definition BBeBTypes.h:104
libebook::BBeBMetadata
Definition BBeBTypes.h:80
libebook::BBeBMetadata::keyword
boost::optional< std::string > keyword
Definition BBeBTypes.h:85
libebook::BBeBMetadata::docInfo
BBeBDocInfo docInfo
Definition BBeBTypes.h:84
libebook::BBeBMetadata::bookInfo
BBeBBookInfo bookInfo
Definition BBeBTypes.h:83
libebook::BBeBMetadata::BBeBMetadata
BBeBMetadata()
Definition BBeBTypes.cpp:36