代码拉取完成,页面将自动刷新
(*
* DGL(The Delphi Generic Library)
*
* Copyright (c) 2004
* HouSisong@gmail.com
*
* This material is provided "as is", with absolutely no warranty expressed
* or implied. Any use is at your own risk.
*
* Permission to use or copy this software for any purpose is hereby granted
* without fee, provided the above notices are retained on all copies.
* Permission to modify the code and to distribute modified code is granted,
* provided the above notices are retained, and a notice that the code was
* modified is included with the above copyright notice.
*
*)
//------------------------------------------------------------------------------
// _THashMap\_THashMultiMap的声明
// Create by HouSisong, 2004.09.11
//------------------------------------------------------------------------------
//HashMap.inc_h , HashMap.inc_pas
{$ifndef __HashMap_inc_h_}
{$define __HashMap_inc_h_}
{$I DGLIntf.inc_h}
{$I _HashTable.inc_h}
type
_THashMapIterator = _THashBaseIterator;
type
_THashMap_Base = class(TInterfacedObject)
protected
FHashTable : _THashTableBase;
protected
function getAlwaysReserveSize():_TNativeInt; {$ifdef _DGL_Inline} inline; {$endif}
procedure setAlwaysReserveSize(const aAlwaysReserveSize:_TNativeInt); {$ifdef _DGL_Inline} inline; {$endif}
public
function GetItemValue(const Key: _KeyType): _ValueType; {$ifdef _DGL_Inline} inline; {$endif}
function ItBegin(): _IMapIterator; {$ifdef _DGL_Inline} inline; {$endif}
function ItEnd(): _IMapIterator; {$ifdef _DGL_Inline} inline; {$endif}
procedure Clear(); {$ifdef _DGL_Inline} inline; {$endif}
function Size(): _TNativeInt; {$ifdef _DGL_Inline} inline; {$endif}
function IsEmpty(): Boolean; {$ifdef _DGL_Inline} inline; {$endif}
function EraseValue(const Value:_ValueType):_TNativeInt; overload; {$ifdef _DGL_Inline} inline; {$endif}
function EraseValue(const Key:_KeyType;const Value:_ValueType):_TNativeInt; overload; {$ifdef _DGL_Inline} inline; {$endif}
function EraseKey(const Key:_KeyType):_TNativeInt; overload; {$ifdef _DGL_Inline} inline; {$endif}
procedure Erase(const ItPos:_IMapIterator); overload; //{$ifdef _DGL_Inline} inline; {$endif}
procedure Erase(const ItBegin,ItEnd: _IMapIterator); overload; //
function Count(const Key:_KeyType):_TNativeInt; {$ifdef _DGL_Inline} inline; {$endif}
function Find(const Key:_KeyType):_IMapIterator; {$ifdef _DGL_Inline} inline; {$endif}
function LowerBound(const Key:_KeyType):_IMapIterator; {$ifdef _DGL_Inline} inline; {$endif}
function UpperBound(const Key:_KeyType):_IMapIterator; {$ifdef _DGL_Inline} inline; {$endif}
procedure EqualRange(const Key:_KeyType;out ItBegin,ItEnd:_IMapIterator); {$ifdef _DGL_Inline} inline; {$endif}
function GetSelfObj():TObject; {$ifdef _DGL_Inline} inline; {$endif}
public
property AlwaysReserveSize:_TNativeInt read getAlwaysReserveSize write setAlwaysReserveSize;
procedure Reserve(const ReserveSize: _TNativeInt); {$ifdef _DGL_Inline} inline; {$endif}
constructor Create();
destructor Destroy(); override;
end;
//----------------------------------------------------------------------------
// 作用描述: 底部利用_THashTableBase实现的Map
// 主要方法:(参见_IMap的说明)
//----------------------------------------------------------------------------
_THashMap = class(_THashMap_Base,_IMap)
public
procedure SetItemValue(const Key: _KeyType;const Value: _ValueType); {$ifdef _DGL_Inline} inline; {$endif}
procedure Insert(const Key:_KeyType;const Value:_ValueType); overload; {$ifdef _DGL_Inline} inline; {$endif}
procedure Insert(const ItBegin,ItEnd:_IMapIterator);overload;
procedure Insert(const num:_TNativeInt;const Key:_KeyType;const Value:_ValueType); overload; {$ifdef _DGL_Inline} inline; {$endif}
procedure Assign(const ItBegin,ItEnd:_IMapIterator);overload;
procedure Assign(const num:_TNativeInt;const Key:_KeyType;const Value: _ValueType);overload; {$ifdef _DGL_Inline} inline; {$endif}
function Clone():_IMap; {$ifdef _DGL_Inline} inline; {$endif}
property Items[const Key:_KeyType]: _ValueType read GetItemValue write SetItemValue;
public
constructor Create(); overload;
constructor Create(const ItBegin,ItEnd:_IMapIterator);overload;
constructor Create(const AMap:_THashMap);overload;
end;
//----------------------------------------------------------------------------
// 作用描述: 底部利用_THashTableBase实现的MultiMap
// 主要方法:(参见_IMultiMap的说明)
//----------------------------------------------------------------------------
_THashMultiMap = class(_THashMap_Base,_IMultiMap,_IMap) //not _IMap
public
procedure SetItemValue(const Key: _KeyType;const Value: _ValueType); {$ifdef _DGL_Inline} inline; {$endif}
procedure Insert(const Key:_KeyType;const Value:_ValueType); overload; {$ifdef _DGL_Inline} inline; {$endif}
procedure Insert(const ItBegin,ItEnd:_IMapIterator);overload;
procedure Insert(const num:_TNativeInt;const Key:_KeyType;const Value:_ValueType); overload; {$ifdef _DGL_Inline} inline; {$endif}
procedure Assign(const ItBegin,ItEnd:_IMapIterator);overload;
procedure Assign(const num:_TNativeInt;const Key:_KeyType;const Value: _ValueType);overload; {$ifdef _DGL_Inline} inline; {$endif}
function Clone():_IMap; {$ifdef _DGL_Inline} inline; {$endif}
property Items[const Key:_KeyType]: _ValueType read GetItemValue write SetItemValue;
public
constructor Create(); overload;
constructor Create(const ItBegin,ItEnd:_IMapIterator);overload;
constructor Create(const AMultiMap:_THashMultiMap);overload;
constructor Create(const num:_TNativeInt;const Key:_HashKeyType;const Value: _HashValueType);overload;
end;
{$endif } // __HashMap_inc_h_
此处可能存在不合适展示的内容,页面不予展示。您可通过相关编辑功能自查并修改。
如您确认内容无涉及 不当用语 / 纯广告导流 / 暴力 / 低俗色情 / 侵权 / 盗版 / 虚假 / 无价值内容或违法国家有关法律法规的内容,可点击提交进行申诉,我们将尽快为您处理。