⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 urssbase.pas

📁 自己写的一个 RSS 阅读器
💻 PAS
字号:

{*****************************************************************************}
{                                                                             }
{                           Delphi XML Data Binding                           }
{                                                                             }
{         Generated on: 18.05.2004 15:35:27                                   }
{                                                                             }
{*****************************************************************************}
unit uRSSBase;

interface

uses uW3CDTF, FastStringFuncs, MSXML2_TLB, uConstants;

type
  IRSSBase = interface;
  IRSSImageBase = interface;
  IRSSItemBase = interface;
  IRSSItemBaseList = interface;

  IRSSBase = interface
    ['{DD9BE881-3AD1-478B-A88F-7E252C6AFE5F}']
    function Get_Version : WideString;
    function Get_Title : string;
    function Get_Link: WideString;
    function Get_Description: string;
    function Get_Creator: WideString;
    function Get_Items: IRSSItemBaseList;
    function Get_Image: IRSSImageBase;
    procedure SaveXml(Destination: OleVariant);

    property Version: WideString read Get_Version;
    property Title: string read Get_Title;
    property Link: Widestring read Get_Link;
    property Description: string read Get_Description;
    property Creator: WideString read Get_Creator;
    property Items: IRSSItemBaseList read Get_Items;
    property Image: IRSSImageBase read Get_Image;
  end;

{ IRSSImageBase }

  IRSSImageBase = interface
    ['{989CFEDB-9094-4489-8F33-6F7AEC84C116}']
    { Property Accessors }
    function Get_Title: WideString;
    function Get_Link: WideString;
    function Get_URL: WideString;
    function Get_Width: WideString;
    function Get_Height: WideString;
    { Methods & Properties }
    property Title: WideString read Get_Title;
    property Link: WideString read Get_Link;
    property URL: WideString read Get_URL;
    property Width: WideString read Get_Width;
    property Height: WideString read Get_Height;
  end;


  IRSSItemBaseList = interface
    ['{28D80C98-C04A-4531-A59E-B82FD12413F4}']
    procedure Add(item : TInterfacedObject);overload;
    function Add:IRSSItemBase;overload;
    procedure Delete(Index:integer);
    function Get_Item(index : integer): IRSSItemBase; overload;
    function Get_ItemByGuid(guid : string): IRSSItemBase; overload;
    function Get_Count(): integer;
    function IndexOfLink(ALink:WideString):integer;
    function IndexOfTitle(ATitle:String):integer;

    property Item[Index: Integer]: IRSSItemBase read Get_Item; default;
    property ItemByGuid[Guid: string]: IRSSItemBase read Get_ItemByGuid; 
    property Count : integer read Get_Count;
  end;

  IRSSItemBase = interface
  	['{D45FAA5F-D1FD-461F-9EFE-549343BA9968}']
    function Get_Author: string;
    function Get_Title: string;
    function Get_PubDate: TW3CDTF;
    function Get_Guid: WideString;
    function Get_Link: WideString;
    function Get_Category: string;
    function Get_Creator: WideString;
    function Get_CommentCount: integer;
    function Get_CommentRss: WideString;
    function Get_Comment: WideString;
    function Get_Description: string;

    property PubDate: TW3CDTF read Get_PubDate;
    property Title: string read Get_Title;
    property Link: WideString read Get_Link;
    property Guid: WideString read Get_Guid;
    property Description: string read Get_Description;
    property Author: string read Get_Author;
    property Category: string read Get_Category;
    property Creator: WideString read Get_Creator;
    property Comment: WideString read Get_Comment;
    property CommentCount: integer read Get_CommentCount;
    property CommentRSS: WideString read Get_CommentRSS;
  end;

  TRSSImageBase = class(TInterfacedObject, IRSSImageBase)
  private
    FTitle: WideString;
    FLink: WideString;
    FURL: WideString;
    FWidth: WideString;
    FHeight: WideString;
  protected
    { IRSSImageBase }
    function Get_Title: WideString;
    function Get_Link: WideString;
    function Get_URL: WideString;
    function Get_Width: WideString;
    function Get_Height: WideString;
  public
  	constructor Create(theNode : IXMLDOMNode);
  end;

implementation

{ TRSSImageBase }

constructor TRSSImageBase.Create(theNode: IXMLDOMNode);
var
	node : IXmlDOMNode;
begin
	try
    FHeight := '0';
    FTitle := '';
    FLink := '';
    FURL := '';
    FWidth := '0';
    node := theNode;
  	if Assigned(node) then begin
		  FTitle := GetNodeVal(node,'title');
		  FLink := GetNodeVal(node,'link');
		  FURL := GetNodeVal(node,'url');
		  FWidth := GetNodeVal(node,'width');
		  FHeight := GetNodeVal(node,'height');
		end;
  except
//    Result := '';
  end;
end;

function TRSSImageBase.Get_Height: WideString;
begin
	Result := FHeight;
end;

function TRSSImageBase.Get_Link: WideString;
begin
	Result := FLink;
end;

function TRSSImageBase.Get_Title: WideString;
begin
  Result := ExtractNonHTML(Ftitle);
end;

function TRSSImageBase.Get_URL: WideString;
begin
	Result := FUrl;
end;

function TRSSImageBase.Get_Width: WideString;
begin
	Result := FWidth;
end;

end.

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -