5
5
*
6
6
* Copyright (C) 2008-2020, Peter Johnson (gravatar.com/delphidabbler).
7
7
*
8
- * Implements classes that can import and export user defined snippets and user
9
- * information from and to XML.
8
+ * Implements classes that can import and export user defined snippets from and
9
+ * to XML.
10
10
}
11
11
12
12
@@ -18,10 +18,16 @@ interface
18
18
19
19
uses
20
20
// Delphi
21
- SysUtils, Classes, XMLIntf,
21
+ SysUtils,
22
+ Classes,
23
+ XMLIntf,
22
24
// Project
23
- DB.USnippet, UBaseObjects, UEncodings, UExceptions, UIStringList,
24
- UUserDetails, UXMLDocHelper, UXMLDocumentEx;
25
+ DB.USnippet,
26
+ UBaseObjects,
27
+ UEncodings,
28
+ UIStringList,
29
+ UXMLDocHelper,
30
+ UXMLDocumentEx;
25
31
26
32
27
33
type
@@ -43,27 +49,7 @@ TSnippetInfo = record
43
49
TSnippetInfoList = array of TSnippetInfo;
44
50
45
51
type
46
- // / <summary>Encapsulates user info from export files.</summary>
47
- TUserInfo = record
48
- // / <summary>User's personal details.</summary>
49
- Details: TUserDetails;
50
- // / <summary>User's comments.</summary>
51
- Comments: string;
52
- // / <summary>Initialises record to given values.</summary>
53
- constructor Create(const UserDetails: TUserDetails;
54
- const UserComments: string);
55
- // / <summary>Returns a new record with null field values.</summary>
56
- class function CreateNul : TUserInfo; static;
57
- // / <summary>Copies given TUserInfo record to this one.</summary>
58
- procedure Assign (const Src: TUserInfo);
59
- // / <summary>Initialises record to null value.</summary>
60
- procedure Init ;
61
- // / <summary>Checks if record is null, i.e. empty.</summary>
62
- function IsNul : Boolean;
63
- end ;
64
-
65
- type
66
- // / <summary>Imports code snippets and user info from XML.</summary>
52
+ // / <summary>Imports code snippets from XML.</summary>
67
53
TCodeImporter = class (TNoPublicConstructObject)
68
54
strict private
69
55
// / <summary>Version of file being imported.</summary>
@@ -103,8 +89,7 @@ TCodeImporter = class(TNoPublicConstructObject)
103
89
ECodeImporter = class (ECodeSnipXML);
104
90
105
91
type
106
- // TODO -cRefactor: Decide if we still need to export user info
107
- // / <summary>Exports code snippets and user info to XML.</summary>
92
+ // / <summary>Exports code snippets to XML.</summary>
108
93
TCodeExporter = class (TNoPublicConstructObject)
109
94
strict private
110
95
var
@@ -176,10 +161,17 @@ implementation
176
161
177
162
uses
178
163
// Delphi
179
- ActiveX, XMLDom,
164
+ ActiveX,
165
+ XMLDom,
180
166
// Project
181
- ActiveText.UMain, DB.UMain, DB.USnippetKind, UAppInfo, UREMLDataIO,
182
- UReservedCategories, USnippetExtraHelper, USnippetIDs, UStructs,
167
+ ActiveText.UMain,
168
+ DB.UMain,
169
+ DB.USnippetKind,
170
+ UAppInfo,
171
+ UReservedCategories,
172
+ USnippetExtraHelper,
173
+ USnippetIDs,
174
+ UStructs,
183
175
UXMLDocConsts;
184
176
185
177
@@ -191,38 +183,6 @@ implementation
191
183
cEarliestVersion = 1 ; // earliest file version supported by importer
192
184
cLatestVersion = 6 ; // current file version written by exporter
193
185
194
-
195
- { TUserInfo }
196
-
197
- procedure TUserInfo.Assign (const Src: TUserInfo);
198
- begin
199
- Details.Assign(Src.Details);
200
- Comments := Src.Comments;
201
- end ;
202
-
203
- constructor TUserInfo.Create(const UserDetails: TUserDetails;
204
- const UserComments: string);
205
- begin
206
- Details := UserDetails;
207
- Comments := UserComments;
208
- end ;
209
-
210
- class function TUserInfo.CreateNul : TUserInfo;
211
- begin
212
- Result.Init;
213
- end ;
214
-
215
- procedure TUserInfo.Init ;
216
- begin
217
- Details.Init;
218
- Comments := ' ' ;
219
- end ;
220
-
221
- function TUserInfo.IsNul : Boolean;
222
- begin
223
- Result := Details.IsNul and (Comments = ' ' );
224
- end ;
225
-
226
186
{ TCodeExporter }
227
187
228
188
destructor TCodeExporter.Destroy;
0 commit comments