#pragma once #include #include #include #include #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 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 items; }; QDebug operator<<(QDebug debug, const AtomChannel &channel);