2020-12-30 22:07:54 -06:00
|
|
|
/*
|
|
|
|
* Copyright 2020, Jaidyn Levesque <jadedctrl@teknik.io>
|
|
|
|
* All rights reserved. Distributed under the terms of the MIT license.
|
|
|
|
*/
|
2020-07-08 03:20:03 -05:00
|
|
|
#ifndef FEED_H
|
|
|
|
#define FEED_H
|
2020-06-19 17:03:19 -05:00
|
|
|
|
2020-12-30 22:07:54 -06:00
|
|
|
|
2020-07-04 04:44:54 -05:00
|
|
|
#include <tinyxml2.h>
|
2020-12-30 22:07:54 -06:00
|
|
|
|
2020-08-14 01:59:15 -05:00
|
|
|
#include "Entry.h"
|
2020-06-18 02:02:44 -05:00
|
|
|
|
2020-12-30 22:07:54 -06:00
|
|
|
|
|
|
|
class BDateTime;
|
|
|
|
class BString;
|
|
|
|
class BList;
|
|
|
|
class BUrl;
|
|
|
|
|
|
|
|
|
2020-07-08 03:20:03 -05:00
|
|
|
class Feed {
|
2020-06-18 02:02:44 -05:00
|
|
|
public:
|
2020-12-30 22:07:54 -06:00
|
|
|
Feed(BString);
|
2021-01-09 16:53:39 -06:00
|
|
|
Feed(Feed*);
|
2020-12-30 22:07:54 -06:00
|
|
|
Feed();
|
|
|
|
|
|
|
|
virtual void Parse();
|
|
|
|
|
|
|
|
bool IsRemote();
|
|
|
|
bool IsUpdated();
|
|
|
|
bool IsRss();
|
|
|
|
bool IsAtom();
|
|
|
|
|
2021-01-09 16:53:39 -06:00
|
|
|
BString FetchRemoteFeed();
|
|
|
|
|
2020-12-30 22:07:54 -06:00
|
|
|
bool AddEntry(Entry*);
|
|
|
|
BList GetEntries();
|
|
|
|
bool SetTitle(const char*);
|
|
|
|
bool SetTitle(tinyxml2::XMLElement*);
|
|
|
|
BString GetTitle();
|
|
|
|
bool SetDesc(const char*);
|
|
|
|
bool SetDesc(tinyxml2::XMLElement*);
|
|
|
|
BString GetDesc();
|
|
|
|
bool SetHomeUrl(const char*);
|
|
|
|
bool SetHomeUrl(tinyxml2::XMLElement*);
|
|
|
|
BString GetHomeUrl();
|
2021-01-09 16:53:39 -06:00
|
|
|
BString GetXmlUrl();
|
2020-12-30 22:07:54 -06:00
|
|
|
bool SetDate(const char*);
|
|
|
|
bool SetDate(tinyxml2::XMLElement*);
|
|
|
|
BDateTime GetDate();
|
|
|
|
|
|
|
|
BString SetCachePath(BString);
|
|
|
|
BString GetCachePath();
|
2020-07-08 04:43:35 -05:00
|
|
|
|
|
|
|
protected:
|
2020-12-30 22:07:54 -06:00
|
|
|
void EnsureCached();
|
|
|
|
int xmlCountSiblings(tinyxml2::XMLElement*, const char*);
|
2020-11-16 21:32:06 -06:00
|
|
|
|
|
|
|
BString title;
|
|
|
|
BString description;
|
|
|
|
BDateTime date;
|
|
|
|
BDateTime lastDate;
|
|
|
|
BDateTime minDate;
|
|
|
|
BDateTime maxDate;
|
|
|
|
BString homeUrl;
|
|
|
|
BString inputPath;
|
|
|
|
BString xmlUrl;
|
|
|
|
BString cachePath;
|
|
|
|
BString outputDir;
|
|
|
|
BList entries;
|
|
|
|
bool fetched;
|
|
|
|
bool updated;
|
2020-06-18 02:02:44 -05:00
|
|
|
};
|
|
|
|
|
2020-12-30 22:07:54 -06:00
|
|
|
|
2020-06-19 17:03:19 -05:00
|
|
|
#endif
|
2020-12-30 22:07:54 -06:00
|
|
|
|