RssItem.cpp

/****************************************************************************/

/**                                                                        **/

/** 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 "DateParser.h"

#include "RssHelpers.h"

#include "RssFeedC.h"

 

/****************************************************************************/

/*

/* DESCRIPTION : RssItemC constructor.

/*

/* RETURN VALUE: -

/*

/****************************************************************************/

RssItemC::RssItemC(RssFeedC *Feed)

{

   mFeed = Feed;

   mIsRead = false;

   mIsOld = false;

}

 

/****************************************************************************/

/*

/* DESCRIPTION : RssItemC destructor.

/*

/* RETURN VALUE: -

/*

/****************************************************************************/

RssItemC::~RssItemC()

{

}

 

/****************************************************************************/

/*

/* DESCRIPTION : Get item title.

/*

/* RETURN VALUE: Title

/*

/****************************************************************************/

const char  *RssItemC::GetTitle() const

{

   return mTitle.c_str();

}

 

/****************************************************************************/

/*

/* DESCRIPTION : Get item URL.

/*

/* RETURN VALUE: URL

/*

/****************************************************************************/

const char  *RssItemC::GetLink() const

{

   return mLink.c_str();

}

 

/****************************************************************************/

/*

/* DESCRIPTION : Get item description.

/*

/* RETURN VALUE: Description

/*

/****************************************************************************/

const char  *RssItemC::GetDescription() const

{

   return mDescription.c_str();

}

 

/****************************************************************************/

/*

/* DESCRIPTION : Get item date.

/*

/* RETURN VALUE: Date

/*

/****************************************************************************/

const char  *RssItemC::GetDate() const

{

   return mDate.c_str();

}

 

/****************************************************************************/

/*

/* DESCRIPTION : Set item title.

/*

/* RETURN VALUE: None

/*

/****************************************************************************/

void         RssItemC::SetTitle(const char *Title)

{

   if (mTitle != Title)

      mIsRead = false;

   mTitle = Title;

}

 

/****************************************************************************/

/*

/* DESCRIPTION : Set item URL.

/*

/* RETURN VALUE: None

/*

/****************************************************************************/

void         RssItemC::SetLink(const char *Link)

{

   if (mLink != Link)

      mIsRead = false;

   mLink = Link;

}

 

/****************************************************************************/

/*

/* DESCRIPTION : Set item description.

/*

/* RETURN VALUE: None

/*

/****************************************************************************/

void         RssItemC::SetDescription(const char *Description)

{

   if (mDescription != Description)

      mIsRead = false;

   mDescription = Description;

}

 

/****************************************************************************/

/*

/* DESCRIPTION : Set item date.

/*

/* RETURN VALUE: None

/*

/****************************************************************************/

void         RssItemC::SetDate(const char *Date)

{

   SYSTEMTIME   SysTime;

   if (!wfc_parse_iso_8601_string(Date, SysTime))

   {

      DateParser Dp;

      if (!Dp.parseRFC822Date(Date, &SysTime))

         return;

   }

 

   SYSTEMTIME   LocalTime;

   SystemTimeToTzSpecificLocalTime(NULL, &SysTime, &LocalTime);

 

   mOleDate = LocalTime;

   mDate = mOleDate.Format("%X");

 

   size_t       Pos1;

   size_t       Pos2;

 

   /* remove seconds */

   Pos1 = mDate.find_first_of(':');

   if (Pos1 != std::string::npos)

   {

      Pos1 = mDate.find_first_of(':', Pos1 + 1);

      if (Pos1 != std::string::npos)

      {

         Pos2 = mDate.find_first_of(' ', Pos1 + 1);

         mDate.erase(Pos1, mDate.size() - Pos2);

      }

   }

}

 

/****************************************************************************/

/*

/* DESCRIPTION : Set item read flag.

/*

/* RETURN VALUE: None

/*

/****************************************************************************/

void RssItemC::SetIsRead(bool IsRead)

{

   mIsRead = IsRead;

}

 

/****************************************************************************/

/*

/* DESCRIPTION : Set item status (true if item is in feed, false otherwise).

/*

/* RETURN VALUE: None

/*

/****************************************************************************/

void RssItemC::SetIsOld(bool IsOld)

{

   mIsOld = IsOld;

}

 

/****************************************************************************/

/*

/* DESCRIPTION : Check if item has been read.

/*

/* RETURN VALUE: true - if item read

/*               false - otherwise

/*

/****************************************************************************/

bool RssItemC::GetIsRead(void) const

{

   return mIsRead;

}

 

/****************************************************************************/

/*

/* DESCRIPTION : Check if item is still in feed.

/*

/* RETURN VALUE: true - if item outdated

/*               false - otherwise

/*

/****************************************************************************/

bool RssItemC::GetIsOld(void) const

{

   return mIsOld;

}

 

/****************************************************************************/

/*

/* DESCRIPTION : Get associated feed.

/*

/* RETURN VALUE: Feed

/*

/****************************************************************************/

RssFeedC *RssItemC::GetFeed(void) const

{

   return mFeed;

}

 

/****************************************************************************/

/*

/* DESCRIPTION : Compare items based on date.

/*

/* RETURN VALUE: true - if this item is older than specified item

/*               false - otherwise

/*

/****************************************************************************/

bool         RssItemC::operator<(const RssItemC &Item) const

{

   if (mOleDate < Item.mOleDate)

      return true;

   return false;

}

 





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