|
/*
Project : RSS Reader plugin for Internet Explorer
File Name : RRPRssItem.cpp
Date :
Purpose : It encapsulates RSS Item information
Note : Used by RRPRssParser
Send comments
or Bugs to : prafulla_t@users.sourceforge.net
*/
#include "StdAfx.h"
#include "RRPRssItem.h"
RRPRssItem::RRPRssItem(void) {
title = NULL;
description = NULL;
link = NULL;
}
RRPRssItem::~RRPRssItem(void) {
if(title)
delete title;
if(description)
delete description;
if(link)
delete link;
}
CString RRPRssItem::removeTags(CString html,BOOL &hasImage,BOOL &hasTable)
{
CString temp;
int flag;
BOOL img=false;
BOOL table=false;
for(int i=0;i<html.GetLength();i++)
{
flag=0;
if(html.GetAt(i)=='<')
while(html.GetAt(i)!='>')
{
if(html.GetAt(i)=='<' && html.GetAt(i+1)=='i' && html.GetAt(i+2)=='m' && html.GetAt(i+3)=='g')
img=true;
if(html.GetAt(i)=='<' && html.GetAt(i+1)=='t' && html.GetAt(i+2)=='a' && html.GetAt(i+3)=='b' && html.GetAt(i+4)=='l' && html.GetAt(i+5)=='e')
table=true;
flag=1;
i++;
}
if(flag)
{
if(html.GetLength()==(i+1))
break;
else
{
if(html[i]!='>')
i++;
}
}
if(html.GetAt(i) != '>')
temp += html.GetAt(i);
}
hasImage=img;
hasTable=table;
temp.TrimLeft();
temp.TrimRight();
return removeSpaces(temp);
}
CString RRPRssItem::removeSpaces(CString str)
{
CString temp;
for(int i=0;i<str.GetLength();i++)
{
if(str.GetAt(i)==' ')
{
temp += ' ';
while(str.GetAt(i)==' ')
i++;
}
temp += str.GetAt(i);
}
return temp;
}
|
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.
Quote : "Life is all about solving problems and enjoying their solutions !! "