blob: 7f7294a426de5482b5b7b2aecc0bdaaf3b18f376 (
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
|
#pragma once
#include <QDateTime>
#include <QDebug>
#include <QList>
#include <QString>
#include "atomchannelimage.h"
#include "atomitem.h"
class QXmlStreamReader;
class AtomChannel
{
public:
// TODO: move to interface
static inline const QString xmlTag{"channel"};
public:
explicit AtomChannel(QXmlStreamReader *xmlReader);
public:
// TODO: update db data if differs. here and everywhere (item, user, etc)
/*!
* \brief getDbId - check if channel with corresponding `link` exists in db
* and return db id if any
* \return id on success, 0 otherwise
*/
int getDbId();
/*!
* \brief createInDb - create channel in db
* \return new channel id on success, 0 otherwise
*/
int createInDb();
/*!
* \brief getOrInsertDbId - get existing channel id or try to create a new
* channel and get its id
* \return existing or new channel id on success, 0 otherwise
*/
int getOrInsertDbId();
/*!
* \brief syncDbItems - create items in db if not exist
* \return list of new items ids
*/
QList<int> syncDbItems();
public:
/*!
* \brief m_id - cache db m_id
*/
int m_id{0};
QString title;
/*!
* \brief link - field called `link` in atom xml. Points to feed itself
*/
QUrl link;
QString description;
QDateTime lastBuildDate;
QLocale::Language language;
// ...
// TODO: shared_ptr
AtomChannelImage image;
QList<AtomItem> items;
};
QDebug operator<<(QDebug debug, const AtomChannel &channel);
|