55 *
66 * Copyright (C) 2008-2020, Peter Johnson (gravatar.com/delphidabbler).
77 *
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.
1010}
1111
1212
@@ -18,10 +18,16 @@ interface
1818
1919uses
2020 // Delphi
21- SysUtils, Classes, XMLIntf,
21+ SysUtils,
22+ Classes,
23+ XMLIntf,
2224 // 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;
2531
2632
2733type
@@ -43,27 +49,7 @@ TSnippetInfo = record
4349 TSnippetInfoList = array of TSnippetInfo;
4450
4551type
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>
6753 TCodeImporter = class (TNoPublicConstructObject)
6854 strict private
6955 // / <summary>Version of file being imported.</summary>
@@ -103,8 +89,7 @@ TCodeImporter = class(TNoPublicConstructObject)
10389 ECodeImporter = class (ECodeSnipXML);
10490
10591type
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>
10893 TCodeExporter = class (TNoPublicConstructObject)
10994 strict private
11095 var
@@ -176,10 +161,17 @@ implementation
176161
177162uses
178163 // Delphi
179- ActiveX, XMLDom,
164+ ActiveX,
165+ XMLDom,
180166 // 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,
183175 UXMLDocConsts;
184176
185177
@@ -191,38 +183,6 @@ implementation
191183 cEarliestVersion = 1 ; // earliest file version supported by importer
192184 cLatestVersion = 6 ; // current file version written by exporter
193185
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-
226186{ TCodeExporter }
227187
228188destructor TCodeExporter.Destroy;
0 commit comments