Starting WideString support by the Type Library Editor/ws_helper

git-svn-id: https://svn.code.sf.net/p/lazarus-ccr/svn@561 8e941d3f-bd1b-0410-a28a-d453659cc2b4
This commit is contained in:
inoussa
2008-09-15 02:34:09 +00:00
parent 2cb02c46ec
commit b2368463cf
9 changed files with 490 additions and 434 deletions

View File

@ -0,0 +1,9 @@
<?xml version="1.0"?>
<schema xmlns:tns="class_widestring_property" xmlns:xsd="http://www.w3.org/2001/XMLSchema" targetNamespace="class_widestring_property">
<xsd:complexType name="TSampleClass">
<xsd:sequence>
<xsd:element name="elementProp" type="xsd:string"/>
</xsd:sequence>
<xsd:attribute use="required" name="elementAtt" type="xsd:string"/>
</xsd:complexType>
</schema>

View File

@ -38,6 +38,7 @@ type
procedure class_extent_native_type();
procedure class_headerblock_derived();
procedure class_headerblock_simplecontent_derived();
procedure class_widestring_property();
procedure array_sequence_collection();
end;
@ -395,6 +396,67 @@ begin
end;
end;
procedure TTest_CustomXsdGenerator.class_widestring_property();
var
tr : TwstPasTreeContainer;
mdl : TPasModule;
cltyp : TPasClassType;
procedure AddProperty(
const AName,
ATypeName,
ADefault : string;
const AKind : TPropertyType
);
var
p : TPasProperty;
begin
p := TPasProperty(tr.CreateElement(TPasProperty,AName,cltyp,visDefault,'',0));
cltyp.Members.Add(p);
p.ReadAccessorName := 'F' + AName;
p.WriteAccessorName := 'F' + AName;
p.VarType := tr.FindElement(ATypeName) as TPasType;
Check( (p.VarType <> nil), Format('Type not found : "%s".',[ATypeName]));
p.VarType.AddRef();
p.DefaultValue := ADefault;
p.Visibility := visPublished;
p.StoredAccessorName := 'True';
if ( AKind = ptAttribute ) then
tr.SetPropertyAsAttribute(p,True);
end;
var
g : IGenerator;
locDoc, locExistDoc : TXMLDocument;
begin
locDoc := nil;
locExistDoc := nil;
tr := TwstPasTreeContainer.Create();
try
CreateWstInterfaceSymbolTable(tr);
mdl := TPasModule(tr.CreateElement(TPasModule,'class_widestring_property',tr.Package,visDefault,'',0));
tr.Package.Modules.Add(mdl);
mdl.InterfaceSection := TPasSection(tr.CreateElement(TPasSection,'',mdl,visDefault,'',0));
cltyp := TPasClassType(tr.CreateElement(TPasClassType,'TSampleClass',mdl.InterfaceSection,visDefault,'',0));
cltyp.ObjKind := okClass;
mdl.InterfaceSection.Declarations.Add(cltyp);
mdl.InterfaceSection.Types.Add(cltyp);
AddProperty('elementProp','WideString','',ptField);
AddProperty('elementAtt','WideString','',ptAttribute);
locDoc := CreateDoc();
g := CreateGenerator(locDoc);
g.Execute(tr,mdl.Name);
WriteXMLFile(locDoc,'.\class_widestring_property.xsd');
locExistDoc := LoadXmlFromFilesList('class_widestring_property.xsd');
Check(CompareNodes(locExistDoc.DocumentElement,locDoc.DocumentElement),'generated document differs from the existent one.');
finally
ReleaseDomNode(locExistDoc);
ReleaseDomNode(locDoc);
FreeAndNil(tr);
end;
end;
procedure TTest_CustomXsdGenerator.array_sequence_collection();
var
tr : TwstPasTreeContainer;

View File

