-
-
Notifications
You must be signed in to change notification settings - Fork 3
/
Copy pathExplicitStringLists_Short.pas
145 lines (101 loc) · 4.47 KB
/
ExplicitStringLists_Short.pas
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
{-------------------------------------------------------------------------------
This Source Code Form is subject to the terms of the Mozilla Public
License, v. 2.0. If a copy of the MPL was not distributed with this
file, You can obtain one at http://mozilla.org/MPL/2.0/.
-------------------------------------------------------------------------------}
{===============================================================================
Explicit string lists - Short
Implementation of list of short strings.
Version 1.1.3 (2024-05-05)
Last change 2024-05-05
©2017-2024 František Milt
Contacts:
František Milt: frantisek.milt@gmail.com
Support:
If you find this code useful, please consider supporting its author(s) by
making a small donation using the following link(s):
https://www.paypal.me/FMilt
Changelog:
For detailed changelog and history please refer to this git repository:
github.com/TheLazyTomcat/ExplicitStringLists
Dependencies:
AuxClasses - github.com/TheLazyTomcat/Lib.AuxClasses
* AuxExceptions - github.com/TheLazyTomcat/Lib.AuxExceptions
AuxTypes - github.com/TheLazyTomcat/Lib.AuxTypes
* BinaryStreamingLite - github.com/TheLazyTomcat/Lib.BinaryStreamingLite
ListSorters - github.com/TheLazyTomcat/Lib.ListSorters
MemoryBuffer - github.com/TheLazyTomcat/Lib.MemoryBuffer
StaticMemoryStream - github.com/TheLazyTomcat/Lib.StaticMemoryStream
StrRect - github.com/TheLazyTomcat/Lib.StrRect
Library AuxExceptions is required only when rebasing local exception classes
(see symbol ExplicitStringLists_UseAuxExceptions for details).
BinaryStreamingLite can be replaced by full BinaryStreaming.
Library AuxExceptions might also be required as an indirect dependency.
Indirect dependencies:
SimpleCPUID - github.com/TheLazyTomcat/Lib.SimpleCPUID
UInt64Utils - github.com/TheLazyTomcat/Lib.UInt64Utils
WinFileInfo - github.com/TheLazyTomcat/Lib.WinFileInfo
===============================================================================}
unit ExplicitStringLists_Short;
{$INCLUDE '.\ExplicitStringLists_defs.inc'}
interface
uses
Classes,
AuxTypes,
ExplicitStringLists_Base;
{$DEFINE ESL_Short}
type
TESLCharType = AnsiChar;
TESLPCharType = PAnsiChar;
TESLStringType = ShortString;
TESLPStringType = PShortString;
{
TESLLongStringType is used where limited length of short strings would pose
a problem.
}
TESLLongStringType = AnsiString;
type
TShortStringList = class; // forward declaration
TESLClassType = TShortStringList;
TESLShortSortCompareIndex = Function(List: TShortStringList; Idx1,Idx2: Integer): Integer;
TESLShortSortCompareString = Function(List: TShortStringList; const Str1,Str2: TESLStringType): Integer;
TESLSortCompareIndexType = TESLShortSortCompareIndex;
TESLSortCompareStringType = TESLShortSortCompareString;
{$DEFINE ESL_ClassTypes}
{$INCLUDE './ExplicitStringLists.inc'}
{$UNDEF ESL_ClassTypes}
TESLShortItemBinaryIOEvent = procedure(Sender: TObject; Stream: TStream; var Item: TESLListItem) of Object;
TESLShortItemBinaryIOCallback = procedure(Sender: TObject; Stream: TStream; var Item: TESLListItem);
TESLItemBinaryIOEventType = TESLShortItemBinaryIOEvent;
TESLItemBinaryIOCallbackType = TESLShortItemBinaryIOCallback;
TShortStringList = class(TExplicitStringList)
{$DEFINE ESL_ClassDeclaration}
{$INCLUDE './ExplicitStringLists.inc'}
{$UNDEF ESL_ClassDeclaration}
end;
implementation
uses
SysUtils,
StrRect, BinaryStreamingLite, MemoryBuffer, StaticMemoryStream;
{$IFDEF FPC_DisableWarns}
{$DEFINE FPCDWM}
{$DEFINE W5024:={$WARN 5024 OFF}} // Parameter "$1" not used
{$ENDIF}
{===============================================================================
Main implementation
===============================================================================}
const
ESL_IMPLSTR_NAME = 'short';
//------------------------------------------------------------------------------
{$DEFINE ESL_ClassAuxiliary}
{$INCLUDE './ExplicitStringLists.inc'}
{$UNDEF ESL_ClassAuxiliary}
//------------------------------------------------------------------------------
{$DEFINE ESL_ClassDelimitedTextParser}
{$INCLUDE './ExplicitStringLists.inc'}
{$UNDEF ESL_ClassDelimitedTextParser}
//------------------------------------------------------------------------------
{$DEFINE ESL_ClassImplementation}
{$INCLUDE './ExplicitStringLists.inc'}
{$UNDEF ESL_ClassImplementation}
end.