• R/O
  • SSH
  • HTTPS

akdf: Commit


Commit MetaInfo

Revision513 (tree)
Time2020-07-08 06:16:48
Authorderekwildstar

Log Message

Melhoria na forma de criação de algumas interfaces

Change Summary

Incremental Difference

--- trunk/rtp/prj/Delphi 10 (Delphi 2006)/KRKLib.bdsproj (revision 512)
+++ trunk/rtp/prj/Delphi 10 (Delphi 2006)/KRKLib.bdsproj (revision 513)
@@ -1,30 +1,169 @@
1-<?xml version="1.0" encoding="utf-8"?>
1+<?xml version="1.0" encoding="utf-8"?>
22 <BorlandProject>
3- <PersonalityInfo>
4- <Option>
5- <Option Name="Personality">Delphi.Personality</Option>
6- <Option Name="GUID">{2913FA62-830E-4021-9C32-C644EFE44C4B}</Option>
7- </Option>
8- </PersonalityInfo>
9- <Delphi.Personality>
10- <Source>
11- <Source Name="MainSource">KRKLib.dpk</Source>
12- </Source>
13- <Compiler>
14- <Compiler Name="UnitAliases"></Compiler>
15- <Compiler Name="NamespacePrefix"></Compiler>
16- <Compiler Name="DefaultNamespace"></Compiler>
3+ <PersonalityInfo>
4+ <Option>
5+ <Option Name="Personality">Delphi.Personality</Option>
6+ <Option Name="GUID">{2913FA62-830E-4021-9C32-C644EFE44C4B}</Option>
7+ </Option>
8+ </PersonalityInfo>
9+ <Delphi.Personality>
10+ <Source>
11+ <Source Name="MainSource">KRKLib.dpk</Source>
12+ </Source>
13+ <Compiler>
14+ <Compiler Name="UnitAliases"></Compiler>
15+ <Compiler Name="NamespacePrefix"></Compiler>
16+ <Compiler Name="DefaultNamespace"></Compiler> <Compiler Name="A">8</Compiler>
17+ <Compiler Name="B">0</Compiler>
18+ <Compiler Name="C">1</Compiler>
19+ <Compiler Name="D">1</Compiler>
20+ <Compiler Name="E">0</Compiler>
21+ <Compiler Name="F">0</Compiler>
22+ <Compiler Name="G">1</Compiler>
23+ <Compiler Name="H">1</Compiler>
24+ <Compiler Name="I">1</Compiler>
25+ <Compiler Name="J">0</Compiler>
26+ <Compiler Name="K">0</Compiler>
27+ <Compiler Name="L">1</Compiler>
28+ <Compiler Name="M">0</Compiler>
29+ <Compiler Name="N">1</Compiler>
30+ <Compiler Name="O">1</Compiler>
31+ <Compiler Name="P">1</Compiler>
32+ <Compiler Name="Q">0</Compiler>
33+ <Compiler Name="R">0</Compiler>
34+ <Compiler Name="S">0</Compiler>
35+ <Compiler Name="T">0</Compiler>
36+ <Compiler Name="U">0</Compiler>
37+ <Compiler Name="V">1</Compiler>
38+ <Compiler Name="W">0</Compiler>
39+ <Compiler Name="X">1</Compiler>
40+ <Compiler Name="Y">1</Compiler>
41+ <Compiler Name="Z">1</Compiler>
42+ <Compiler Name="ShowHints">True</Compiler>
43+ <Compiler Name="ShowWarnings">True</Compiler>
44+ <Compiler Name="GenerateDocumentation">False</Compiler>
45+ <Compiler Name="SymbolDeprecated">True</Compiler>
46+ <Compiler Name="SymbolLibrary">True</Compiler>
47+ <Compiler Name="SymbolPlatform">True</Compiler>
48+ <Compiler Name="SymbolExperimental">True</Compiler>
49+ <Compiler Name="UnitLibrary">True</Compiler>
50+ <Compiler Name="UnitPlatform">True</Compiler>
51+ <Compiler Name="UnitDeprecated">True</Compiler>
52+ <Compiler Name="UnitExperimental">True</Compiler>
53+ <Compiler Name="HResultCompat">True</Compiler>
54+ <Compiler Name="HidingMember">True</Compiler>
55+ <Compiler Name="HiddenVirtual">True</Compiler>
56+ <Compiler Name="Garbage">True</Compiler>
57+ <Compiler Name="BoundsError">True</Compiler>
58+ <Compiler Name="ZeroNilCompat">True</Compiler>
59+ <Compiler Name="StringConstTruncated">True</Compiler>
60+ <Compiler Name="ForLoopVarVarPar">True</Compiler>
61+ <Compiler Name="TypedConstVarPar">True</Compiler>
62+ <Compiler Name="AsgToTypedConst">True</Compiler>
63+ <Compiler Name="CaseLabelRange">True</Compiler>
64+ <Compiler Name="ForVariable">True</Compiler>
65+ <Compiler Name="ConstructingAbstract">True</Compiler>
66+ <Compiler Name="ComparisonFalse">True</Compiler>
67+ <Compiler Name="ComparisonTrue">True</Compiler>
68+ <Compiler Name="ComparingSignedUnsigned">True</Compiler>
69+ <Compiler Name="CombiningSignedUnsigned">True</Compiler>
70+ <Compiler Name="UnsupportedConstruct">True</Compiler>
71+ <Compiler Name="FileOpen">True</Compiler>
72+ <Compiler Name="FileOpenUnitSrc">True</Compiler>
73+ <Compiler Name="BadGlobalSymbol">True</Compiler>
74+ <Compiler Name="DuplicateConstructorDestructor">True</Compiler>
75+ <Compiler Name="InvalidDirective">True</Compiler>
76+ <Compiler Name="PackageNoLink">True</Compiler>
77+ <Compiler Name="PackageThreadVar">True</Compiler>
78+ <Compiler Name="ImplicitImport">True</Compiler>
79+ <Compiler Name="HPPEMITIgnored">True</Compiler>
80+ <Compiler Name="NoRetVal">True</Compiler>
81+ <Compiler Name="UseBeforeDef">True</Compiler>
82+ <Compiler Name="ForLoopVarUndef">True</Compiler>
83+ <Compiler Name="UnitNameMismatch">True</Compiler>
84+ <Compiler Name="NoCFGFileFound">True</Compiler>
85+ <Compiler Name="ImplicitVariants">True</Compiler>
86+ <Compiler Name="UnicodeToLocale">True</Compiler>
87+ <Compiler Name="LocaleToUnicode">True</Compiler>
88+ <Compiler Name="ImagebaseMultiple">True</Compiler>
89+ <Compiler Name="SuspiciousTypecast">True</Compiler>
90+ <Compiler Name="PrivatePropAccessor">True</Compiler>
91+ <Compiler Name="UnsafeType">False</Compiler>
92+ <Compiler Name="UnsafeCode">False</Compiler>
93+ <Compiler Name="UnsafeCast">False</Compiler>
94+ <Compiler Name="OptionTruncated">True</Compiler>
95+ <Compiler Name="WideCharReduced">True</Compiler>
96+ <Compiler Name="DuplicatesIgnored">True</Compiler>
97+ <Compiler Name="UnitInitSeq">True</Compiler>
98+ <Compiler Name="LocalPInvoke">True</Compiler>
99+ <Compiler Name="MessageDirective">True</Compiler>
100+ <Compiler Name="CodePage"></Compiler>
17101 </Compiler>
18- <Linker>
19- <Linker Name="ExeDescription">Anak Krakatoa Library</Linker>
102+ <Linker>
103+ <Linker Name="ExeDescription">Anak Krakatoa Library</Linker> <Linker Name="MapFile">0</Linker>
104+ <Linker Name="OutputObjs">0</Linker>
105+ <Linker Name="GenerateHpps">False</Linker>
106+ <Linker Name="ConsoleApp">1</Linker>
107+ <Linker Name="DebugInfo">False</Linker>
108+ <Linker Name="RemoteSymbols">False</Linker>
109+ <Linker Name="GenerateDRC">False</Linker>
110+ <Linker Name="MinStackSize">16384</Linker>
111+ <Linker Name="MaxStackSize">1048576</Linker>
112+ <Linker Name="ImageBase">4194304</Linker>
20113 </Linker>
21- <Directories>
22- <Directories Name="UnitOutputDir">..\..\dcu\d10</Directories>
23- <Directories Name="PackageDLLOutputDir"></Directories>
24- <Directories Name="PackageDCPOutputDir"></Directories>
25- <Directories Name="SearchPath">..\..\res;..\..\res\dfm</Directories>
26- <Directories Name="Conditionals"></Directories>
27- <Directories Name="DebugSourceDirs"></Directories>
28- </Directories>
114+ <Directories>
115+ <Directories Name="UnitOutputDir">..\..\dcu\d10</Directories>
116+ <Directories Name="PackageDLLOutputDir"></Directories>
117+ <Directories Name="PackageDCPOutputDir"></Directories>
118+ <Directories Name="SearchPath">..\..\res;..\..\res\dfm</Directories>
119+ <Directories Name="Conditionals"></Directories>
120+ <Directories Name="DebugSourceDirs"></Directories> <Directories Name="OutputDir"></Directories>
121+ <Directories Name="Packages"></Directories>
122+ <Directories Name="UsePackages">False</Directories>
123+ </Directories> <FileVersion>
124+ <FileVersion Name="Version">7.0</FileVersion>
125+ </FileVersion>
126+ <Parameters>
127+ <Parameters Name="RunParams"></Parameters>
128+ <Parameters Name="HostApplication"></Parameters>
129+ <Parameters Name="Launcher"></Parameters>
130+ <Parameters Name="UseLauncher">False</Parameters>
131+ <Parameters Name="DebugCWD"></Parameters>
132+ <Parameters Name="Debug Symbols Search Path"></Parameters>
133+ <Parameters Name="LoadAllSymbols">True</Parameters>
134+ <Parameters Name="LoadUnspecifiedSymbols">False</Parameters>
135+ </Parameters>
136+ <Language>
137+ <Language Name="ActiveLang"></Language>
138+ <Language Name="ProjectLang">$00000000</Language>
139+ <Language Name="RootDir"></Language>
140+ </Language>
141+ <VersionInfo>
142+ <VersionInfo Name="IncludeVerInfo">True</VersionInfo>
143+ <VersionInfo Name="AutoIncBuild">False</VersionInfo>
144+ <VersionInfo Name="MajorVer">1</VersionInfo>
145+ <VersionInfo Name="MinorVer">0</VersionInfo>
146+ <VersionInfo Name="Release">0</VersionInfo>
147+ <VersionInfo Name="Build">0</VersionInfo>
148+ <VersionInfo Name="Debug">False</VersionInfo>
149+ <VersionInfo Name="PreRelease">False</VersionInfo>
150+ <VersionInfo Name="Special">False</VersionInfo>
151+ <VersionInfo Name="Private">False</VersionInfo>
152+ <VersionInfo Name="DLL">False</VersionInfo>
153+ <VersionInfo Name="Locale">1046</VersionInfo>
154+ <VersionInfo Name="CodePage">1252</VersionInfo>
155+ </VersionInfo>
156+ <VersionInfoKeys>
157+ <VersionInfoKeys Name="CompanyName"></VersionInfoKeys>
158+ <VersionInfoKeys Name="FileDescription"></VersionInfoKeys>
159+ <VersionInfoKeys Name="FileVersion">1.0.0.0</VersionInfoKeys>
160+ <VersionInfoKeys Name="InternalName"></VersionInfoKeys>
161+ <VersionInfoKeys Name="LegalCopyright"></VersionInfoKeys>
162+ <VersionInfoKeys Name="LegalTrademarks"></VersionInfoKeys>
163+ <VersionInfoKeys Name="OriginalFilename"></VersionInfoKeys>
164+ <VersionInfoKeys Name="ProductName"></VersionInfoKeys>
165+ <VersionInfoKeys Name="ProductVersion">1.0.0.0</VersionInfoKeys>
166+ <VersionInfoKeys Name="Comments"></VersionInfoKeys>
167+ </VersionInfoKeys>
29168 </Delphi.Personality>
30169 </BorlandProject>
--- trunk/rtp/prj/Delphi 10 (Delphi 2006)/KRKLib.dpk (revision 512)
+++ trunk/rtp/prj/Delphi 10 (Delphi 2006)/KRKLib.dpk (revision 513)
@@ -18,10 +18,9 @@
1818 inet,
1919 vcldb,
2020 dsnap,
21- dclstd,
22- dsnapxml,
23- soapmidas;
21+ dclstd;
2422
23+
2524 contains
2625 KRK.ToolsAPI in '..\..\SRC\ToolsAPI\KRK.ToolsAPI.pas',
2726 KRK.Rtl.Common.Classes.Interposer in '..\..\SRC\Rtl\Common\KRK.Rtl.Common.Classes.Interposer.pas',
--- trunk/rtp/src/Xml/KRK.Xml.ValidateXmlXsd.pas (revision 512)
+++ trunk/rtp/src/Xml/KRK.Xml.ValidateXmlXsd.pas (revision 513)
@@ -119,7 +119,7 @@
119119
120120 procedure TKRKValidateXMLXSD.Execute;
121121 var
122- XMLDocument: Variant;
122+ XMLDocument: IXMLDOMDocument3;
123123 begin
124124 inherited;
125125 DoMax(0);
@@ -126,13 +126,12 @@
126126
127127 if CoInitialize(nil) = S_OK then
128128 try
129- // Este bloco try...finally serve apenas para realizar a contagem de nós que
130- // serão validados, por isso há a destruição de XMLDocument antes de
129+ // Este bloco try...finally serve apenas para realizar a contagem de nós
130+ // que serão validados, por isso há a destruição de XMLDocument antes de
131131 // executar Validate, o qual realiza novamente o carregamento, tanto do
132132 // arquivo, como de seu esquema XSD
133+ XMLDocument := CoDOMDocument60.Create;
133134 try
134- XMLDocument := CreateOLEObject('MSXML2.DOMDocument.6.0');
135-
136135 DoProgress('Carregando arquivo...',[pdText],0);
137136 XMLDocument.load(FXMLFile);
138137
@@ -139,7 +138,7 @@
139138 DoProgress('Realizando contagem de nós...',[pdText],0);
140139 DoMax(XMLDocument.documentElement.selectNodes('//*').Length);
141140 finally
142- XMLDocument := varNull;
141+ XMLDocument := nil; // Como é uma interface, anular a referência é suficiente
143142 end;
144143
145144 FResult := Validate;
@@ -159,38 +158,37 @@
159158 function TKRKValidateXMLXSD.Validate: TStringList;
160159 var
161160 SAXXMLReader: IVBSAXXMLReader;
162- XMLSchemaCache: Variant;
161+ XMLSchemaCache: IXMLDOMSchemaCollection2;
163162 begin
164163 // Criando uma coleção de esquemas (XSD)
165- XMLSchemaCache := CreateOleObject('MSXML2.XMLSchemaCache.6.0');
166- try
167- // Criando um leitor SAX (XML)
168- SAXXMLReader := CreateOleObject('MSXML2.SAXXMLReader.6.0') as IVBSAXXMLReader;
164+ XMLSchemaCache := CoXMLSchemaCache60.Create;
169165
170- // Adicionando o arquivo de esquema na coleção
171- XMLSchemaCache.Add('',FXSDFile);
166+ // Criando um leitor SAX (XML)
167+ SAXXMLReader := CoSAXXMLReader60.Create;
172168
173- // Configurando o leitor SAX para validar o documento XML que nele for carregado
174- SAXXMLReader.putFeature('schema-validation', True);
175- SAXXMLReader.putFeature('exhaustive-errors', True);
176- SAXXMLReader.putProperty('schemas', XMLSchemaCache);
169+ // Adicionando o arquivo de esquema na coleção
170+ XMLSchemaCache.Add('',FXSDFile);
177171
178- Result := TStringList.Create;
172+ // Configurando o leitor SAX para validar o documento XML que nele for carregado
173+ SAXXMLReader.putFeature('schema-validation', True);
174+ SAXXMLReader.putFeature('exhaustive-errors', True);
175+ SAXXMLReader.putProperty('schemas', XMLSchemaCache);
179176
180- // Atribuindo manipuladores necessários. TSaxErrorHandler manipula apenas os erros
181- // e TTagReaded manipula cada nó lido
182- SAXXMLReader.errorHandler := TSaxErrorHandler.Create(Self,Result,FIgnoreDuplicates); // Manipula apenas os erros encontrados
183- SAXXMLReader.contentHandler := TSaxContentHandler.Create(Self); // Manipula cada um dos nós
177+ Result := TStringList.Create;
184178
185- // Executa a validação
186- try
187- SAXXMLReader.ParseURL(FXMLFile);
188- except
189- { Evita que as exceções decorrentes de erros de validação parem um
190- processamento em lote. No futuro talvez seja melhor parametrizar isso }
191- end;
192- finally
193- XMLSchemaCache := varNull;
179+ // Atribuindo manipuladores necessários. TSaxErrorHandler manipula apenas os erros
180+ // e TTagReaded manipula cada nó lido
181+ SAXXMLReader.errorHandler := TSaxErrorHandler.Create(Self,Result,FIgnoreDuplicates); // Manipula apenas os erros encontrados
182+ SAXXMLReader.contentHandler := TSaxContentHandler.Create(Self); // Manipula cada um dos nós
183+
184+ // Executa a validação
185+ try
186+ // x: IStream := TStreamAdapter.Create(TFileStream.Create(FXMLFile,fmOpenRead));
187+ // SAXXMLReader.parse(x);
188+ SAXXMLReader.ParseURL(FXMLFile);
189+ except
190+ { Evita que as exceções decorrentes de erros de validação parem um
191+ processamento em lote. No futuro talvez seja melhor parametrizar isso }
194192 end;
195193 end;
196194
Show on old repository browser