You've already forked lazarus-ccr
Preparing Type name and Element disambiguation
git-svn-id: https://svn.code.sf.net/p/lazarus-ccr/svn@950 8e941d3f-bd1b-0410-a28a-d453659cc2b4
This commit is contained in:
@@ -383,6 +383,7 @@ type
|
|||||||
class function ToStr(const ADate : TDateTime):string;overload;
|
class function ToStr(const ADate : TDateTime):string;overload;
|
||||||
class function ToStr(const ADate : TDateTimeRec):string;overload;virtual;abstract;
|
class function ToStr(const ADate : TDateTimeRec):string;overload;virtual;abstract;
|
||||||
class function Parse(const ABuffer : string):TDateTimeRec;virtual;abstract;
|
class function Parse(const ABuffer : string):TDateTimeRec;virtual;abstract;
|
||||||
|
class function ParseToUTC(const ABuffer : string):TDateTime;
|
||||||
|
|
||||||
procedure Assign(Source: TPersistent); override;
|
procedure Assign(Source: TPersistent); override;
|
||||||
function Equal(const ACompareTo : TBaseRemotable) : Boolean;override;
|
function Equal(const ACompareTo : TBaseRemotable) : Boolean;override;
|
||||||
@@ -3279,13 +3280,19 @@ begin
|
|||||||
end;
|
end;
|
||||||
|
|
||||||
function TTypeRegistry.IndexOf(Const ATypeInfo: PTypeInfo): Integer;
|
function TTypeRegistry.IndexOf(Const ATypeInfo: PTypeInfo): Integer;
|
||||||
|
var
|
||||||
|
i : Integer;
|
||||||
begin
|
begin
|
||||||
For Result := 0 To Pred(Count) Do Begin
|
for i := 0 to Pred(Count) do begin
|
||||||
If ( ATypeInfo^.Kind = Item[Result].DataType^.Kind ) And
|
if ( ATypeInfo = Item[i].DataType ) then begin
|
||||||
|
Result := i;
|
||||||
|
Exit;
|
||||||
|
end;
|
||||||
|
{If ( ATypeInfo^.Kind = Item[Result].DataType^.Kind ) And
|
||||||
AnsiSameText(ATypeInfo^.Name,Item[Result].DataType^.Name)
|
AnsiSameText(ATypeInfo^.Name,Item[Result].DataType^.Name)
|
||||||
Then
|
Then
|
||||||
Exit;
|
Exit;}
|
||||||
End;
|
end;
|
||||||
Result := -1;
|
Result := -1;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
@@ -4733,10 +4740,12 @@ class procedure TSimpleContentHeaderBlock.Save(
|
|||||||
);
|
);
|
||||||
var
|
var
|
||||||
locSerializer : TObjectSerializer;
|
locSerializer : TObjectSerializer;
|
||||||
|
locOptionChanged : Boolean;
|
||||||
begin
|
begin
|
||||||
locSerializer := TBaseComplexTypeRegistryItem(GetTypeRegistry().ItemByTypeInfo[ATypeInfo]).GetSerializer();
|
locSerializer := TBaseComplexTypeRegistryItem(GetTypeRegistry().ItemByTypeInfo[ATypeInfo]).GetSerializer();
|
||||||
if ( locSerializer <> nil ) then begin
|
if ( locSerializer <> nil ) then begin
|
||||||
if not ( osoDontDoBeginWrite in locSerializer.Options ) then
|
locOptionChanged := not ( osoDontDoBeginWrite in locSerializer.Options );
|
||||||
|
if locOptionChanged then
|
||||||
locSerializer.Options := locSerializer.Options + [osoDontDoBeginWrite];
|
locSerializer.Options := locSerializer.Options + [osoDontDoBeginWrite];
|
||||||
AStore.BeginObject(AName,ATypeInfo);
|
AStore.BeginObject(AName,ATypeInfo);
|
||||||
try
|
try
|
||||||
@@ -4745,6 +4754,8 @@ begin
|
|||||||
locSerializer.Save(AObject,AStore,AName,ATypeInfo);
|
locSerializer.Save(AObject,AStore,AName,ATypeInfo);
|
||||||
finally
|
finally
|
||||||
AStore.EndScope();
|
AStore.EndScope();
|
||||||
|
if locOptionChanged then
|
||||||
|
locSerializer.Options := locSerializer.Options - [osoDontDoBeginWrite];
|
||||||
end;
|
end;
|
||||||
end else begin
|
end else begin
|
||||||
raise ETypeRegistryException.CreateFmt(SERR_NoSerializerFoThisType,[ATypeInfo^.Name])
|
raise ETypeRegistryException.CreateFmt(SERR_NoSerializerFoThisType,[ATypeInfo^.Name])
|
||||||
@@ -5822,6 +5833,11 @@ begin
|
|||||||
Result := ToStr(locTemp);
|
Result := ToStr(locTemp);
|
||||||
end;
|
end;
|
||||||
|
|
||||||
|
class function TBaseDateRemotable.ParseToUTC(const ABuffer : string) : TDateTime;
|
||||||
|
begin
|
||||||
|
Result := NormalizeToUTC(Parse(ABuffer));
|
||||||
|
end;
|
||||||
|
|
||||||
{ TComplexInt8SContentRemotable }
|
{ TComplexInt8SContentRemotable }
|
||||||
|
|
||||||
class procedure TComplexInt8SContentRemotable.SaveValue(
|
class procedure TComplexInt8SContentRemotable.SaveValue(
|
||||||
|
@@ -67,6 +67,10 @@ const
|
|||||||
|
|
||||||
type
|
type
|
||||||
TXsdDateKind = ( xdkDateTime, xdkDate );
|
TXsdDateKind = ( xdkDateTime, xdkDate );
|
||||||
|
TValueCompareKind = (
|
||||||
|
vckEqual, vckLessThan, vckGreaterThan, vckNotEqual,
|
||||||
|
vckEqualOrLessThan, vckEqualOrGreaterThan
|
||||||
|
);
|
||||||
|
|
||||||
function xsd_TryStrToDate(
|
function xsd_TryStrToDate(
|
||||||
const AStr : string;
|
const AStr : string;
|
||||||
@@ -123,6 +127,11 @@ type
|
|||||||
function ValueEquals(const AA,AB: TTimeRec) : Boolean; overload;
|
function ValueEquals(const AA,AB: TTimeRec) : Boolean; overload;
|
||||||
function ValueEquals(const AA,AB: TDurationRec) : Boolean; overload;
|
function ValueEquals(const AA,AB: TDurationRec) : Boolean; overload;
|
||||||
|
|
||||||
|
function CompareValue(
|
||||||
|
const AA,AB : TDateTimeRec;
|
||||||
|
const ACompareKind : TValueCompareKind
|
||||||
|
) : Boolean;
|
||||||
|
|
||||||
resourcestring
|
resourcestring
|
||||||
SERR_InvalidDate = '"%s" is not a valid date.';
|
SERR_InvalidDate = '"%s" is not a valid date.';
|
||||||
SERR_InvalidTime = '"%s" is not a valid time.';
|
SERR_InvalidTime = '"%s" is not a valid time.';
|
||||||
@@ -200,6 +209,27 @@ begin
|
|||||||
( a.MinuteOffset = b.MinuteOffset );
|
( a.MinuteOffset = b.MinuteOffset );
|
||||||
end;
|
end;
|
||||||
|
|
||||||
|
function CompareValue(
|
||||||
|
const AA,AB : TDateTimeRec;
|
||||||
|
const ACompareKind : TValueCompareKind
|
||||||
|
) : Boolean;
|
||||||
|
var
|
||||||
|
locA, locB : TDateTime;
|
||||||
|
begin
|
||||||
|
case ACompareKind of
|
||||||
|
vckEqual : Result := ValueEquals(AA,AB);
|
||||||
|
vckLessThan : Result := ( NormalizeToUTC(AA) < NormalizeToUTC(AB) );
|
||||||
|
vckGreaterThan : Result := ( NormalizeToUTC(AA) > NormalizeToUTC(AB) );
|
||||||
|
vckNotEqual : Result := not ValueEquals(AA,AB);
|
||||||
|
vckEqualOrLessThan : Result := ValueEquals(AA,AB) or ( NormalizeToUTC(AA) < NormalizeToUTC(AB) );
|
||||||
|
vckEqualOrGreaterThan : Result := ValueEquals(AA,AB) or ( NormalizeToUTC(AA) > NormalizeToUTC(AB) );
|
||||||
|
else begin
|
||||||
|
Assert(False); // To suppress the warning
|
||||||
|
Result := False;
|
||||||
|
end;
|
||||||
|
end;
|
||||||
|
end;
|
||||||
|
|
||||||
function xsd_TryStrToDate(
|
function xsd_TryStrToDate(
|
||||||
const AStr : string;
|
const AStr : string;
|
||||||
out ADate : TDateTimeRec;
|
out ADate : TDateTimeRec;
|
||||||
|
@@ -8,7 +8,7 @@
|
|||||||
<Version Value="8"/>
|
<Version Value="8"/>
|
||||||
<PathDelim Value="\"/>
|
<PathDelim Value="\"/>
|
||||||
<SearchPaths>
|
<SearchPaths>
|
||||||
<OtherUnitFiles Value="..\..\"/>
|
<OtherUnitFiles Value="..\..\;$(LazarusDir)\others_package\indy-10.2.0.3\fpc\"/>
|
||||||
<UnitOutputDirectory Value="lib\$(TargetCPU)-$(TargetOS)"/>
|
<UnitOutputDirectory Value="lib\$(TargetCPU)-$(TargetOS)"/>
|
||||||
</SearchPaths>
|
</SearchPaths>
|
||||||
<Parsing>
|
<Parsing>
|
||||||
|
@@ -36,12 +36,15 @@ Type
|
|||||||
FConnection : TidHttp;
|
FConnection : TidHttp;
|
||||||
FSoapAction: string;
|
FSoapAction: string;
|
||||||
FContentType: string;
|
FContentType: string;
|
||||||
|
private
|
||||||
function GetAddress: string;
|
function GetAddress: string;
|
||||||
|
function GetProtocolVersion : string;
|
||||||
function GetProxyPassword: string;
|
function GetProxyPassword: string;
|
||||||
function GetProxyPort: Integer;
|
function GetProxyPort: Integer;
|
||||||
function GetProxyServer: string;
|
function GetProxyServer: string;
|
||||||
function GetProxyUsername: string;
|
function GetProxyUsername: string;
|
||||||
procedure SetAddress(const AValue: string);
|
procedure SetAddress(const AValue: string);
|
||||||
|
procedure SetProtocolVersion(const AValue : string);
|
||||||
procedure SetProxyPassword(const AValue: string);
|
procedure SetProxyPassword(const AValue: string);
|
||||||
procedure SetProxyPort(const AValue: Integer);
|
procedure SetProxyPort(const AValue: Integer);
|
||||||
procedure SetProxyServer(const AValue: string);
|
procedure SetProxyServer(const AValue: string);
|
||||||
@@ -60,12 +63,36 @@ Type
|
|||||||
property ProxyPassword : string read GetProxyPassword write SetProxyPassword;
|
property ProxyPassword : string read GetProxyPassword write SetProxyPassword;
|
||||||
property SoapAction : string read FSoapAction write FSoapAction;
|
property SoapAction : string read FSoapAction write FSoapAction;
|
||||||
property Format : string read FFormat write FFormat;
|
property Format : string read FFormat write FFormat;
|
||||||
|
property ProtocolVersion : string read GetProtocolVersion write SetProtocolVersion;
|
||||||
End;
|
End;
|
||||||
{$M+}
|
{$M+}
|
||||||
|
|
||||||
procedure INDY_RegisterHTTP_Transport();
|
procedure INDY_RegisterHTTP_Transport();
|
||||||
|
|
||||||
implementation
|
implementation
|
||||||
|
uses
|
||||||
|
wst_consts;
|
||||||
|
|
||||||
|
const
|
||||||
|
ProtocolVersionMAP : array[TIdHTTPProtocolVersion] of string = ('1.0', '1.1');
|
||||||
|
|
||||||
|
function TryStrToProtocolVersion(
|
||||||
|
const AStr : string;
|
||||||
|
out ARes : TIdHTTPProtocolVersion
|
||||||
|
) : Boolean;
|
||||||
|
var
|
||||||
|
i : TIdHTTPProtocolVersion;
|
||||||
|
begin
|
||||||
|
for i := Low(TIdHTTPProtocolVersion) to High(TIdHTTPProtocolVersion) do begin
|
||||||
|
if ( AStr = ProtocolVersionMAP[i] ) then begin
|
||||||
|
ARes := i;
|
||||||
|
Result := True;
|
||||||
|
Exit;
|
||||||
|
end;
|
||||||
|
end;
|
||||||
|
Result := False;
|
||||||
|
end;
|
||||||
|
|
||||||
|
|
||||||
{ THTTPTransport }
|
{ THTTPTransport }
|
||||||
|
|
||||||
@@ -74,6 +101,11 @@ begin
|
|||||||
Result := FConnection.Request.URL;
|
Result := FConnection.Request.URL;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
|
function THTTPTransport.GetProtocolVersion : string;
|
||||||
|
begin
|
||||||
|
Result := ProtocolVersionMAP[FConnection.ProtocolVersion];
|
||||||
|
end;
|
||||||
|
|
||||||
function THTTPTransport.GetProxyPassword: string;
|
function THTTPTransport.GetProxyPassword: string;
|
||||||
begin
|
begin
|
||||||
Result := FConnection.ProxyParams.ProxyPassword;
|
Result := FConnection.ProxyParams.ProxyPassword;
|
||||||
@@ -99,6 +131,17 @@ begin
|
|||||||
FConnection.Request.URL := AValue;
|
FConnection.Request.URL := AValue;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
|
procedure THTTPTransport.SetProtocolVersion(const AValue : string);
|
||||||
|
var
|
||||||
|
locValue : TIdHTTPProtocolVersion;
|
||||||
|
begin
|
||||||
|
if not TryStrToProtocolVersion(AValue,locValue) then
|
||||||
|
raise ETransportExecption.CreateFmt(SERR_InvalidPropertyValue,['ProtocolVersion',AValue]);
|
||||||
|
FConnection.ProtocolVersion := locValue;
|
||||||
|
if not ( hoKeepOrigProtocol in FConnection.HTTPOptions ) then
|
||||||
|
FConnection.HTTPOptions := FConnection.HTTPOptions + [hoKeepOrigProtocol];
|
||||||
|
end;
|
||||||
|
|
||||||
procedure THTTPTransport.SetProxyPassword(const AValue: string);
|
procedure THTTPTransport.SetProxyPassword(const AValue: string);
|
||||||
begin
|
begin
|
||||||
FConnection.ProxyParams.ProxyPassword := AValue;
|
FConnection.ProxyParams.ProxyPassword := AValue;
|
||||||
@@ -151,8 +194,11 @@ begin
|
|||||||
FConnection.ProxyParams.BasicAuthentication := True;
|
FConnection.ProxyParams.BasicAuthentication := True;
|
||||||
end;
|
end;
|
||||||
FConnection.Request.CustomHeaders.Clear();
|
FConnection.Request.CustomHeaders.Clear();
|
||||||
FConnection.Request.CustomHeaders.Values['soapAction'] := SoapAction;
|
FConnection.Request.CustomHeaders.Values['SOAPAction'] := SoapAction;
|
||||||
FConnection.Request.ContentType := ContentType;
|
FConnection.Request.ContentType := ContentType;
|
||||||
|
{$IFDEF WST_DBG}
|
||||||
|
TMemoryStream(ARequest).SaveToFile('request.log');
|
||||||
|
{$ENDIF WST_DBG}
|
||||||
FConnection.Post(Address,ARequest, AResponse);
|
FConnection.Post(Address,ARequest, AResponse);
|
||||||
{$IFDEF WST_DBG}
|
{$IFDEF WST_DBG}
|
||||||
i := AResponse.Size;
|
i := AResponse.Size;
|
||||||
|
@@ -310,10 +310,10 @@ begin
|
|||||||
RegisterExternalPropertyName('__FIELDS__','fieldSmallint;fieldWord;fieldString');
|
RegisterExternalPropertyName('__FIELDS__','fieldSmallint;fieldWord;fieldString');
|
||||||
end;
|
end;
|
||||||
{$IFNDEF WST_RECORD_RTTI}
|
{$IFNDEF WST_RECORD_RTTI}
|
||||||
typeReg.ItemByTypeInfo[TypeInfo(TTestSmallRecord)].RegisterObject(FIELDS_STRING,TRecordRttiDataObject.Create(MakeRecordTypeInfo(TypeInfo(TTestSmallRecord)),GetTypeRegistry().ItemByTypeInfo[TypeInfo(TTestSmallRecord)].GetExternalPropertyName('__FIELDS__')));
|
typeReg.ItemByTypeInfo[TypeInfo(TTestSmallRecord)].RegisterObject(FIELDS_STRING,TRecordRttiDataObject.Create(MakeRecordTypeInfo(TypeInfo(TTestSmallRecord)),typeReg.ItemByTypeInfo[TypeInfo(TTestSmallRecord)].GetExternalPropertyName('__FIELDS__')));
|
||||||
{$ENDIF WST_RECORD_RTTI}
|
{$ENDIF WST_RECORD_RTTI}
|
||||||
{$IFDEF WST_RECORD_RTTI}
|
{$IFDEF WST_RECORD_RTTI}
|
||||||
typeReg.ItemByTypeInfo[TypeInfo(TTestSmallRecord)].RegisterObject(FIELDS_STRING,TRecordRttiDataObject.Create(MakeRecordTypeInfo(__TTestSmallRecord_TYPEINFO_FUNC__()),GetTypeRegistry().ItemByTypeInfo[TypeInfo(TTestSmallRecord)].GetExternalPropertyName('__FIELDS__')));
|
typeReg.ItemByTypeInfo[TypeInfo(TTestSmallRecord)].RegisterObject(FIELDS_STRING,TRecordRttiDataObject.Create(MakeRecordTypeInfo(__TTestSmallRecord_TYPEINFO_FUNC__()),typeReg.ItemByTypeInfo[TypeInfo(TTestSmallRecord)].GetExternalPropertyName('__FIELDS__')));
|
||||||
{$ENDIF WST_RECORD_RTTI}
|
{$ENDIF WST_RECORD_RTTI}
|
||||||
(typeReg.ItemByTypeInfo[TypeInfo(TTestSmallRecord)].GetObject(FIELDS_STRING) as TRecordRttiDataObject).GetField('fieldWord')^.IsAttribute := True;
|
(typeReg.ItemByTypeInfo[TypeInfo(TTestSmallRecord)].GetObject(FIELDS_STRING) as TRecordRttiDataObject).GetField('fieldWord')^.IsAttribute := True;
|
||||||
handlerReg := CreateWsdlTypeHandlerRegistry(typeReg);
|
handlerReg := CreateWsdlTypeHandlerRegistry(typeReg);
|
||||||
|
@@ -20,6 +20,7 @@ uses
|
|||||||
pparser, pastree;
|
pparser, pastree;
|
||||||
|
|
||||||
const
|
const
|
||||||
|
sEMBEDDED_TYPE = '_E_T_';
|
||||||
sEXTERNAL_NAME = '_E_N_';
|
sEXTERNAL_NAME = '_E_N_';
|
||||||
sATTRIBUTE = '_ATTRIBUTE_';
|
sATTRIBUTE = '_ATTRIBUTE_';
|
||||||
sARRAY_ITEM_NAME = 'ARRAY_ITEM_NAME';
|
sARRAY_ITEM_NAME = 'ARRAY_ITEM_NAME';
|
||||||
@@ -409,6 +410,7 @@ begin
|
|||||||
AddSystemSymbol(Result,AContainer);
|
AddSystemSymbol(Result,AContainer);
|
||||||
AddClassDef(Result,'TBaseRemotable','',TPasNativeClassType);
|
AddClassDef(Result,'TBaseRemotable','',TPasNativeClassType);
|
||||||
AddClassDef(Result,'TAbstractSimpleRemotable','TBaseRemotable',TPasNativeClassType);
|
AddClassDef(Result,'TAbstractSimpleRemotable','TBaseRemotable',TPasNativeClassType);
|
||||||
|
AContainer.RegisterExternalAlias(AddClassDef(Result,'schema_Type','TAbstractSimpleRemotable'),'schema');
|
||||||
AContainer.RegisterExternalAlias(AddClassDef(Result,'TDateRemotable','TAbstractSimpleRemotable'),'date');
|
AContainer.RegisterExternalAlias(AddClassDef(Result,'TDateRemotable','TAbstractSimpleRemotable'),'date');
|
||||||
AContainer.RegisterExternalAlias(AddClassDef(Result,'TDateTimeRemotable','TAbstractSimpleRemotable'),'dateTime');
|
AContainer.RegisterExternalAlias(AddClassDef(Result,'TDateTimeRemotable','TAbstractSimpleRemotable'),'dateTime');
|
||||||
{$IFDEF WST_HAS_TDURATIONREMOTABLE}
|
{$IFDEF WST_HAS_TDURATIONREMOTABLE}
|
||||||
|
@@ -51,6 +51,8 @@ type
|
|||||||
) : TPasElement;{$IFDEF USE_INLINE}inline;{$ENDIF}
|
) : TPasElement;{$IFDEF USE_INLINE}inline;{$ENDIF}
|
||||||
function FindElementWithHint(const AName, AHint : string; const ASpace : TSearchSpace) : TPasElement;
|
function FindElementWithHint(const AName, AHint : string; const ASpace : TSearchSpace) : TPasElement;
|
||||||
function ExtractTypeHint(AElement : TDOMNode) : string;{$IFDEF USE_INLINE}inline;{$ENDIF}
|
function ExtractTypeHint(AElement : TDOMNode) : string;{$IFDEF USE_INLINE}inline;{$ENDIF}
|
||||||
|
procedure SetAsEmbeddedType(AType : TPasType);
|
||||||
|
function IsEmbeddedType(AType : TPasType) : Boolean;
|
||||||
{$IFDEF WST_HANDLE_DOC}
|
{$IFDEF WST_HANDLE_DOC}
|
||||||
procedure ParseDocumentation(AType : TPasType);
|
procedure ParseDocumentation(AType : TPasType);
|
||||||
{$ENDIF WST_HANDLE_DOC}
|
{$ENDIF WST_HANDLE_DOC}
|
||||||
@@ -353,6 +355,16 @@ begin
|
|||||||
Result := '';
|
Result := '';
|
||||||
end;
|
end;
|
||||||
|
|
||||||
|
procedure TAbstractTypeParser.SetAsEmbeddedType(AType : TPasType);
|
||||||
|
begin
|
||||||
|
FSymbols.Properties.SetValue(AType,sEMBEDDED_TYPE,'1');
|
||||||
|
end;
|
||||||
|
|
||||||
|
function TAbstractTypeParser.IsEmbeddedType(AType : TPasType) : Boolean;
|
||||||
|
begin
|
||||||
|
Result := ( FSymbols.Properties.GetValue(AType,sEMBEDDED_TYPE) = '1' );
|
||||||
|
end;
|
||||||
|
|
||||||
{$IFDEF WST_HANDLE_DOC}
|
{$IFDEF WST_HANDLE_DOC}
|
||||||
procedure TAbstractTypeParser.ParseDocumentation(AType : TPasType);
|
procedure TAbstractTypeParser.ParseDocumentation(AType : TPasType);
|
||||||
var
|
var
|
||||||
@@ -1049,10 +1061,10 @@ begin
|
|||||||
internalName := ExtractIdentifier(ATypeName);
|
internalName := ExtractIdentifier(ATypeName);
|
||||||
hasInternalName := IsReservedKeyWord(internalName) or
|
hasInternalName := IsReservedKeyWord(internalName) or
|
||||||
( not IsValidIdent(internalName) ) or
|
( not IsValidIdent(internalName) ) or
|
||||||
//( FSymbols.IndexOf(internalName) <> -1 ) or
|
( FSymbols.FindElementInModule(internalName,Self.Module,[elkName]) <> nil ) or
|
||||||
( not AnsiSameText(internalName,ATypeName) );
|
( not AnsiSameText(internalName,ATypeName) );
|
||||||
if hasInternalName then begin
|
if hasInternalName then begin
|
||||||
internalName := Format('_%s',[internalName]);
|
internalName := Format('%s_Type',[internalName]);
|
||||||
end;
|
end;
|
||||||
|
|
||||||
if ( pthDeriveFromSoapArray in FHints ) or
|
if ( pthDeriveFromSoapArray in FHints ) or
|
||||||
@@ -1379,7 +1391,8 @@ begin
|
|||||||
if Assigned(locSym) then begin
|
if Assigned(locSym) then begin
|
||||||
if not locSym.InheritsFrom(TPasType) then
|
if not locSym.InheritsFrom(TPasType) then
|
||||||
raise EXsdParserException.CreateFmt('Symbol found in the symbol table but is not a type definition : %s.',[FTypeName]);
|
raise EXsdParserException.CreateFmt('Symbol found in the symbol table but is not a type definition : %s.',[FTypeName]);
|
||||||
locContinue := locSym.InheritsFrom(TPasUnresolvedTypeRef);
|
locContinue := locSym.InheritsFrom(TPasUnresolvedTypeRef) or
|
||||||
|
( IsEmbeddedType(TPasType(locSym)) <> FEmbededDef );
|
||||||
if not locContinue then;
|
if not locContinue then;
|
||||||
Result := locSym as TPasType;
|
Result := locSym as TPasType;
|
||||||
end;
|
end;
|
||||||
|
@@ -75,7 +75,11 @@ type
|
|||||||
const ASoapBindingStyle : string
|
const ASoapBindingStyle : string
|
||||||
) : TPasProcedure;
|
) : TPasProcedure;
|
||||||
function GetParser(const ANamespace : string) : IXsdPaser;
|
function GetParser(const ANamespace : string) : IXsdPaser;
|
||||||
function ParseType(const AName : string; const AHint : string = '') : TPasType;
|
function ParseType(
|
||||||
|
const AName : string;
|
||||||
|
const AHint : string = '';
|
||||||
|
const ATypeOrElement : string = ''
|
||||||
|
) : TPasType;
|
||||||
procedure ParseTypes();
|
procedure ParseTypes();
|
||||||
protected
|
protected
|
||||||
function GetXsShortNames() : TStrings;
|
function GetXsShortNames() : TStrings;
|
||||||
@@ -300,6 +304,7 @@ procedure TWsdlParser.Execute(const AMode: TParserMode; const AModuleName: strin
|
|||||||
schmNode, tmpNode : TDOMNode;
|
schmNode, tmpNode : TDOMNode;
|
||||||
s : string;
|
s : string;
|
||||||
typeList : TList;
|
typeList : TList;
|
||||||
|
locXsdParser : IXsdPaser;
|
||||||
begin
|
begin
|
||||||
if Assigned(FSchemaCursor) then begin
|
if Assigned(FSchemaCursor) then begin
|
||||||
FSchemaCursor.Reset();
|
FSchemaCursor.Reset();
|
||||||
@@ -323,7 +328,8 @@ procedure TWsdlParser.Execute(const AMode: TParserMode; const AModuleName: strin
|
|||||||
tmpNode := FindNamedNode(typeCursor,FSymbols.GetExternalName(sym));
|
tmpNode := FindNamedNode(typeCursor,FSymbols.GetExternalName(sym));
|
||||||
if Assigned(tmpNode) then begin
|
if Assigned(tmpNode) then begin
|
||||||
//symNew := ParseType(FSymbols.GetExternalName(sym));
|
//symNew := ParseType(FSymbols.GetExternalName(sym));
|
||||||
symNew := GetParser(schmNode.Attributes.GetNamedItem(s_targetNamespace).NodeValue).ParseType(FSymbols.GetExternalName(sym));
|
locXsdParser := GetParser(schmNode.Attributes.GetNamedItem(s_targetNamespace).NodeValue);
|
||||||
|
symNew := locXsdParser.ParseType(FSymbols.GetExternalName(sym),tmpNode);
|
||||||
//symNew := ParseType(tmpNode.Attributes.GetNamedItem(s_name).NodeValue);
|
//symNew := ParseType(tmpNode.Attributes.GetNamedItem(s_name).NodeValue);
|
||||||
if ( sym <> symNew ) then begin
|
if ( sym <> symNew ) then begin
|
||||||
FModule.InterfaceSection.Declarations.Extract(sym);
|
FModule.InterfaceSection.Declarations.Extract(sym);
|
||||||
@@ -460,7 +466,7 @@ function TWsdlParser.ParseOperation(
|
|||||||
function GetDataType(const AName, ATypeOrElement : string; const ATypeHint : string = ''):TPasType;
|
function GetDataType(const AName, ATypeOrElement : string; const ATypeHint : string = ''):TPasType;
|
||||||
begin
|
begin
|
||||||
try
|
try
|
||||||
Result := ParseType(AName,ATypeHint);
|
Result := ParseType(AName,ATypeHint,ATypeOrElement);
|
||||||
except
|
except
|
||||||
on e : Exception do begin
|
on e : Exception do begin
|
||||||
DoOnMessage(mtError, e.Message + ' ' + AName + ' ' + ATypeOrElement);
|
DoOnMessage(mtError, e.Message + ' ' + AName + ' ' + ATypeOrElement);
|
||||||
@@ -578,7 +584,9 @@ function TWsdlParser.ParseOperation(
|
|||||||
prmName := ExtractNameFromQName(prmTypeName);
|
prmName := ExtractNameFromQName(prmTypeName);
|
||||||
end;
|
end;
|
||||||
prmInternameName := Trim(prmName);
|
prmInternameName := Trim(prmName);
|
||||||
if AnsiSameText(prmInternameName,tmpMthd.Name) then begin
|
if AnsiSameText(prmInternameName,tmpMthd.Name) or
|
||||||
|
AnsiSameText(prmInternameName,ExtractNameFromQName(prmTypeName))
|
||||||
|
then begin
|
||||||
prmInternameName := prmInternameName + 'Param';
|
prmInternameName := prmInternameName + 'Param';
|
||||||
end;
|
end;
|
||||||
prmHasInternameName := IsReservedKeyWord(prmInternameName) or
|
prmHasInternameName := IsReservedKeyWord(prmInternameName) or
|
||||||
@@ -1176,11 +1184,16 @@ begin
|
|||||||
end;
|
end;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
function TWsdlParser.ParseType(const AName : string; const AHint : string) : TPasType;
|
function TWsdlParser.ParseType(
|
||||||
|
const AName : string;
|
||||||
|
const AHint : string;
|
||||||
|
const ATypeOrElement : string
|
||||||
|
) : TPasType;
|
||||||
var
|
var
|
||||||
localName, spaceShort, spaceLong : string;
|
localName, spaceShort, spaceLong : string;
|
||||||
locPrs : IXsdPaser;
|
locPrs : IXsdPaser;
|
||||||
xsdModule : TPasModule;
|
xsdModule : TPasModule;
|
||||||
|
locTypeKind : string;
|
||||||
begin
|
begin
|
||||||
ExplodeQName(AName,localName,spaceShort);
|
ExplodeQName(AName,localName,spaceShort);
|
||||||
if ( FXSShortNames.IndexOf(spaceShort) >= 0 ) then begin
|
if ( FXSShortNames.IndexOf(spaceShort) >= 0 ) then begin
|
||||||
@@ -1196,7 +1209,11 @@ begin
|
|||||||
if not FindNameSpace(spaceShort,spaceLong) then
|
if not FindNameSpace(spaceShort,spaceLong) then
|
||||||
raise EXsdParserAssertException.CreateFmt('Unable to resolve the namespace : "%s".',[spaceShort]);
|
raise EXsdParserAssertException.CreateFmt('Unable to resolve the namespace : "%s".',[spaceShort]);
|
||||||
locPrs := GetParser(spaceLong);
|
locPrs := GetParser(spaceLong);
|
||||||
Result := locPrs.ParseType(AName);
|
if ( ATypeOrElement = s_element ) then
|
||||||
|
locTypeKind := s_element
|
||||||
|
else
|
||||||
|
locTypeKind := '';
|
||||||
|
Result := locPrs.ParseType(AName,locTypeKind);
|
||||||
end;
|
end;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
|
@@ -55,7 +55,14 @@ type
|
|||||||
|
|
||||||
IXsdPaser = interface
|
IXsdPaser = interface
|
||||||
['{F0CEC726-A068-4CCC-B1E7-D31F018415B2}']
|
['{F0CEC726-A068-4CCC-B1E7-D31F018415B2}']
|
||||||
function ParseType(const AName : string) : TPasType;
|
function ParseType(
|
||||||
|
const AName,
|
||||||
|
ATypeKind : string { ATypeKind "ComplexType", "SimpleType", "Element" }
|
||||||
|
) : TPasType; overload;
|
||||||
|
function ParseType(
|
||||||
|
const AName : string;
|
||||||
|
const ATypeNode : TDOMNode
|
||||||
|
) : TPasType; overload;
|
||||||
procedure ParseTypes();
|
procedure ParseTypes();
|
||||||
procedure SetNotifier(ANotifier : TOnParserMessage);
|
procedure SetNotifier(ANotifier : TOnParserMessage);
|
||||||
end;
|
end;
|
||||||
@@ -90,6 +97,10 @@ type
|
|||||||
function FindShortNamesForNameSpaceLocal(const ANameSpace : string) : TStrings;
|
function FindShortNamesForNameSpaceLocal(const ANameSpace : string) : TStrings;
|
||||||
function FindShortNamesForNameSpace(const ANameSpace : string) : TStrings;
|
function FindShortNamesForNameSpace(const ANameSpace : string) : TStrings;
|
||||||
procedure SetNotifier(ANotifier : TOnParserMessage);
|
procedure SetNotifier(ANotifier : TOnParserMessage);
|
||||||
|
function InternalParseType(
|
||||||
|
const AName : string;
|
||||||
|
const ATypeNode : TDOMNode
|
||||||
|
) : TPasType;
|
||||||
public
|
public
|
||||||
constructor Create(
|
constructor Create(
|
||||||
ADoc : TXMLDocument;
|
ADoc : TXMLDocument;
|
||||||
@@ -98,7 +109,15 @@ type
|
|||||||
AParentContext : IParserContext
|
AParentContext : IParserContext
|
||||||
);
|
);
|
||||||
destructor Destroy();override;
|
destructor Destroy();override;
|
||||||
function ParseType(const AName : string) : TPasType;
|
function ParseType(
|
||||||
|
const AName,
|
||||||
|
ATypeKind : string { ATypeKind "ComplexType", "SimpleType", "Element" }
|
||||||
|
) : TPasType; overload;
|
||||||
|
function ParseType(
|
||||||
|
const AName : string;
|
||||||
|
const ATypeNode : TDOMNode
|
||||||
|
) : TPasType; overload;
|
||||||
|
|
||||||
procedure ParseTypes();
|
procedure ParseTypes();
|
||||||
|
|
||||||
function GetTargetNameSpace() : string;
|
function GetTargetNameSpace() : string;
|
||||||
@@ -296,7 +315,23 @@ begin
|
|||||||
Result := FXSShortNames;
|
Result := FXSShortNames;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
function TCustomXsdSchemaParser.ParseType(const AName: string): TPasType;
|
function TCustomXsdSchemaParser.ParseType(const AName, ATypeKind : string): TPasType;
|
||||||
|
begin
|
||||||
|
Result := InternalParseType(AName,nil);
|
||||||
|
end;
|
||||||
|
|
||||||
|
function TCustomXsdSchemaParser.ParseType(
|
||||||
|
const AName : string;
|
||||||
|
const ATypeNode : TDOMNode
|
||||||
|
) : TPasType;
|
||||||
|
begin
|
||||||
|
Result := InternalParseType(AName,ATypeNode);
|
||||||
|
end;
|
||||||
|
|
||||||
|
function TCustomXsdSchemaParser.InternalParseType(
|
||||||
|
const AName : string;
|
||||||
|
const ATypeNode : TDOMNode
|
||||||
|
): TPasType;
|
||||||
var
|
var
|
||||||
crsSchemaChild : IObjectCursor;
|
crsSchemaChild : IObjectCursor;
|
||||||
typNd : TDOMNode;
|
typNd : TDOMNode;
|
||||||
@@ -324,6 +359,9 @@ var
|
|||||||
begin
|
begin
|
||||||
ASimpleTypeAlias := nil;
|
ASimpleTypeAlias := nil;
|
||||||
Result := True;
|
Result := True;
|
||||||
|
if ( ATypeNode <> nil ) then
|
||||||
|
typNd := ATypeNode
|
||||||
|
else
|
||||||
typNd := FindNamedNode(crsSchemaChild,localTypeName);
|
typNd := FindNamedNode(crsSchemaChild,localTypeName);
|
||||||
if not Assigned(typNd) then
|
if not Assigned(typNd) then
|
||||||
raise EXsdTypeNotFoundException.CreateFmt('Type definition not found 1 : "%s"',[AName]);
|
raise EXsdTypeNotFoundException.CreateFmt('Type definition not found 1 : "%s"',[AName]);
|
||||||
@@ -432,6 +470,7 @@ var
|
|||||||
sct : TPasSection;
|
sct : TPasSection;
|
||||||
shortNameSpace, longNameSpace : string;
|
shortNameSpace, longNameSpace : string;
|
||||||
typeModule : TPasModule;
|
typeModule : TPasModule;
|
||||||
|
locTypeNodeFound : Boolean;
|
||||||
begin
|
begin
|
||||||
sct := nil;
|
sct := nil;
|
||||||
DoOnMessage(mtInfo, Format('Parsing "%s" ...',[AName]));
|
DoOnMessage(mtInfo, Format('Parsing "%s" ...',[AName]));
|
||||||
@@ -449,6 +488,14 @@ begin
|
|||||||
if ( typeModule = nil ) then
|
if ( typeModule = nil ) then
|
||||||
raise EXsdTypeNotFoundException.Create(AName);
|
raise EXsdTypeNotFoundException.Create(AName);
|
||||||
Result := SymbolTable.FindElementInModule(localTypeName,typeModule) as TPasType;
|
Result := SymbolTable.FindElementInModule(localTypeName,typeModule) as TPasType;
|
||||||
|
Init();
|
||||||
|
locTypeNodeFound := FindTypeNode(aliasType);
|
||||||
|
if ( Result <> nil ) and ( typeModule = FModule ) and
|
||||||
|
( not Result.InheritsFrom(TPasUnresolvedTypeRef) )
|
||||||
|
then begin
|
||||||
|
if locTypeNodeFound and ( embededType <> ( SymbolTable.Properties.GetValue(Result,sEMBEDDED_TYPE) = '1' ) ) then
|
||||||
|
Result := nil;
|
||||||
|
end;
|
||||||
if ( ( Result = nil ) or Result.InheritsFrom(TPasUnresolvedTypeRef) ) and
|
if ( ( Result = nil ) or Result.InheritsFrom(TPasUnresolvedTypeRef) ) and
|
||||||
( typeModule = FModule )
|
( typeModule = FModule )
|
||||||
then begin
|
then begin
|
||||||
@@ -456,7 +503,7 @@ begin
|
|||||||
frwType := Result;
|
frwType := Result;
|
||||||
Result := nil;
|
Result := nil;
|
||||||
Init();
|
Init();
|
||||||
if FindTypeNode(aliasType) then begin
|
if locTypeNodeFound {FindTypeNode(aliasType)} then begin
|
||||||
if AnsiSameText(ExtractNameFromQName(typNd.NodeName),s_complexType) then begin
|
if AnsiSameText(ExtractNameFromQName(typNd.NodeName),s_complexType) then begin
|
||||||
Result := ParseComplexType();
|
Result := ParseComplexType();
|
||||||
end else if AnsiSameText(ExtractNameFromQName(typNd.NodeName),s_simpleType) then begin
|
end else if AnsiSameText(ExtractNameFromQName(typNd.NodeName),s_simpleType) then begin
|
||||||
@@ -520,8 +567,9 @@ begin
|
|||||||
typTmpCrs := CreateCursorOn(typTmpCrs,ParseFilter(Format('%s=%s',[s_NODE_NAME,QuotedStr(s_name)]),TDOMNodeRttiExposer));
|
typTmpCrs := CreateCursorOn(typTmpCrs,ParseFilter(Format('%s=%s',[s_NODE_NAME,QuotedStr(s_name)]),TDOMNodeRttiExposer));
|
||||||
typTmpCrs.Reset();
|
typTmpCrs.Reset();
|
||||||
if typTmpCrs.MoveNext() then begin
|
if typTmpCrs.MoveNext() then begin
|
||||||
ParseType(
|
InternalParseType(
|
||||||
(typTmpCrs.GetCurrent() as TDOMNodeRttiExposer).NodeValue
|
(typTmpCrs.GetCurrent() as TDOMNodeRttiExposer).NodeValue,
|
||||||
|
typNode
|
||||||
);
|
);
|
||||||
end;
|
end;
|
||||||
end;
|
end;
|
||||||
|
Reference in New Issue
Block a user