|
|
|
|
|
|
||
|
/****************************************************************************/ /**
**/ /** Copyright
(c) 2005 Diodia Software (http://www.diodia.com/) **/ /**
**/ /** Use in any
form with or without modification for commercial and non- **/ /** commercial
purposes is permitted. **/ /**
**/ /****************************************************************************/ #include "stdafx.h"
#include "RssHelpers.h" #include "RssFeedC.h"
/****************************************************************************/ /* /* DESCRIPTION : RssFeedC constructor. /* /* RETURN VALUE: - /* /****************************************************************************/ RssFeedC::RssFeedC(const char *Url) { mUrl = Url; }
/****************************************************************************/ /* /* DESCRIPTION : RssFeedC destructor. /* /* RETURN VALUE: - /* /****************************************************************************/ RssFeedC::~RssFeedC() { while (mChannel.begin() != mChannel.end()) { delete *mChannel.begin(); mChannel.erase(mChannel.begin()); } }
/****************************************************************************/ /* /* DESCRIPTION : Get feed URL. /* /* RETURN VALUE: URL /* /****************************************************************************/ const char *RssFeedC::GetUrl() const { return mUrl.c_str(); } /****************************************************************************/ /* /* DESCRIPTION : Get feed title. /* /* RETURN VALUE: Title /* /****************************************************************************/ const char *RssFeedC::GetTitle() const { return mTitle.c_str(); }
/****************************************************************************/ /* /* DESCRIPTION : Get feed homepage URL. /* /* RETURN VALUE: URL /* /****************************************************************************/ const char *RssFeedC::GetLink() const { return mLink.c_str(); }
/****************************************************************************/ /* /* DESCRIPTION : Get feed description. /* /* RETURN VALUE: Description /* /****************************************************************************/ const char *RssFeedC::GetDescription() const { return mDescription.c_str(); } /****************************************************************************/ /* /* DESCRIPTION : Set feed title. /* /* RETURN VALUE: None /* /****************************************************************************/ void RssFeedC::SetTitle(const char *Title) { mTitle = Title; }
/****************************************************************************/ /* /* DESCRIPTION : Set feed homepage URL. /* /* RETURN VALUE: None /* /****************************************************************************/ void RssFeedC::SetLink(const char *Link) { mLink = Link; }
/****************************************************************************/ /* /* DESCRIPTION : Set feed description. /* /* RETURN VALUE: None /* /****************************************************************************/ void RssFeedC::SetDescription(const char *Description) { mDescription = Description; }
/****************************************************************************/ /* /* DESCRIPTION : Get number of items in feed. /* /* RETURN VALUE: Number of items in feed /* /****************************************************************************/ int RssFeedC::GetNoOfItems() const { return (int) mChannel.size(); }
/****************************************************************************/ /* /* DESCRIPTION : Get nth item in feed. /* /* RETURN VALUE: RSS item /* /****************************************************************************/ RssItemC *RssFeedC::GetNthItem(int Index) const { RssChannelC::const_iterator Idx;
for (Idx = mChannel.begin(); Idx != mChannel.end(); Idx++) if (--Index < 0) break;
if (Idx == mChannel.end()) return NULL;
return *Idx; }
/****************************************************************************/ /* /* DESCRIPTION : Add new item to feed. /* /* RETURN VALUE: New item /* /****************************************************************************/ RssItemC *RssFeedC::AddItem(const char *Title) { RssChannelC::iterator Idx; RssItemC *Item;
for (Idx = mChannel.begin(); Idx != mChannel.end(); Idx++) { if (!strcmp((*Idx)->GetTitle(), Title)) { (*Idx)->SetIsOld(false); return *Idx; } }
Item = new RssItemC(this); Item->SetTitle(Title); mChannel.insert(Item);
return Item; }
/****************************************************************************/ /* /* DESCRIPTION : Delete items no longer in feed. /* /* RETURN VALUE: None /* /****************************************************************************/ void RssFeedC::DeleteOldItems() { RssChannelC::iterator Idx;
while (true) { for (Idx = mChannel.begin(); Idx != mChannel.end(); Idx++) { if ((*Idx)->GetIsOld()) { delete *Idx; mChannel.erase(Idx); continue; } } break; } } |
Source Files Commands.cpp Context.cpp CreatePath.cpp DateParser.cpp DlgEditFeedC.cpp DlgManageFeedsC.cpp Hook.cpp Iso8601.cpp MsXmlMisc.cpp MsXmlSelect.cpp RegistryNotify.cpp RegistryUtil.cpp RSS.cpp RSS.def RSS.idl RssAction.cpp RssDownloader.cpp RssFeed.cpp RssHelpers.cpp RssInit.cpp RssItem.cpp RssMultiFeed.cpp RssTimer.cpp RssXml.cpp StdAfx.cpp Header Files Commands.h ContextC.h DateParser.h DlgEditFeedC.h DlgManageFeedsC.h Helper.h HookC.h RegistryNotify.h RegistryNotifyC.h Resource.h RssDownloaderC.h RssFeedC.h RssHelpers.h RssItemC.h RssMultiFeedC.h StdAfx.h ThreadObject.h XmlHelpers.h Resource Files about.htm DiodiaLogoSmall.gif logo.bmp manifest.xml read.bmp RSS.rc RSS.rgs ToolBandLayout.xml |
|
|
© 2002-2008 Diodia Software |
||