Store feed entries in BObjectLists
This commit is contained in:
parent
ea620f387a
commit
baf09fdd0a
1
TODO.txt
1
TODO.txt
|
@ -13,7 +13,6 @@ Important improvements:
|
|||
* _Huge_ problem, but I haven't had luck figuring it out yet…
|
||||
* Move from BLists to BObjectLists where possible
|
||||
* Fix background of Feeds List error status icon (it's black, not transparent)
|
||||
* Check if arg is a file or not (treat appropriately)
|
||||
* Make UI friendly to whatever font-size you throw at it
|
||||
* Give a max size to the progress label in FeedsView
|
||||
* Make fancy Markdown README
|
||||
|
|
|
@ -32,7 +32,7 @@ AtomFeed::AtomFeed(Feed* feed)
|
|||
void
|
||||
AtomFeed::Parse ()
|
||||
{
|
||||
entries = BList();
|
||||
entries = BObjectList<Entry>();
|
||||
tinyxml2::XMLDocument xml;
|
||||
xml.LoadFile(GetCachePath().String());
|
||||
|
||||
|
@ -116,7 +116,7 @@ AtomFeed::ParseEntries(tinyxml2::XMLElement* xfeed)
|
|||
xentry = xfeed->FirstChildElement("entry");
|
||||
|
||||
int entryCount = xmlCountSiblings(xentry, "entry");
|
||||
entries = BList(entryCount);
|
||||
entries = BObjectList<Entry>(entryCount);
|
||||
|
||||
std::cout << "\t-" << entryCount << "-\n";
|
||||
|
||||
|
|
10
src/Feed.cpp
10
src/Feed.cpp
|
@ -92,8 +92,6 @@ Feed::Feed()
|
|||
|
||||
Feed::~Feed()
|
||||
{
|
||||
for (int i = entries.CountItems(); i >= 0; i--)
|
||||
delete ((Entry*)entries.RemoveItem(i));
|
||||
}
|
||||
|
||||
|
||||
|
@ -205,19 +203,19 @@ Feed::AddEntry (Entry* newEntry)
|
|||
}
|
||||
|
||||
|
||||
BList
|
||||
BObjectList<Entry>
|
||||
Feed::GetEntries()
|
||||
{
|
||||
return entries;
|
||||
}
|
||||
|
||||
|
||||
BList
|
||||
BObjectList<Entry>
|
||||
Feed::GetNewEntries()
|
||||
{
|
||||
BList newEntries;
|
||||
BObjectList<Entry> newEntries;
|
||||
for (int i = 0; i < entries.CountItems(); i++) {
|
||||
Entry* entry = ((Entry*)entries.ItemAt(i));
|
||||
Entry* entry = entries.ItemAt(i);
|
||||
if (entry->GetDate() > lastDate)
|
||||
newEntries.AddItem(entry);
|
||||
}
|
||||
|
|
|
@ -8,13 +8,14 @@
|
|||
|
||||
#include <tinyxml2.h>
|
||||
|
||||
#include <ObjectList.h>
|
||||
|
||||
#include "Entry.h"
|
||||
|
||||
|
||||
class BDateTime;
|
||||
class BEntry;
|
||||
class BString;
|
||||
class BList;
|
||||
class BUrl;
|
||||
|
||||
|
||||
|
@ -31,8 +32,8 @@ public:
|
|||
|
||||
virtual void Parse();
|
||||
|
||||
BList GetEntries();
|
||||
BList GetNewEntries();
|
||||
BObjectList<Entry> GetEntries();
|
||||
BObjectList<Entry> GetNewEntries();
|
||||
|
||||
bool Fetch();
|
||||
|
||||
|
@ -72,7 +73,7 @@ protected:
|
|||
BString hash;
|
||||
BString lastHash;
|
||||
|
||||
BList entries;
|
||||
BObjectList<Entry> entries;
|
||||
bool fetched;
|
||||
bool updated;
|
||||
};
|
||||
|
|
|
@ -237,7 +237,7 @@ FeedController::_ParseLoop(void* data)
|
|||
while (true) {
|
||||
int32 code = receive_data(&sender, (void*)feedBuffer, sizeof(Feed));
|
||||
|
||||
BList entries;
|
||||
BObjectList<Entry> entries;
|
||||
int32 entriesCount;
|
||||
BString feedTitle;
|
||||
BUrl feedUrl = feedBuffer->GetXmlUrl();
|
||||
|
|
|
@ -31,7 +31,7 @@ void
|
|||
RssFeed::Parse()
|
||||
{
|
||||
tinyxml2::XMLDocument xml;
|
||||
entries = BList();
|
||||
entries = BObjectList<Entry>();
|
||||
|
||||
Feed::Parse();
|
||||
|
||||
|
@ -83,7 +83,7 @@ RssFeed::ParseEntries(tinyxml2::XMLElement* xchan)
|
|||
xitem = xchan->FirstChildElement("item");
|
||||
|
||||
int entryCount = xmlCountSiblings(xitem, "item");
|
||||
entries = BList(entryCount);
|
||||
entries = BObjectList<Entry>(entryCount);
|
||||
|
||||
std::cout << "\t-" << entryCount << " entries-\n";
|
||||
|
||||
|
|
Ŝarĝante…
Reference in New Issue