@ -21,7 +21,7 @@
<LaunchingApplication PathPlusParams="/usr/X11R6/bin/xterm -T 'Lazarus Run Output' -e $(LazarusDir)/tools/runwait.sh $(TargetCmdLine)"/>
</local>
</RunParams>
<Units Count="39">
<Units Count="37">
<Unit0>
<Filename Value="wst_test_suite.lpr"/>
<IsPartOfProject Value="True"/>
@ -88,135 +88,125 @@
<UnitName Value="metadata_generator"/>
</Unit12>
<Unit13>
<Filename Value="..\..\ws_helper\parserdefs.pas"/>
<IsPartOfProject Value="True"/>
<UnitName Value="parserdefs"/>
</Unit13>
<Unit14>
<Filename Value="..\..\metadata_wsdl.pas"/>
<IsPartOfProject Value="True"/>
<UnitName Value="metadata_wsdl"/>
</Unit14>
<Unit15>
</Unit13>
<Unit14>
<Filename Value="..\..\server_service_intf.pas"/>
<IsPartOfProject Value="True"/>
<UnitName Value="server_service_intf"/>
</Unit15>
<Unit16>
<Filename Value="test_parserdef.pas"/>
<IsPartOfProject Value="True"/>
<UnitName Value="test_parserdef"/>
</Unit16>
<Unit17>
</Unit14>
<Unit15>
<Filename Value="..\..\base_xmlrpc_formatter.pas"/>
<IsPartOfProject Value="True"/>
<UnitName Value="base_xmlrpc_formatter"/>
</Unit17>
<Unit18>
</Unit15>
<Unit16>
<Filename Value="..\..\wst_fpc_xml.pas"/>
<IsPartOfProject Value="True"/>
<UnitName Value="wst_fpc_xml"/>
</Unit18>
<Unit19>
</Unit16>
<Unit17>
<Filename Value="test_utilities.pas"/>
<IsPartOfProject Value="True"/>
<UnitName Value="test_utilities"/>
</Unit19>
<Unit20>
</Unit17>
<Unit18>
<Filename Value="..\..\server_service_xmlrpc.pas"/>
<IsPartOfProject Value="True"/>
<UnitName Value="server_service_xmlrpc"/>
</Unit20>
<Unit21>
</Unit18>
<Unit19>
<Filename Value="test_parsers.pas"/>
<IsPartOfProject Value="True"/>
<UnitName Value="test_parsers"/>
</Unit21>
<Unit22>
</Unit19>
<Unit20>
<Filename Value="..\..\ws_helper\wsdl_generator.pas"/>
<IsPartOfProject Value="True"/>
<UnitName Value="wsdl_generator"/>
</Unit22>
<Unit23>
</Unit20>
<Unit21>
<Filename Value="..\..\ws_helper\xsd_generator.pas"/>
<IsPartOfProject Value="True"/>
<UnitName Value="xsd_generator"/>
</Unit23>
<Unit24>
</Unit21>
<Unit22>
<Filename Value="..\..\ws_helper\xsd_consts.pas"/>
<IsPartOfProject Value="True"/>
<UnitName Value="xsd_consts"/>
</Unit24>
<Unit25>
</Unit22>
<Unit23>
<Filename Value="..\..\ws_helper\wsdl_parser.pas"/>
<IsPartOfProject Value="True"/>
<UnitName Value="wsdl_parser"/>
</Unit25>
<Unit26>
</Unit23>
<Unit24>
<Filename Value="..\..\base_json_formatter.pas"/>
<IsPartOfProject Value="True"/>
<UnitName Value="base_json_formatter"/>
</Unit26>
<Unit27>
</Unit24>
<Unit25>
<Filename Value="test_support.pas"/>
<IsPartOfProject Value="True"/>
<UnitName Value="test_support"/>
</Unit27>
<Unit28>
</Unit25>
<Unit26>
<Filename Value="..\..\basex_encode.pas"/>
<IsPartOfProject Value="True"/>
<UnitName Value="basex_encode"/>
</Unit28>
<Unit29>
</Unit26>
<Unit27>
<Filename Value="test_basex_encode.pas"/>
<IsPartOfProject Value="True"/>
<UnitName Value="test_basex_encode"/>
</Unit29>
<Unit30>
</Unit27>
<Unit28>
<Filename Value="..\..\json_formatter.pas"/>
<IsPartOfProject Value="True"/>
<UnitName Value="json_formatter"/>
</Unit30>
<Unit31>
</Unit28>
<Unit29>
<Filename Value="..\..\server_service_json.pas"/>
<IsPartOfProject Value="True"/>
<UnitName Value="server_service_json"/>
</Unit31>
<Unit32>
</Unit29>
<Unit30>
<Filename Value="test_json.pas"/>
<IsPartOfProject Value="True"/>
<UnitName Value="test_json"/>
</Unit32>
<Unit33>
</Unit30>
<Unit31>
<Filename Value="test_generators.pas"/>
<IsPartOfProject Value="True"/>
<UnitName Value="test_generators"/>
</Unit33>
<Unit34>
</Unit31>
<Unit32>
<Filename Value="test_suite_utils.pas"/>
<IsPartOfProject Value="True"/>
<UnitName Value="test_suite_utils"/>
</Unit34>
<Unit35>
</Unit32>
<Unit33>
<Filename Value="test_std_cursors.pas"/>
<IsPartOfProject Value="True"/>
<UnitName Value="test_std_cursors"/>
</Unit35>
<Unit36>
</Unit33>
<Unit34>
<Filename Value="test_rtti_filter.pas"/>
<IsPartOfProject Value="True"/>
<UnitName Value="test_rtti_filter"/>
</Unit36>
<Unit37>
</Unit34>
<Unit35>
<Filename Value="test_wst_cursors.pas"/>
<IsPartOfProject Value="True"/>
<UnitName Value="test_wst_cursors"/>
</Unit37>
<Unit38>
</Unit35>
<Unit36>
<Filename Value="test_generators_runtime.pas"/>
<IsPartOfProject Value="True"/>
<UnitName Value="test_generators_runtime"/>
</Unit38>
</Unit36>
</Units>
</ProjectOptions>
<CompilerOptions>

View File

@ -13,8 +13,7 @@ uses
server_service_soap, soap_formatter, base_binary_formatter,
base_service_intf, base_soap_formatter, binary_formatter, binary_streamer,
server_binary_formatter, metadata_repository,
metadata_generator, parserdefs, server_service_intf, metadata_wsdl,
test_parserdef, base_xmlrpc_formatter, wst_fpc_xml, test_utilities,
metadata_generator, server_service_intf, metadata_wsdl, base_xmlrpc_formatter, wst_fpc_xml, test_utilities,
server_service_xmlrpc, test_parsers, wsdl_generator, xsd_generator,
xsd_consts, base_json_formatter, wsdl_parser, test_support, basex_encode,
test_basex_encode, json_formatter, server_service_json, test_json,