Pogger/src/Feed.h

83 lines
1.2 KiB
C
Raw Normal View History

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.
*/
#ifndef FEED_H
#define FEED_H
2020-06-19 17:03:19 -05:00
2020-12-30 22:07:54 -06: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;
2021-01-12 15:30:21 -06:00
class BEntry;
2020-12-30 22:07:54 -06:00
class BString;
class BList;
class BUrl;
class Feed {
2020-06-18 02:02:44 -05:00
public:
2021-01-11 18:08:15 -06:00
Feed(BUrl);
Feed(BUrl, BString);
2021-01-12 15:30:21 -06:00
Feed(BEntry);
2021-01-13 20:23:21 -06:00
Feed(BUrl xml, BEntry entry);
2021-01-09 16:53:39 -06:00
Feed(Feed*);
2020-12-30 22:07:54 -06:00
Feed();
~Feed();
2020-12-30 22:07:54 -06:00
virtual void Parse();
2021-01-11 18:08:15 -06:00
BList GetEntries();
BList GetNewEntries();
2020-12-30 22:07:54 -06:00
bool Fetch();
2021-01-11 18:08:15 -06:00
2021-01-15 22:22:33 -06:00
void Filetize();
void Unfiletize();
2021-01-11 18:08:15 -06:00
bool IsRss();
bool IsAtom();
bool IsUpdated();
2021-01-09 16:53:39 -06:00
2020-12-30 22:07:54 -06:00
BString GetTitle();
2021-01-15 22:22:33 -06:00
bool SetDate(BDateTime);
2021-01-11 18:08:15 -06:00
BUrl GetXmlUrl();
2020-12-30 22:07:54 -06:00
BDateTime GetDate();
2021-01-15 22:22:33 -06:00
bool SetTitle(const char*);
bool SetXmlUrl(BUrl newUrl);
bool SetCachePath(BString path);
2020-12-30 22:07:54 -06:00
BString GetCachePath();
protected:
2021-01-11 18:08:15 -06:00
bool SetTitle(tinyxml2::XMLElement*);
bool SetDate(const char*);
bool SetDate(tinyxml2::XMLElement*);
bool AddEntry(Entry*);
int xmlCountSiblings(tinyxml2::XMLElement*, const char*);
BString title;
BDateTime date;
BDateTime lastDate;
2021-01-11 18:08:15 -06:00
BUrl xmlUrl;
BString cachePath;
2021-01-11 18:08:15 -06:00
BString hash;
BString lastHash;
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