Pogger/src/Feed.h

84 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
2021-03-04 18:31:47 -06:00
#include <ObjectList.h>
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 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-03-06 12:36:33 -06:00
Feed(const char* pathStr);
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-03-20 18:45:37 -05:00
BObjectList<Entry> Entries();
BObjectList<Entry> NewEntries();
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
2021-03-20 18:45:37 -05:00
BString Title();
2021-01-15 22:22:33 -06:00
bool SetDate(BDateTime);
2021-03-20 18:45:37 -05:00
BUrl XmlUrl();
BDateTime Date();
2020-12-30 22:07:54 -06:00
2021-01-15 22:22:33 -06:00
bool SetTitle(const char*);
bool SetXmlUrl(BUrl newUrl);
bool SetCachePath(BString path);
2021-03-20 18:45:37 -05:00
BString CachePath();
protected:
2021-03-20 18:45:37 -05:00
bool _SetTitle(tinyxml2::XMLElement*);
bool _SetDate(const char*);
bool _SetDate(tinyxml2::XMLElement*);
bool _SetDate(BDateTime newDate);
2021-01-11 18:08:15 -06:00
2021-03-20 18:45:37 -05:00
bool _AddEntry(Entry*);
2021-01-11 18:08:15 -06:00
2021-03-20 18:45:37 -05:00
int _XmlCountSiblings(tinyxml2::XMLElement*, const char*);
2021-03-20 18:45:37 -05:00
BString fTitle;
BDateTime fDate;
BDateTime fLastDate;
BUrl fXmlUrl;
BString fCachePath;
BString fHash;
BString fLastHash;
2021-01-11 18:08:15 -06:00
2021-03-20 18:45:37 -05:00
BObjectList<Entry> fEntries;
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