summaryrefslogtreecommitdiffstats
path: root/fbreader/src/network/atom/ATOMMetadata.h
blob: 3fb7619cddd7c9741f141cb2fbe02effd97f5e43 (plain)
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
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
/*
 * Copyright (C) 2009-2012 Geometer Plus <contact@geometerplus.com>
 *
 * This program is free software; you can redistribute it and/or modify
 * it under the terms of the GNU General Public License as published by
 * the Free Software Foundation; either version 2 of the License, or
 * (at your option) any later version.
 *
 * This program 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.
 *
 * You should have received a copy of the GNU General Public License
 * along with this program; if not, write to the Free Software
 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
 * 02110-1301, USA.
 */

#ifndef __ATOMMETADATA_H__
#define __ATOMMETADATA_H__

#include "ATOMConstructs.h"


class ATOMConstants {

private:
	ATOMConstants();

public:
	static const std::string TYPE_TEXT;
	static const std::string TYPE_HTML;
	static const std::string TYPE_XHTML;
	static const std::string TYPE_DEFAULT;
	
	static const std::string REL_ALTERNATE;
	static const std::string REL_RELATED;
	static const std::string REL_SELF;
	static const std::string REL_ENCLOSURE;
	static const std::string REL_VIA;
};





class ATOMAuthor : public ATOMPersonConstruct {

public:
	ATOMAuthor();
	ATOMAuthor(const std::string &name);
};



class ATOMCategory : public ATOMCommonAttributes {

public:
	static const std::string TERM;
	static const std::string SCHEME;
	static const std::string LABEL;

public:
	ATOMCategory();
	ATOMCategory(const std::string &termStr);

public:
	std::string &term() { return attributes()[TERM]; }
	std::string &scheme() { return attributes()[SCHEME]; }
	std::string &label() { return attributes()[LABEL]; }

	void readAttributes(const std::map<std::string, std::string> &attributes);
};



class ATOMContributor : public ATOMPersonConstruct {

public:
	ATOMContributor();
	ATOMContributor(const std::string &name);
};



class ATOMGenerator : public ATOMCommonAttributes {

public:
	static const std::string URI;
	static const std::string VERSION_ATT;

public:
	ATOMGenerator();
	ATOMGenerator(const std::string &text);

public:
	const std::string &text() const { return myText; }
	void setText(const std::string &text) { myText = text; }

	std::string &uri() { return attributes()[URI]; }
	std::string &version() { return attributes()[VERSION_ATT]; }

	void readAttributes(const std::map<std::string, std::string> &attributes);

private:
	std::string myText;
};



class ATOMIcon : public ATOMCommonAttributes {

public:
	ATOMIcon();
	ATOMIcon(const std::string &uri);

public:
	const std::string &uri() const { return myUri; }
	void setUri(const std::string &uri) { myUri = uri; }

private:
	std::string myUri;
};



class ATOMId : public ATOMCommonAttributes {

public:
	ATOMId();
	ATOMId(const std::string &uri);

	const ATOMId &operator = (const ATOMId &id);

	bool operator == (const ATOMId &id) const;
	bool operator != (const ATOMId &id) const;

public:
	const std::string &uri() const { return myUri; }
	void setUri(const std::string &uri) { myUri = uri; }

private:
	std::string myUri;
};

inline const ATOMId &ATOMId::operator = (const ATOMId &id) { myUri = id.myUri; return *this; }
inline bool ATOMId::operator == (const ATOMId &id) const { return myUri == id.myUri; }
inline bool ATOMId::operator != (const ATOMId &id) const { return myUri != id.myUri; }



class ATOMLink : public ATOMCommonAttributes {

public:
	static const std::string HREF;
	static const std::string REL;
	static const std::string TYPE;
	static const std::string HREFLANG;
	static const std::string TITLE;
	static const std::string LENGTH;

public:
	ATOMLink();
	ATOMLink(const std::string &hrefStr);
	ATOMLink(const std::string &hrefStr, const std::string &relStr);
	ATOMLink(const std::string &hrefStr, const std::string &relStr, const std::string &typeStr);
	ATOMLink(const std::string &hrefStr, const std::string &relStr, const std::string &typeStr, const std::string &titleStr);

public:
	std::string &href() { return attributes()[HREF]; }
	std::string &rel() { return attributes()[REL]; }
	std::string &type() { return attributes()[TYPE]; }
	std::string &hreflang() { return attributes()[HREFLANG]; }
	std::string &title() { return attributes()[TITLE]; }
	std::string &length() { return attributes()[LENGTH]; }

	void readAttributes(const std::map<std::string, std::string> &attributes);
};



class ATOMLogo : public ATOMCommonAttributes {

public:
	ATOMLogo();
	ATOMLogo(const std::string &uri);

public:
	const std::string &uri() const { return myUri; }
	void setUri(const std::string &uri) { myUri = uri; }

private:
	std::string myUri;
};


class ATOMPublished : public ATOMDateConstruct {

public:
	ATOMPublished();
	ATOMPublished(int year);
	ATOMPublished(int year, int month, int day);
	ATOMPublished(int year, int month, int day, int hour, int minutes, int seconds);
	ATOMPublished(int year, int month, int day, int hour, int minutes, int seconds, float sfract);
	ATOMPublished(int year, int month, int day, int hour, int minutes, int seconds, float sfract, int tzhour, int tzminutes);
};

class ATOMUpdated : public ATOMDateConstruct {

public:
	ATOMUpdated();
	ATOMUpdated(int year);
	ATOMUpdated(int year, int month, int day);
	ATOMUpdated(int year, int month, int day, int hour, int minutes, int seconds);
	ATOMUpdated(int year, int month, int day, int hour, int minutes, int seconds, float sfract);
	ATOMUpdated(int year, int month, int day, int hour, int minutes, int seconds, float sfract, int tzhour, int tzminutes);
};


#endif /* ATOMMETADATA */