📄 rssitem.cpp
字号:
// RSSItem.cpp: implementation of the CRSSItem class.
//
//////////////////////////////////////////////////////////////////////
#include "stdafx.h"
#include "RSSItem.h"
#ifdef _DEBUG
#undef THIS_FILE
static char THIS_FILE[]=__FILE__;
#define new DEBUG_NEW
#endif
//////////////////////////////////////////////////////////////////////
// Construction/Destruction
//////////////////////////////////////////////////////////////////////
CRSSItem::CRSSItem(CRSSChannel* pChannel ) : CRSSElement( _T("item") )
{
m_pParentChannel = pChannel;
m_Author = _T("");
m_bReadStatus = FALSE;
m_Categorys.RemoveAll();
m_Description = _T("");
m_Link = _T("");
m_Enclosure = NULL;
m_Guid = NULL;
m_PubDate = NULL;
m_Source = NULL;
m_Title = _T("");
m_RetakeDate = new CStdDate();
m_iCurrentCategory = -1;
m_bRedFlag = FALSE;
m_bReadStatus = FALSE;
}
CRSSItem::~CRSSItem()
{
CRSSCategory* pcat;
for( int i=0 ; i<m_Categorys.GetSize(); i++ )
{
pcat = (CRSSCategory*)m_Categorys.GetAt(i);
ASSERT(pcat);
delete(pcat);
}
m_Categorys.RemoveAll();
if( m_Enclosure ) delete(m_Enclosure);
if( m_Guid ) delete(m_Guid);
if( m_PubDate) delete(m_PubDate);
if( m_Source ) delete(m_Source);
if( m_RetakeDate) delete( m_RetakeDate );
}
void CRSSItem::SetTitle(CString title)
{
m_Title = title;
}
CString CRSSItem::GetTitle()
{
return m_Title;
}
void CRSSItem::SetAuthor(CString author)
{
m_Author = author;
}
CString CRSSItem::GetAuthor()
{
return m_Author;
}
void CRSSItem::SetReadStatus(BOOL readStatus)
{
if( m_bReadStatus != readStatus )
{
if( readStatus ) m_pParentChannel->m_ReadedItems++;
else m_pParentChannel->m_ReadedItems--;
m_bReadStatus = readStatus;
}
}
BOOL CRSSItem::GetReadStatus()
{
return m_bReadStatus;
}
BOOL CRSSItem::GetRedFlag()
{
return m_bRedFlag;
}
void CRSSItem::SetRedFlag( BOOL redfalg )
{
if( m_bRedFlag != redfalg )
{
if( redfalg ) m_pParentChannel->m_RedFlagItems++;
else m_pParentChannel->m_RedFlagItems--;
m_bRedFlag = redfalg;
}
}
int CRSSItem::AddCategory(CRSSCategory* category)
{
return m_Categorys.Add( category );
}
BOOL CRSSItem::RemoveCategory(int iIndex)
{
if( iIndex >= m_Categorys.GetSize() ) return FALSE;
CRSSCategory* pcat;
pcat = (CRSSCategory*)m_Categorys.GetAt(iIndex);
m_Categorys.RemoveAt(iIndex);
delete( pcat );
return TRUE;
}
CRSSCategory* CRSSItem::GetCategory(BOOL bFirst)
{
if( m_Categorys.GetSize() <= 0 ) return NULL;
if( bFirst )
m_iCurrentCategory = 0;
else
m_iCurrentCategory++;
if( m_Categorys.GetSize() <= m_iCurrentCategory )
return NULL;
return (CRSSCategory*)m_Categorys.GetAt( m_iCurrentCategory );
}
void CRSSItem::SetComments(CString comments)
{
m_Comments = comments;
}
CString CRSSItem::GetComments()
{
return m_Comments;
}
void CRSSItem::SetDescription(CString description)
{
m_Description = description;
}
CString CRSSItem::GetDescription()
{
return m_Description;
}
void CRSSItem::SetEnclosure(CRSSEnclosure *pEnclosure)
{
m_Enclosure = pEnclosure;
}
CRSSEnclosure* CRSSItem::GetEnclosure()
{
return m_Enclosure;
}
void CRSSItem::SetGuid(CRSSGuid *pGuid)
{
m_Guid = pGuid;
}
CRSSGuid* CRSSItem::GetGuid()
{
return m_Guid;
}
void CRSSItem::SetLink(CString link)
{
m_Link = link;
}
CString CRSSItem::GetLink()
{
return m_Link;
}
void CRSSItem::SetPubDate(CStdDate *pDate)
{
m_PubDate = pDate;
}
CStdDate* CRSSItem::GetPubDate()
{
return m_PubDate;
}
void CRSSItem::SetSource(CRSSSource *pSource)
{
m_Source = pSource;
}
CRSSSource* CRSSItem::GetSource()
{
return m_Source;
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -