Ò׽ؽØÍ¼Èí¼þ¡¢µ¥Îļþ¡¢Ãâ°²×°¡¢´¿ÂÌÉ«¡¢½ö160KB

DelphiÖеÄTHashTable

ÔÚDelphiÖÐ,Inifilesµ¥ÔªÖÐÓÐÒ»¸öTStringHashµÄÀ࣬²»¹ýËüµÄValue½öÖ§³ÖInteger(ÆäʵҲ²»ÊÇÎÊÌ⣬ÓÐÆäËüÀàÐÍ¿ÉÒÔ½«±äÁ¿±äΪPointer)£¬ÓÐµã²»Êæ·þ£¬½ñÌìûÊÂ×ö¾Í°ÑËüÌæ»»ÎªvariantÁË£¬ÆäÖÐKeyµÄÃû³Æ´óСдÎ޹أ¬¾ÍÊÇΪÁ˼ӿ쿪·¢ËÙ¶È£¡
ʹÓÃHashtable,²éÕÒºÍɾ³ý¸´ÔӶȶ¼Êdz£Êý¼¶±ðµÄ!
type
PPHashItem = ^PHashItem;
PHashItem = ^THashItem;
THashItem = record
Next: PHashItem;
Key: String;
Value: Variant;
end;
THashTable = class
private
Buckets: array of PHashItem;
protected
function Find(const Key: String): PPHashItem;
function HashOf(const Key: String): Cardinal; virtual;
public
constructor Create(Size: Cardinal = 256);
destructor Destroy; override;
procedure Put(const Key: String; Value: Variant);
procedure Clear;
procedure Remove(const Key: String);
function Modify(const Key: String; Value: Variant): Boolean;
function Get(const Key: String): Variant;
function ContainKey(const Key: String):boolean;
end;
procedure THashTable.Clear;
var
I: Integer;
P, N: PHashItem;
begin
for I := 0 to Length(Buckets) - 1 do
begin
P := Buckets[I];
while P <> nil do
begin
N := P^.Next;
Dispose(P);
P := N;
end;
Buckets[I] := nil;
end;
end;
function THashTable.ContainKey(const Key: String): boolean;
var
P: PHashItem;
begin
P := Find(Key)^;
if P <> nil then
begin
Result := True;
end
else
Result := False;
end;
constructor THashTable.Create(Size: Cardinal);
begin
inherited Create;
SetLength(Buckets, Size);
end;
destructor THashTable.Destroy;
begin
Clear;
inherited Destroy;
end;
function THashTable.Find(const Key: String): PPHashItem;
var
Hash: Integer;
begin
Hash := HashOf(Key) mod Cardinal(Length(Buckets));
Result := @Buckets[Hash];
while Result^ <> nil do
begin
if Result^.Key = Key then
Exit
else
Result := @Result^.Next;
end;
end;
functio


Ïà¹ØÎĵµ£º

delphi Format Type

Format
  typeµÄ¿ÉÄÜÖµÓÐÏÂÁÐÕâЩ£º
  (1) d ÓзûºÅÊ®½øÖÆÊý
        Args±ØÐëÊÇÓзûºÅÕûÐÍÊý¡£Èç¹ûÔÚ¸ñʽ»¯×Ö·û´®Öл¹¼ÓÈëÁË["." prec]£¬ÔòÈç¹ûArgs
        µÄ³¤¶ÈÈç¹ûСÓÚ¸ø³öµÄ¾«¶ÈÊýʱ£¬ÔÚǰ±ßÌî²¹0£»Èç¹û´óÓÚ¾«¶ÈÊý£¬°´Êµ¼Ê³¤¶ ......

Delphi in a Unicode World Part I

 ---
Delphi in a Unicode World Part I: What is Unicode, Why do you need
it, and How do you work with it in Delphi?
By: Nick
Hodges
Ô­ÎÄÁ´½Ó£ºhttp://dn.codegear.com/article/38437
Abstract: This article discusses Unicode, how Delphi developers
can benefit from using Unicode, and ho ......

Delphi in a Unicode World Part II

Delphi in a Unicode World Part II:  New RTL Features and
Classes to Support Unicode
By: Nick
Hodges
Ô­ÎÄÁ´½Ó:http://dn.codegear.com/article/38498
Abstract: This article will cover the new features of the Tiburon
Runtime Library that will help handle Unicode strings.
//
 & ......

XP»·¾³ÏÂÔÚDelphiÖе÷ÊÔCOM+×é¼þ

ÏÖÔÚÓ¦ÓÃϵͳÁ÷ÐÐÓÃB/S¿ª·¢£¬Ô缸Äêǰ¿ÉÊÇC/SµÄÌìÏÂÄØ£¬ÎÒÏÖÔÚ×öµÄijº½¿Õ¹«Ë¾»õÔ˽áËãά»¤¹¤×÷£¬Æäϵͳ¾ÍÊÇÀûÓÃDelphi¿ª·¢µÄC/SÓ¦ÓóÌÐò£¡ÔÚÈÕ³£µÄά»¤¹¤×÷ÖУ¬ÄÑÃâÒª¶ÔÒѾ­×öºÃµÄCOM+×é¼þ½øÐе÷ÊÔ£¬ÒԲ鿴¾ßÌåµÄ´¦ÀíÂß¼­£¡±¾ÎľÍÊǽéÉÜÔÚWindowsXP»·¾³ÏÂÈçºÎÔÚDelphiÖе÷ÊÔCOM+×é¼þ£¡
µÚÒ»²½£º¼Ç¼ÏÂÄãÏ£Íûµ÷ÊÔµÄCOM+×é¼þ ......

delphi°æMP3Çиî

ºÃ¾ÃûдBLOGÁË£¬ËÍÉÏÒ»·ÝÔ­´´µÄDELPHI°æMP3ÇиsplitMp3ΪÇиÊý£¬Ö§³Ö°´Ê±¼äÇиîºÍ°´´óСÇиÍû´ó¼ÒÖ§³Ö¡£
²Î¿¼VCµÄ×ÊÁϱàдµÄMP3ÇиîDELPHI°æµ¥Ôª.
unit UnitMp3DataUtil;
{
MP3 Cut Unit.
@author Jim Wu
2009-08
}
interface
uses
  Windows, Messages, SysUtils, Variants, Classes, Graphics, ......
© 2009 ej38.com All Rights Reserved. ¹ØÓÚE½¡ÍøÁªÏµÎÒÃÇ | Õ¾µãµØÍ¼ | ¸ÓICP±¸09004571ºÅ