const
FC_NONE = 0;
FC_BANNER = 1;
FC_ARCHIVE = 2;
FC_LOGIN = 4;
FC_SENDLOGIN = 8;

 

type
TMessageState=(msNone,msNew, msOlded);


TMTreeItem=class(TCollectionItem)
public
  constructor Create(Collection: TCollection); override;
  destructor Destroy;override;
  procedure AssignTo(Source : TPersistent);override; 
  procedure DefineProperties(Filer: TFiler); override;
  procedure DeleteHash;
  property Parent:TMTree read GetParent;
published
  property ID:String read FID write SetID;
  property AuthorID:Integer read FAuthorID write SetAuthorID;
  property Caption:String read FCaption write SetCaption;
  property Date:TDateTime read FDate write SetDate;
  property StringDate:String read FStringDate write SetStringDate;
  property MessageText:String read FMessageText write SetMessageText;
  property State:TMessageState read FState write SetState;
  property Expanded:Boolean read FExpanded write SetExpanded;
  property URL:String read FURL write SetURL;
  property ReplyURL:String read FReplyURL write SetReplyURL;
  property Data:Variant read FData write SetData;
  property WorkData:Variant read FWorkData write SetWorkData;
  property SubMessages:TMTree read FSubMessages write SetSubMessages;
  property Viewed:Boolean read FViewed write SetViewed;
  property Loaded:Boolean read FLoaded write SetLoaded;
end;

TMTree=class(TCollection)
public
  constructor Create(Parent:TMTreeItem;Storage:TMStorage);
  function Add:TMTreeItem;
  property Items[index:Integer]:TMTreeItem read GetItems;default;
  property Storage:TMStorage read FStorage;
end;

TAddressItem=class(TCollectionItem)
published
  property ID:Integer read FID write FID;
  property Name:String read FName write FName;
  property Email:String read FEmail write FEmail;
  property Tag:Integer read FTag write FTag;
end;

TAddressBook=class(TCollection)
public
  constructor Create;
  function Add:TAddressItem;
  property Items[Index:Integer]:TAddressItem read GetItems;default;
  property ItemByName[Name:String]:TAddressItem read GetByName;
  property ItemByID[ID:Integer]:TAddressItem read GetByID;
  property ItemByEmail[Email:String]:TAddressItem read GetByEmail;
end;

TMStorage=class(TSerializable)
public
  constructor Create;
  destructor Destroy;override;
  procedure UpdateStorage(Storage:TMStorage; StartTreeDest, StartTreeSrc : TMTree);
  property Hash:THashStringList read FHash;
published
  property Name:String read FName write SetName;
  property AddressBook:TAddressBook read FAddressBook write SetAddressBook;
  property Tree:TMTree read FTree write SetTree;
end;

function CreateStorage:TMStorage;

{
function FindTemplate(szTemplate:String; iParams:Integer):Variant;
Found Template in HTML and return array of parameters.
Template Chars:
#$ - any space
## - #
#1# - Param number 1
......
#N# - Param number N
#*# - any symbols
#? - any symbol (one symbol)

Any symbols and Params support exclude words syntax.
#*-"word"# - any symbols exclude "WORD".

Example:
<a#href="#1-"<"">#2#<#*#>END

<a href="http://www.altavista.com"> AltaVista</b>END
<a href="http://www.altavista.com/"> AltaVista</p></b>END
.....
Result:
Ole variant array of Strings. (VarArrayCreate)
Dimention of array and number of params equal.

This function modify FIndex. 
}



THTMLProcessor=class
public
  constructor Create;
  function FindTemplate(szTemplate:String):Variant;
  property HTML:String read FHTML write SetHTML;
end;

function GetTag(szTmp:String;var Index:Integer;var szTag : String):Integer;
function RemoveTags(Str:String):String;

function WordCount(const S: string; const WordDelims: TCharSet): Integer;
{ WordCount given a set of word delimiters, return number of words in S. }
function ExtractWord(N: Integer; const S: string; const WordDelims: TCharSet):
string;
function WordPosition(const N: Integer; const S: string;
const WordDelims: TCharSet): Integer;
{ Given a set of word delimiters, return start position of N'th word in S. }
function DelSpace1(const S: string): string;
{ DelSpace1 return a string with all non-single white spaces removed. }
function CenterStr(const S: string; Len: Integer): string;
{ CenterStr centers the characters in the string based upon the
Len specified. }
function MakeStr(C: Char; N: Integer): string;
{ MakeStr return a string of length N filled with character C. }
function ReplaceStr(const S, Srch, Replace: string): string;
{ Returns string with every occurrence of Srch string replaced with
Replace string. }
function GetYeahr: string;
function WUpperCase(szStr:String):String;
function DeleteBlackSpace(szStr:String):String;


function PosEx( substr : AnsiString; s : AnsiString; Index:Integer): Integer;register;
function CheckName(List:TStringList; szStr:String):String;
function SetHighLight(Value, szWords, szBegin, szEnd: String): String;

 

THashStringList=class
public
  constructor Create;
  destructor Destroy;override;
  procedure AddObject(const Str:String;Obj:TObject);
  function FindObject(const Str:String;var Obj:TObject):Integer;
  function GetObject(const Str:String):TObject;
  function IndexOf(const Str:String):Integer;
  function IndexOfObject(const Obj:TObject;var Hash:Word):Integer; 
  procedure Delete(const Hash:Word; Index:Integer);
  function GetHash(const Str:String):Word;
  property Count:Integer read GetCount;
end;