Click here to Skip to main content
15,891,204 members
Articles / Desktop Programming / MFC

Introduces RSS Reader by AgileInfoSoftware

Rate me:
Please Sign up or sign in to vote.
4.38/5 (15 votes)
2 Dec 20032 min read 154.9K   1.1K   31  
This article introduces an application to consume RSS Feed from Internet.
// FeedSource.h: interface for the CFeedSource class.
//
//////////////////////////////////////////////////////////////////////

#if !defined(AFX_FEEDSOURCE_H__C37CC283_CFD2_455A_AB00_B7CA0197CA2D__INCLUDED_)
#define AFX_FEEDSOURCE_H__C37CC283_CFD2_455A_AB00_B7CA0197CA2D__INCLUDED_

#if _MSC_VER > 1000
#pragma once
#endif // _MSC_VER > 1000

class CFeedItem
{
public:
	CFeedItem();
	virtual ~CFeedItem();
public:
	CString		m_strAuthor;
	CString		m_strCategory;
	CString		m_strDescription;
	CString		m_strLink;
	CString		m_strPubDate;
	CString		m_strSubject;
	CString		m_strTitle;
	CString		m_strReadStatus;
};


class CFeedSource  
{
public:
	CFeedSource();
	virtual ~CFeedSource();

public:
	CString		m_strCopyright;
	CString		m_strDescription;
	CString		m_strGenerator;
	CString		m_strLanguage;
	CString		m_strLastBuildDate;
	CString		m_strLink;
	CString		m_strTitle;
	CString		m_strTtl;
	CString		m_strWebMaster;
	CString		m_strImageDescription;
	CString		m_strImageHeight;
	CString		m_strImageWidth;
	CString		m_strImageLink;
	CString		m_strImageTitle;
	CString		m_strImageUrl;
	CString		m_strVersion;
};


class CFeed
{
public:
	CFeed();
	CFeed( CString strXMLFile );
	virtual ~CFeed();
public:
	static void RefreshAll();
	static void MarkItemRead( CString strLink );
	static void DeleteFeedSource( CString strLink );
	static void DeleteListArray( CStringArray& strLinkArray );
	static void GetFeedSourceList( CStringArray& strTitleArray, CStringArray& strLinkArray );
	void LoadLocal( CString& strLink );
	void BuildFromFile( CString strXMLFile );
	CFeedSource						m_source;		// Feed Source
	CArray<CFeedItem,CFeedItem>		m_item;			// Feed Item
	BOOL							m_bAdded;
	void Save( BOOL bSaveSource = TRUE );
private:
	static CString EscapeQuote( CString strValue );
	static CString GetModuleFileDir();
	static CString GetFieldValue( FieldsPtr fields, long nIndex );
	static CString GetComError( _com_error& e );
	static BOOL ExecuteSQL( _ConnectionPtr& pCnn, CString& strSQL, CString& strMsg );
	void GetVersion(MSXML2::IXMLDOMNode *pNode);
	void IterateChildNodes(MSXML2::IXMLDOMNode *pNode);
	void BuildImage(MSXML2::IXMLDOMNode *pNode);
	void BuildItem(MSXML2::IXMLDOMNode *pNode);
    MSXML2::IXMLDOMDocument2*		m_pDoc;			// XML DOM Document
	int								m_nDepth;
};

#endif // !defined(AFX_FEEDSOURCE_H__C37CC283_CFD2_455A_AB00_B7CA0197CA2D__INCLUDED_)

By viewing downloads associated with this article you agree to the Terms of Service and the article's licence.

If a file you wish to view isn't highlighted, and is a text file (not binary), please let us know and we'll add colourisation support for it.

License

This article has no explicit license attached to it but may contain usage terms in the article text or the download files themselves. If in doubt please contact the author via the discussion board below.

A list of licenses authors might use can be found here


Written By
Web Developer
United States United States
LI is a architect of several database-centric tools and technologies. He has been programming since 1995. He is a Microsoft Certified Solution Developer (MCSD), MCSD.NET, SCJP, SCJD and OCDBA.

His programming experience includes C/C++, C#, MFC, ASP, VB and Perl. He has worked on Solaris, AIX, HPUX and various Windows, and found Windows is the easiest one to work with.

He has over 8 years of database experiences in Oracle, SQL Server, DB2 and other DBMS.

LI co-founded AgileInfoSoftware LLC (http://www.agileinfollc.com) in 2003. He is responsible for the overall vision and development strategy of the company.

Comments and Discussions