Unify resource strings in wst_consts.pas

git-svn-id: https://svn.code.sf.net/p/lazarus-ccr/svn@902 8e941d3f-bd1b-0410-a28a-d453659cc2b4
This commit is contained in:
inoussa
2009-07-09 14:10:58 +00:00
parent 3b875dfea2
commit eda0eb7910
11 changed files with 129 additions and 95 deletions

View File

@ -477,7 +477,7 @@ type
implementation implementation
uses uses
imp_utils; imp_utils, wst_consts;
{$INCLUDE wst_rtl_imp.inc} {$INCLUDE wst_rtl_imp.inc}
@ -578,9 +578,9 @@ Begin
If ( AIndex >= 0 ) And ( AIndex < AOwner^.ArrayData^.Count ) Then If ( AIndex >= 0 ) And ( AIndex < AOwner^.ArrayData^.Count ) Then
AOwner^.ArrayData^.Items^[AIndex] := AChildData AOwner^.ArrayData^.Items^[AIndex] := AChildData
Else Else
Raise EBinaryFormatterException.CreateFmt('Invalid array acces : %d',[AIndex]) Raise EBinaryFormatterException.CreateFmt(SERR_IndexOutOfBound,[AIndex])
End Else Begin End Else Begin
Raise EBinaryFormatterException.CreateFmt('Invalid data type in this context : %d',[Ord(AOwner^.DataType)]) Raise EBinaryFormatterException.CreateFmt(SERR_InvalidDataTypeInContext,[GetEnumName(TypeInfo(TDataType), Ord(AOwner^.DataType))])
End; End;
End; End;
@ -912,7 +912,7 @@ begin
p := p^.Next; p := p^.Next;
Result := p^.Data; Result := p^.Data;
End Else End Else
Raise EBinaryFormatterException.CreateFmt('Invalid index access : %d',[AIndex]); Raise EBinaryFormatterException.CreateFmt(SERR_IndexOutOfBound,[AIndex]);
end; end;
function TObjectStackItem.CreateBuffer( function TObjectStackItem.CreateBuffer(
@ -1038,7 +1038,7 @@ end;
procedure TBaseBinaryFormatter.CheckScope(); procedure TBaseBinaryFormatter.CheckScope();
begin begin
If Not HasScope() Then If Not HasScope() Then
Error('There is no scope.'); Error(SERR_NoScope);
end; end;
function TBaseBinaryFormatter.GetCurrentScope: String; function TBaseBinaryFormatter.GetCurrentScope: String;
@ -1381,12 +1381,12 @@ var
i, j, k : Integer; i, j, k : Integer;
begin begin
If ( Length(ABounds) < 2 ) Then If ( Length(ABounds) < 2 ) Then
Raise EBinaryFormatterException.Create('Invalid array bounds.'); Raise EBinaryFormatterException.Create(SERR_InvalidArrayBounds);
i := ABounds[0]; i := ABounds[0];
j := ABounds[1]; j := ABounds[1];
k := ( j - i + 1 ); k := ( j - i + 1 );
If ( k < 0 ) Then If ( k < 0 ) Then
Raise EBinaryFormatterException.Create('Invalid array bounds.'); Raise EBinaryFormatterException.Create(SERR_InvalidArrayBounds);
PushStack(CreateArrayBuffer(k,AName,StackTop().ScopeObject),stArray); PushStack(CreateArrayBuffer(k,AName,StackTop().ScopeObject),stArray);
end; end;
@ -1429,7 +1429,7 @@ begin
stk := StackTop(); stk := StackTop();
locNode := stk.Find(AScopeName); locNode := stk.Find(AScopeName);
if not Assigned(locNode) then begin if not Assigned(locNode) then begin
Error('Scope not found : "%s"',[AScopeName]); Error(SERR_ScopeNotFound,[AScopeName]);
end; end;
PushStack(locNode,stObject); PushStack(locNode,stObject);
Result := StackTop().GetItemCount(); Result := StackTop().GetItemCount();
@ -1675,7 +1675,7 @@ begin
{$ENDIF HAS_QWORD} {$ENDIF HAS_QWORD}
tkClass, tkRecord : tkClass, tkRecord :
begin begin
raise EBinaryFormatterException.Create('Inner Scope value must be a "simple type" value.'); raise EBinaryFormatterException.Create(SERR_InnerScopeMustBeSimpleType);
end; end;
{$IFDEF FPC} {$IFDEF FPC}
tkBool : tkBool :
@ -1966,7 +1966,7 @@ begin
tkUString : UnicodeString(AData) := dataBuffer^.UnicodeStrData^.Data; tkUString : UnicodeString(AData) := dataBuffer^.UnicodeStrData^.Data;
{$ENDIF WST_UNICODESTRING} {$ENDIF WST_UNICODESTRING}
tkClass, tkRecord : raise EBinaryFormatterException.Create('Inner Scope value must be a "simple type" value.'); tkClass, tkRecord : raise EBinaryFormatterException.Create(SERR_InnerScopeMustBeSimpleType);
{$IFDEF FPC} {$IFDEF FPC}
tkBool : Boolean(AData) := dataBuffer^.BoolData; tkBool : Boolean(AData) := dataBuffer^.BoolData;
{$ENDIF} {$ENDIF}
@ -2136,7 +2136,7 @@ begin
If ( FIndex >= 0 ) And ( FIndex < ScopeObject^.ArrayData^.Count ) Then If ( FIndex >= 0 ) And ( FIndex < ScopeObject^.ArrayData^.Count ) Then
Result := ScopeObject^.ArrayData^.Items^[FIndex] Result := ScopeObject^.ArrayData^.Items^[FIndex]
Else Else
Raise EBinaryFormatterException.CreateFmt('Invalid array index : %d',[FIndex]); Raise EBinaryFormatterException.CreateFmt(SERR_IndexOutOfBound,[FIndex]);
Inc(FIndex); Inc(FIndex);
end; end;
@ -2145,7 +2145,7 @@ begin
If ( AIndex >= 0 ) And ( AIndex < ScopeObject^.ArrayData^.Count ) Then If ( AIndex >= 0 ) And ( AIndex < ScopeObject^.ArrayData^.Count ) Then
Result := ScopeObject^.ArrayData^.Items^[AIndex] Result := ScopeObject^.ArrayData^.Items^[AIndex]
Else Else
Raise EBinaryFormatterException.CreateFmt('Invalid array index : %d',[AIndex]); Raise EBinaryFormatterException.CreateFmt(SERR_IndexOutOfBound,[AIndex]);
end; end;
function TArrayStackItem.CreateBuffer( function TArrayStackItem.CreateBuffer(
@ -2156,7 +2156,7 @@ begin
If ( FIndex >= 0 ) And ( FIndex < ScopeObject^.ArrayData^.Count ) Then If ( FIndex >= 0 ) And ( FIndex < ScopeObject^.ArrayData^.Count ) Then
Result := CreateObjBuffer(ADataType,AName,Nil) Result := CreateObjBuffer(ADataType,AName,Nil)
Else Else
Raise EBinaryFormatterException.CreateFmt('Invalid array index : %d',[FIndex]); Raise EBinaryFormatterException.CreateFmt(SERR_IndexOutOfBound,[FIndex]);
ScopeObject^.ArrayData^.Items^[FIndex] := Result; ScopeObject^.ArrayData^.Items^[FIndex] := Result;
Inc(FIndex); Inc(FIndex);
end; end;
@ -2164,12 +2164,12 @@ end;
{$WARNINGS OFF} {$WARNINGS OFF}
function TArrayStackItem.CreateInnerBuffer(const ADataType: TDataType): PDataBuffer; function TArrayStackItem.CreateInnerBuffer(const ADataType: TDataType): PDataBuffer;
begin begin
raise EBinaryFormatterException.Create('Array do not support "inner value" feature.'); raise EBinaryFormatterException.CreateFmt(SERR_InsupportedOperation,['TArrayStackItem.CreateInnerBuffer']);
end; end;
function TArrayStackItem.GetInnerBuffer(): PDataBuffer; function TArrayStackItem.GetInnerBuffer(): PDataBuffer;
begin begin
raise EBinaryFormatterException.Create('Array do not support "inner value" feature.'); raise EBinaryFormatterException.CreateFmt(SERR_InsupportedOperation,['TArrayStackItem.GetInnerBuffer']);
end; end;
{$WARNINGS ON} {$WARNINGS ON}

View File

@ -429,7 +429,8 @@ type
implementation implementation
uses jsonparser, imp_utils; uses
jsonparser, imp_utils, wst_consts;
{ TJsonRpcBaseFormatter } { TJsonRpcBaseFormatter }
@ -442,7 +443,7 @@ end;
procedure TJsonRpcBaseFormatter.CheckScope(); procedure TJsonRpcBaseFormatter.CheckScope();
begin begin
if not HasScope() then if not HasScope() then
Error('There is no scope.'); Error(SERR_NoScope);
end; end;
procedure TJsonRpcBaseFormatter.ClearStack(); procedure TJsonRpcBaseFormatter.ClearStack();
@ -865,12 +866,12 @@ var
locObj : TJSONData; locObj : TJSONData;
begin begin
if ( Length(ABounds) < 2 ) then if ( Length(ABounds) < 2 ) then
Error('Invalid array bounds.'); Error(SERR_InvalidArrayBounds);
i := ABounds[0]; i := ABounds[0];
j := ABounds[1]; j := ABounds[1];
k := ( j - i + 1 ); k := ( j - i + 1 );
if ( k < 0 ) then if ( k < 0 ) then
Error('Invalid array bounds.'); Error(SERR_InvalidArrayBounds);
if HasScope() then if HasScope() then
locObj := StackTop().CreateArrayBuffer(AName) locObj := StackTop().CreateArrayBuffer(AName)
else else
@ -883,7 +884,7 @@ var
stkItem : TStackItem; stkItem : TStackItem;
begin begin
if not FStack.AtLeast(2) then if not FStack.AtLeast(2) then
Error('The root object cannot be NIL.'); Error(SERR_RootObjectCannotBeNIL);
stkItem := PopStack(); stkItem := PopStack();
try try
PushStack(StackTop().NilItem(stkItem.ScopeObject),stNilScope); PushStack(StackTop().NilItem(stkItem.ScopeObject),stNilScope);
@ -918,7 +919,7 @@ begin
stk := StackTop(); stk := StackTop();
locNode := stk.FindNode(AScopeName); locNode := stk.FindNode(AScopeName);
if not Assigned(locNode) then begin if not Assigned(locNode) then begin
Error('Scope not found : "%s"',[AScopeName]); Error(SERR_ScopeNotFound,[AScopeName]);
end; end;
case locNode.JSONType() of case locNode.JSONType() of
jtObject : PushStack(locNode,stObject); jtObject : PushStack(locNode,stObject);

View File

@ -1853,10 +1853,10 @@ begin
if Assigned(recordData) then begin if Assigned(recordData) then begin
recordData.GetField(AField)^.Visible := AVisibility; recordData.GetField(AField)^.Visible := AVisibility;
end else begin end else begin
raise EServiceConfigException.CreateFmt('Record extended RTTI informations not found in type registry : "%s".',[ATypeInfo^.Name]); raise EServiceConfigException.CreateFmt(SERR_RecordExtendedRttiNotFound,[ATypeInfo^.Name]);
end; end;
end else begin end else begin
raise EServiceConfigException.Create('Invalid parameters.'); raise EServiceConfigException.Create(SERR_InvalidParameters);
end; end;
end; end;
@ -1891,7 +1891,7 @@ begin
end; end;
end; end;
if not ok then if not ok then
raise EServiceConfigException.Create('Invalid parameters.'); raise EServiceConfigException.Create(SERR_InvalidParameters);
end; end;
{$IFDEF FPC} {$IFDEF FPC}
@ -2786,7 +2786,7 @@ end;
constructor TSimpleItemFactory.Create(AItemClass: TSimpleFactoryItemClass); constructor TSimpleItemFactory.Create(AItemClass: TSimpleFactoryItemClass);
begin begin
if not Assigned(AItemClass) then if not Assigned(AItemClass) then
raise EServiceConfigException.CreateFmt('Invalid parameter : %s; Procedure = %s',['AItemClass','TSimpleItemFactory.Create()']); raise EServiceConfigException.CreateFmt(SERR_InvalidParameterProc,['AItemClass','TSimpleItemFactory.Create()']);
FItemClass := AItemClass; FItemClass := AItemClass;
end; end;
@ -2806,7 +2806,7 @@ begin
FreeAndNil(FPool); FreeAndNil(FPool);
if AValue then begin if AValue then begin
if ( PoolMin < 0 ) or ( PoolMin > PoolMax ) or ( PoolMax < 1 ) then if ( PoolMin < 0 ) or ( PoolMin > PoolMax ) or ( PoolMax < 1 ) then
raise EServiceException.Create('Invalid pool parametters.'); raise EServiceException.CreateFmt(SERR_InvalidPoolParametersArgs,[PoolMin,PoolMax]);
PreparePool(); PreparePool();
end; end;
FPooled := AValue; FPooled := AValue;
@ -2817,7 +2817,7 @@ begin
if ( FPoolMax = AValue ) then if ( FPoolMax = AValue ) then
Exit; Exit;
if Pooled then if Pooled then
raise EServiceException.Create('Operation not allowed on an active pool.'); raise EServiceException.Create(SERR_OperationNotAllowedOnActivePool);
FPoolMax := AValue; FPoolMax := AValue;
end; end;
@ -2826,7 +2826,7 @@ begin
if ( FPoolMin = AValue ) then if ( FPoolMin = AValue ) then
Exit; Exit;
if Pooled then if Pooled then
raise EServiceException.Create('Operation not allowed on an active pool.'); raise EServiceException.Create(SERR_OperationNotAllowedOnActivePool);
FPoolMin := AValue; FPoolMin := AValue;
end; end;
@ -3241,7 +3241,7 @@ begin
If ( i > -1 ) Then If ( i > -1 ) Then
Result := FList[i] as TTypeRegistryItem Result := FList[i] as TTypeRegistryItem
Else Else
Raise ETypeRegistryException.CreateFmt('Type not registered : %s',[Index^.Name]) Raise ETypeRegistryException.CreateFmt(SERR_TypeNotRegistered,[Index^.Name])
end; end;
constructor TTypeRegistry.Create(); constructor TTypeRegistry.Create();
@ -3281,7 +3281,7 @@ begin
If ( Result = -1 ) Then If ( Result = -1 ) Then
Result := FList.Add(AItem) Result := FList.Add(AItem)
Else Else
Raise ETypeRegistryException.CreateFmt('Type already registered : "%s"',[AItem.DataType^.Name]); Raise ETypeRegistryException.CreateFmt(SERR_TypeNotRegistered,[AItem.DataType^.Name]);
end; end;
function TTypeRegistry.Register( function TTypeRegistry.Register(
@ -3506,7 +3506,7 @@ end;
procedure TArrayOfStringRemotable.SetLength(const ANewSize: Integer); procedure TArrayOfStringRemotable.SetLength(const ANewSize: Integer);
begin begin
if ( ANewSize < 0 ) then if ( ANewSize < 0 ) then
raise EBaseRemoteException.CreateFmt('Invalid array length : %d',[ANewSize]); raise EBaseRemoteException.CreateFmt(SERR_InvalidArrayLength,[ANewSize]);
System.SetLength(FData,ANewSize); System.SetLength(FData,ANewSize);
end; end;
@ -3840,7 +3840,7 @@ end;
procedure TBaseArrayRemotable.CheckIndex(const AIndex : Integer); procedure TBaseArrayRemotable.CheckIndex(const AIndex : Integer);
begin begin
if ( AIndex < 0 ) or ( AIndex >= Length ) then if ( AIndex < 0 ) or ( AIndex >= Length ) then
raise EServiceException.CreateFmt('Index out of bound : %d',[AIndex]); raise EServiceException.CreateFmt(SERR_IndexOutOfBound,[AIndex]);
end; end;
destructor TBaseArrayRemotable.Destroy(); destructor TBaseArrayRemotable.Destroy();
@ -3890,7 +3890,7 @@ end;
procedure TArrayOfBooleanRemotable.SetLength(const ANewSize: Integer); procedure TArrayOfBooleanRemotable.SetLength(const ANewSize: Integer);
begin begin
if ( ANewSize < 0 ) then if ( ANewSize < 0 ) then
raise EBaseRemoteException.CreateFmt('Invalid array length : %d',[ANewSize]); raise EBaseRemoteException.CreateFmt(SERR_InvalidArrayLength,[ANewSize]);
System.SetLength(FData,ANewSize); System.SetLength(FData,ANewSize);
end; end;
@ -3954,7 +3954,7 @@ end;
procedure TArrayOfInt8URemotable.SetLength(const ANewSize: Integer); procedure TArrayOfInt8URemotable.SetLength(const ANewSize: Integer);
begin begin
if ( ANewSize < 0 ) then if ( ANewSize < 0 ) then
raise EBaseRemoteException.CreateFmt('Invalid array length : %d',[ANewSize]); raise EBaseRemoteException.CreateFmt(SERR_InvalidArrayLength,[ANewSize]);
System.SetLength(FData,ANewSize); System.SetLength(FData,ANewSize);
end; end;
@ -4018,7 +4018,7 @@ end;
procedure TArrayOfInt8SRemotable.SetLength(const ANewSize: Integer); procedure TArrayOfInt8SRemotable.SetLength(const ANewSize: Integer);
begin begin
if ( ANewSize < 0 ) then if ( ANewSize < 0 ) then
raise EBaseRemoteException.CreateFmt('Invalid array length : %d',[ANewSize]); raise EBaseRemoteException.CreateFmt(SERR_InvalidArrayLength,[ANewSize]);
System.SetLength(FData,ANewSize); System.SetLength(FData,ANewSize);
end; end;
@ -4082,7 +4082,7 @@ end;
procedure TArrayOfInt16SRemotable.SetLength(const ANewSize: Integer); procedure TArrayOfInt16SRemotable.SetLength(const ANewSize: Integer);
begin begin
if ( ANewSize < 0 ) then if ( ANewSize < 0 ) then
raise EBaseRemoteException.CreateFmt('Invalid array length : %d',[ANewSize]); raise EBaseRemoteException.CreateFmt(SERR_InvalidArrayLength,[ANewSize]);
System.SetLength(FData,ANewSize); System.SetLength(FData,ANewSize);
end; end;
@ -4146,7 +4146,7 @@ end;
procedure TArrayOfInt16URemotable.SetLength(const ANewSize: Integer); procedure TArrayOfInt16URemotable.SetLength(const ANewSize: Integer);
begin begin
if ( ANewSize < 0 ) then if ( ANewSize < 0 ) then
raise EBaseRemoteException.CreateFmt('Invalid array length : %d',[ANewSize]); raise EBaseRemoteException.CreateFmt(SERR_InvalidArrayLength,[ANewSize]);
System.SetLength(FData,ANewSize); System.SetLength(FData,ANewSize);
end; end;
@ -4210,7 +4210,7 @@ end;
procedure TArrayOfInt32URemotable.SetLength(const ANewSize: Integer); procedure TArrayOfInt32URemotable.SetLength(const ANewSize: Integer);
begin begin
if ( ANewSize < 0 ) then if ( ANewSize < 0 ) then
raise EBaseRemoteException.CreateFmt('Invalid array length : %d',[ANewSize]); raise EBaseRemoteException.CreateFmt(SERR_InvalidArrayLength,[ANewSize]);
System.SetLength(FData,ANewSize); System.SetLength(FData,ANewSize);
end; end;
@ -4274,7 +4274,7 @@ end;
procedure TArrayOfInt32SRemotable.SetLength(const ANewSize: Integer); procedure TArrayOfInt32SRemotable.SetLength(const ANewSize: Integer);
begin begin
if ( ANewSize < 0 ) then if ( ANewSize < 0 ) then
raise EBaseRemoteException.CreateFmt('Invalid array length : %d',[ANewSize]); raise EBaseRemoteException.CreateFmt(SERR_InvalidArrayLength,[ANewSize]);
System.SetLength(FData,ANewSize); System.SetLength(FData,ANewSize);
end; end;
@ -4338,7 +4338,7 @@ end;
procedure TArrayOfInt64SRemotable.SetLength(const ANewSize: Integer); procedure TArrayOfInt64SRemotable.SetLength(const ANewSize: Integer);
begin begin
if ( ANewSize < 0 ) then if ( ANewSize < 0 ) then
raise EBaseRemoteException.CreateFmt('Invalid array length : %d',[ANewSize]); raise EBaseRemoteException.CreateFmt(SERR_InvalidArrayLength,[ANewSize]);
System.SetLength(FData,ANewSize); System.SetLength(FData,ANewSize);
end; end;
@ -4402,7 +4402,7 @@ end;
procedure TArrayOfInt64URemotable.SetLength(const ANewSize: Integer); procedure TArrayOfInt64URemotable.SetLength(const ANewSize: Integer);
begin begin
if ( ANewSize < 0 ) then if ( ANewSize < 0 ) then
raise EBaseRemoteException.CreateFmt('Invalid array length : %d',[ANewSize]); raise EBaseRemoteException.CreateFmt(SERR_InvalidArrayLength,[ANewSize]);
System.SetLength(FData,ANewSize); System.SetLength(FData,ANewSize);
end; end;
@ -4466,7 +4466,7 @@ end;
procedure TArrayOfFloatSingleRemotable.SetLength(const ANewSize: Integer); procedure TArrayOfFloatSingleRemotable.SetLength(const ANewSize: Integer);
begin begin
if ( ANewSize < 0 ) then if ( ANewSize < 0 ) then
raise EBaseRemoteException.CreateFmt('Invalid array length : %d',[ANewSize]); raise EBaseRemoteException.CreateFmt(SERR_InvalidArrayLength,[ANewSize]);
System.SetLength(FData,ANewSize); System.SetLength(FData,ANewSize);
end; end;
@ -4530,7 +4530,7 @@ end;
procedure TArrayOfFloatDoubleRemotable.SetLength(const ANewSize: Integer); procedure TArrayOfFloatDoubleRemotable.SetLength(const ANewSize: Integer);
begin begin
if ( ANewSize < 0 ) then if ( ANewSize < 0 ) then
raise EBaseRemoteException.CreateFmt('Invalid array length : %d',[ANewSize]); raise EBaseRemoteException.CreateFmt(SERR_InvalidArrayLength,[ANewSize]);
System.SetLength(FData,ANewSize); System.SetLength(FData,ANewSize);
end; end;
@ -4594,7 +4594,7 @@ end;
procedure TArrayOfFloatExtendedRemotable.SetLength(const ANewSize: Integer); procedure TArrayOfFloatExtendedRemotable.SetLength(const ANewSize: Integer);
begin begin
if ( ANewSize < 0 ) then if ( ANewSize < 0 ) then
raise EBaseRemoteException.CreateFmt('Invalid array length : %d',[ANewSize]); raise EBaseRemoteException.CreateFmt(SERR_InvalidArrayLength,[ANewSize]);
System.SetLength(FData,ANewSize); System.SetLength(FData,ANewSize);
end; end;
@ -4658,7 +4658,7 @@ end;
procedure TArrayOfFloatCurrencyRemotable.SetLength(const ANewSize: Integer); procedure TArrayOfFloatCurrencyRemotable.SetLength(const ANewSize: Integer);
begin begin
if ( ANewSize < 0 ) then if ( ANewSize < 0 ) then
raise EBaseRemoteException.CreateFmt('Invalid array length : %d',[ANewSize]); raise EBaseRemoteException.CreateFmt(SERR_InvalidArrayLength,[ANewSize]);
System.SetLength(FData,ANewSize); System.SetLength(FData,ANewSize);
end; end;
@ -5991,7 +5991,7 @@ var
i : PtrInt; i : PtrInt;
begin begin
if not ( ( AMin >= 0 ) and ( AMax >= AMin ) and ( AFactory <> nil ) ) then if not ( ( AMin >= 0 ) and ( AMax >= AMin ) and ( AFactory <> nil ) ) then
raise Exception.CreateFmt('Invalid pool arguments Min = %d; Max = %d .',[AMin,AMax]); raise Exception.CreateFmt(SERR_InvalidPoolParametersArgs,[AMin,AMax]);
FMax := AMax; FMax := AMax;
FMin := AMin; FMin := AMin;
FFactory := AFactory; FFactory := AFactory;
@ -6028,7 +6028,7 @@ begin
Result := CreateNew(True).Intf; Result := CreateNew(True).Intf;
end; end;
end else begin end else begin
raise EServiceException.Create('Unable to create the object : Timeout expired.'); raise EServiceException.Create(SERRE_ObjectCreationTimeOut);
end; end;
end; end;
@ -6159,7 +6159,7 @@ begin
end; end;
typRegItem := GetTypeRegistry().ItemByTypeInfo[ATypeInfo]; typRegItem := GetTypeRegistry().ItemByTypeInfo[ATypeInfo];
typDataObj := typRegItem.GetObject(FIELDS_STRING); typDataObj := typRegItem.GetObject(FIELDS_STRING);
Assert(Assigned(typDataObj),Format('Incomplete type registration for the type of this parameter : %s',[AName])); Assert(Assigned(typDataObj),Format(SERR_IncompleteParamTypeRegistration,[AName]));
typData := PRecordTypeData((typDataObj as TDataObject).Data); typData := PRecordTypeData((typDataObj as TDataObject).Data);
Assert(Assigned(typData)); Assert(Assigned(typData));
if ( typData^.FieldCount > 0 ) then begin if ( typData^.FieldCount > 0 ) then begin
@ -6261,7 +6261,7 @@ begin
Exit; Exit;
typRegItem := GetTypeRegistry().ItemByTypeInfo[ATypeInfo]; typRegItem := GetTypeRegistry().ItemByTypeInfo[ATypeInfo];
typDataObj := typRegItem.GetObject(FIELDS_STRING); typDataObj := typRegItem.GetObject(FIELDS_STRING);
Assert(Assigned(typDataObj),Format('Incomplete type registration for the type of this parameter : %s',[AName])); Assert(Assigned(typDataObj),Format(SERR_IncompleteParamTypeRegistration,[AName]));
typData := PRecordTypeData((typDataObj as TDataObject).Data); typData := PRecordTypeData((typDataObj as TDataObject).Data);
Assert(Assigned(typData)); Assert(Assigned(typData));
if ( not Assigned(ARecord) ) then begin if ( not Assigned(ARecord) ) then begin

View File

@ -459,13 +459,16 @@ type
function BoolToSoapBool(const AValue : Boolean) : string;{$IFDEF USE_INLINE}inline;{$ENDIF} function BoolToSoapBool(const AValue : Boolean) : string;{$IFDEF USE_INLINE}inline;{$ENDIF}
resourcestring
SERR_NodeNotFoundByID = 'Node not found with this ID in the document : %s.';
SERR_ExpectingRemotableObjectClass = 'Expecting remotable object class but found %s.';
implementation implementation
Uses {$IFDEF WST_DELPHI}XMLDoc,XMLIntf,{$ELSE}XMLWrite, XMLRead,wst_fpc_xml,{$ENDIF} uses
StrUtils, imp_utils; {$IFDEF WST_DELPHI}
XMLDoc,XMLIntf,
{$ENDIF WST_DELPHI}
{$IFDEF FPC}
XMLWrite, XMLRead,wst_fpc_xml,
{$ENDIF FPC}
StrUtils, imp_utils, wst_consts;
function BoolToSoapBool(const AValue : Boolean) : string; function BoolToSoapBool(const AValue : Boolean) : string;
@ -538,7 +541,7 @@ end;
function TStackItem.EndEmbeddedScope(): Integer; function TStackItem.EndEmbeddedScope(): Integer;
begin begin
if ( FEmbeddedScopeCount < 1 ) then begin if ( FEmbeddedScopeCount < 1 ) then begin
raise Exception.Create('Invalid op�ration on scope, their are no embedded scope.'); raise Exception.Create(SERR_InvalidEmbeddedScopeOperation);
end; end;
Dec(FEmbeddedScopeCount); Dec(FEmbeddedScopeCount);
Result := FEmbeddedScopeCount; Result := FEmbeddedScopeCount;
@ -811,7 +814,7 @@ end;
procedure TSOAPBaseFormatter.CheckScope(); procedure TSOAPBaseFormatter.CheckScope();
begin begin
If Not HasScope() Then If Not HasScope() Then
Error('There is no scope.'); Error(SERR_NoScope);
end; end;
function ExtractNameSpaceShortName(const ANameSpaceDeclaration : string):string; function ExtractNameSpaceShortName(const ANameSpaceDeclaration : string):string;
@ -1316,7 +1319,7 @@ Var
begin begin
typData := GetTypeRegistry().Find(ATypeInfo,False); typData := GetTypeRegistry().Find(ATypeInfo,False);
If Not Assigned(typData) Then If Not Assigned(typData) Then
Error('Object type not registered : %s',[IfThen(Assigned(ATypeInfo),ATypeInfo^.Name,'')]); Error(SERR_TypeNotRegistered,[IfThen(Assigned(ATypeInfo),ATypeInfo^.Name,'')]);
mustAddAtt := False; mustAddAtt := False;
if ( ATypeInfo^.Kind = tkClass ) and if ( ATypeInfo^.Kind = tkClass ) and
GetTypeData(ATypeInfo)^.ClassType.InheritsFrom(TAbstractSimpleRemotable) and GetTypeData(ATypeInfo)^.ClassType.InheritsFrom(TAbstractSimpleRemotable) and
@ -1374,17 +1377,17 @@ Var
xsiNmspcSH : string; xsiNmspcSH : string;
begin begin
if ( Length(ABounds) < 2 ) then begin if ( Length(ABounds) < 2 ) then begin
Error('Invalid array bounds.'); Error(SERR_InvalidArrayBounds);
end; end;
i := ABounds[0]; i := ABounds[0];
j := ABounds[1]; j := ABounds[1];
k := j - i + 1; k := j - i + 1;
if ( k < 0 ) then begin if ( k < 0 ) then begin
Error('Invalid array bounds.'); Error(SERR_InvalidArrayBounds);
end; end;
typData := GetTypeRegistry().Find(ATypeInfo,False); typData := GetTypeRegistry().Find(ATypeInfo,False);
if not Assigned(typData) then begin if not Assigned(typData) then begin
Error('Array type not registered.'); Error(SERR_TypeNotRegistered,[ATypeInfo^.Name]);
end; end;
nmspc := typData.NameSpace; nmspc := typData.NameSpace;
if IsStrEmpty(nmspc) then begin if IsStrEmpty(nmspc) then begin
@ -1526,7 +1529,7 @@ begin
if ( Style = Document ) then begin if ( Style = Document ) then begin
typData := GetTypeRegistry().Find(ATypeInfo,False); typData := GetTypeRegistry().Find(ATypeInfo,False);
if not Assigned(typData) then begin if not Assigned(typData) then begin
Error('Object type not registered : %s',[IfThen(Assigned(ATypeInfo),ATypeInfo^.Name,'')]); Error(SERR_TypeNotRegistered,[IfThen(Assigned(ATypeInfo),ATypeInfo^.Name,'')]);
end; end;
if ( ATypeInfo^.Kind = tkClass ) and if ( ATypeInfo^.Kind = tkClass ) and
GetTypeData(ATypeInfo)^.ClassType.InheritsFrom(TAbstractSimpleRemotable) and GetTypeData(ATypeInfo)^.ClassType.InheritsFrom(TAbstractSimpleRemotable) and
@ -1948,7 +1951,7 @@ begin
{$ENDIF WST_UNICODESTRING} {$ENDIF WST_UNICODESTRING}
tkClass : tkClass :
begin begin
raise ESOAPException.Create('Inner Scope value must be a "simple type" value.'); raise ESOAPException.Create(SERR_InnerScopeMustBeSimpleType);
end; end;
{$IFDEF FPC} {$IFDEF FPC}
tkBool : tkBool :
@ -2209,7 +2212,7 @@ begin
{$ENDIF WST_UNICODESTRING} {$ENDIF WST_UNICODESTRING}
tkClass : tkClass :
begin begin
raise ESOAPException.Create('Inner Scope value must be a "simple type" value.'); raise ESOAPException.Create(SERR_InnerScopeMustBeSimpleType);
end; end;
{$IFDEF FPC} {$IFDEF FPC}
tkBool : tkBool :

View File

@ -839,7 +839,7 @@ end;
procedure TXmlRpcBaseFormatter.CheckScope(); procedure TXmlRpcBaseFormatter.CheckScope();
begin begin
If Not HasScope() Then If Not HasScope() Then
Error('There is no scope.'); Error(SERR_NoScope);
end; end;
function TXmlRpcBaseFormatter.InternalPutData( function TXmlRpcBaseFormatter.InternalPutData(
@ -1286,13 +1286,13 @@ var
i,j, k : Integer; i,j, k : Integer;
begin begin
if ( Length(ABounds) < 2 ) then begin if ( Length(ABounds) < 2 ) then begin
Error('Invalid array bounds.'); Error(SERR_InvalidArrayBounds);
end; end;
i := ABounds[0]; i := ABounds[0];
j := ABounds[1]; j := ABounds[1];
k := j - i + 1; k := j - i + 1;
if ( k < 0 ) then begin if ( k < 0 ) then begin
Error('Invalid array bounds.'); Error(SERR_InvalidArrayBounds);
end; end;
BeginScope(AName,'','',stArray,AStyle); BeginScope(AName,'','',stArray,AStyle);
@ -1579,7 +1579,7 @@ begin
{$ENDIF WST_UNICODESTRING} {$ENDIF WST_UNICODESTRING}
tkClass : tkClass :
begin begin
raise EXmlRpcException.Create('Inner Scope value must be a "simple type" value.'); raise EXmlRpcException.Create(SERR_InnerScopeMustBeSimpleType);
end; end;
{$IFDEF FPC} {$IFDEF FPC}
tkBool : tkBool :
@ -1847,7 +1847,7 @@ begin
{$ENDIF WST_UNICODESTRING} {$ENDIF WST_UNICODESTRING}
tkClass : tkClass :
begin begin
raise EXmlRpcException.Create('Inner Scope value must be a "simple type" value.'); raise EXmlRpcException.Create(SERR_InnerScopeMustBeSimpleType);
end; end;
{$IFDEF FPC} {$IFDEF FPC}
tkBool : tkBool :

View File

@ -41,12 +41,10 @@ type
) : Integer;overload; ) : Integer;overload;
function Base16Decode(const AInBuffer : string; const AOptions : TBaseXOptions) : TByteDynArray;overload; function Base16Decode(const AInBuffer : string; const AOptions : TBaseXOptions) : TByteDynArray;overload;
resourcestring
s_InvalidEncodedData = 'Invalid encoded data.';
s_IllegalChar = 'Illegal character for that encoding : %s.';
s_UnexpectedEndOfData = 'Unexpected end of data.';
implementation implementation
uses
wst_consts;
const const
Base64_CHAR_TABLE : array[0..63] of char = 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/'; Base64_CHAR_TABLE : array[0..63] of char = 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/';
@ -177,11 +175,11 @@ begin
Break; Break;
end else begin end else begin
if locFailOnIllegalChar then if locFailOnIllegalChar then
raise EBase64Exception.Create(s_InvalidEncodedData); raise EBase64Exception.Create(SERR_InvalidEncodedData);
end; end;
end; end;
if ( not ok ) and locFailOnIllegalChar then if ( not ok ) and locFailOnIllegalChar then
raise EBase64Exception.CreateFmt(s_IllegalChar,[Char(locBuffer^)]); raise EBase64Exception.CreateFmt(SERR_IllegalChar,[Char(locBuffer^)]);
end; end;
if ( locReadedValidChars > 0 ) then begin if ( locReadedValidChars > 0 ) then begin
locOutQuantom[0] := ( locInQuantom[0] shl 2 ) or ( locInQuantom[1] shr 4 ); locOutQuantom[0] := ( locInQuantom[0] shl 2 ) or ( locInQuantom[1] shr 4 );
@ -287,13 +285,13 @@ begin
else else
begin begin
if locFailOnIllegalChar then if locFailOnIllegalChar then
raise EBase16Exception.Create(s_IllegalChar); raise EBase16Exception.Create(SERR_UnexpectedEndOfData);
end; end;
end; end;
Inc(hp); Inc(hp);
end; end;
if ( hp^ = #0 ) then if ( hp^ = #0 ) then
raise EBase16Exception.Create(s_UnexpectedEndOfData); raise EBase16Exception.Create(SERR_UnexpectedEndOfData);
Inc(hp); Inc(hp);
while ( hp^ <> #0 ) do begin while ( hp^ <> #0 ) do begin
case hp^ of case hp^ of
@ -315,13 +313,13 @@ begin
else else
begin begin
if locFailOnIllegalChar then if locFailOnIllegalChar then
raise EBase16Exception.Create(s_IllegalChar); raise EBase16Exception.CreateFmt(SERR_IllegalChar,[hp^]);
end; end;
end; end;
Inc(hp); Inc(hp);
end; end;
if ( hp^ = #0 ) then if ( hp^ = #0 ) then
raise EBase16Exception.Create(s_UnexpectedEndOfData); raise EBase16Exception.Create(SERR_UnexpectedEndOfData);
Inc(hp); Inc(hp);
Inc(bp); Inc(bp);
end; end;

View File

@ -66,7 +66,8 @@ type
procedure finalize_record_rtti(); procedure finalize_record_rtti();
implementation implementation
uses Classes, imp_utils; uses
Classes, imp_utils, wst_consts;
{$IFDEF WST_RECORD_RTTI} {$IFDEF WST_RECORD_RTTI}
@ -336,7 +337,7 @@ function TRecordRttiDataObject.GetField(const AFieldName : shortstring) : PRecor
begin begin
Result := FindField(AFieldName); Result := FindField(AFieldName);
if ( Result = nil ) then if ( Result = nil ) then
raise Exception.CreateFmt('"%s" is not a field of "%s".',[AFieldName,GetRecordTypeData()^.Name]); raise Exception.CreateFmt(SERR_IsNotAFieldOf,[AFieldName,GetRecordTypeData()^.Name]);
end; end;
procedure initialize_record_rtti(); procedure initialize_record_rtti();

View File

@ -216,6 +216,9 @@ type
procedure finalize_server_services_intf(); procedure finalize_server_services_intf();
implementation implementation
uses
wst_consts;
Var Var
FormatterRegistryInst : IFormatterRegistry = Nil; FormatterRegistryInst : IFormatterRegistry = Nil;
ServerServiceRegistryInst : IServerServiceRegistry = Nil; ServerServiceRegistryInst : IServerServiceRegistry = Nil;
@ -240,7 +243,7 @@ Begin
svcName := ARequestBuffer.GetTargetService(); svcName := ARequestBuffer.GetTargetService();
s := sr.Find(svcName); s := sr.Find(svcName);
If Not Assigned(s) Then If Not Assigned(s) Then
Raise EServiceException.CreateFmt('Service not found : "%s"',[svcName]); Raise EServiceException.CreateFmt(SERR_ServiceNotFound,[svcName]);
s.HandleRequest(ARequestBuffer); s.HandleRequest(ARequestBuffer);
End; End;
@ -479,7 +482,7 @@ begin
msgFormat := Copy(s,1,j); msgFormat := Copy(s,1,j);
f := GetFormatterRegistry().Find(msgFormat) as IFormatterResponse; f := GetFormatterRegistry().Find(msgFormat) as IFormatterResponse;
if not Assigned(f) then if not Assigned(f) then
Error('No formatter for that content type : "%s"',[s]); Error(SERR_NoSerializerFoThisType,[s]);
try try
cllCtx := CreateCallContext(); cllCtx := CreateCallContext();
cllCtx.GetPropertyManager().Copy(ARequestBuffer.GetPropertyManager(),False); cllCtx.GetPropertyManager().Copy(ARequestBuffer.GetPropertyManager(),False);
@ -491,7 +494,7 @@ begin
s := f.GetCallProcedureName(); s := f.GetCallProcedureName();
m := FindVerbHandler(s); m := FindVerbHandler(s);
if not Assigned(m) then if not Assigned(m) then
Error('No handler for that verb : "%s"',[s]); Error(SERR_NoHandlerForThatVerb,[s]);
m(f,cllCtx); m(f,cllCtx);
for i := 0 to Pred(cllCtx.GetHeaderCount(AllHeaderDirection)) do begin for i := 0 to Pred(cllCtx.GetHeaderCount(AllHeaderDirection)) do begin
hdr := cllCtx.GetHeader(i); hdr := cllCtx.GetHeader(i);
@ -501,7 +504,7 @@ begin
s := typRegItm.DeclaredName s := typRegItm.DeclaredName
else else
s := hdr.ClassName; s := hdr.ClassName;
Error('Header "%s" not Understood.',[s]); Error(SERR_HeaderNotUnderstood,[s]);
end; end;
end; end;
except except

View File

@ -208,7 +208,8 @@ type
function CreateWstInterfaceSymbolTable(AContainer : TwstPasTreeContainer) : TPasModule; function CreateWstInterfaceSymbolTable(AContainer : TwstPasTreeContainer) : TPasModule;
implementation implementation
uses parserutils, wst_types; uses
parserutils, wst_types, wst_consts;
const const
SIMPLE_TYPES_COUNT = 14; SIMPLE_TYPES_COUNT = 14;
@ -559,7 +560,7 @@ function MakeInternalSymbolNameFrom(const AName : string) : string ;
begin begin
Result := ExtractIdentifier(AName); Result := ExtractIdentifier(AName);
if IsStrEmpty(AName) then begin if IsStrEmpty(AName) then begin
raise ESymbolException.CreateFmt('Unable to make an internal symbol Name from "%s".',[AName]); raise ESymbolException.CreateFmt(SERR_CannotMakeInternalSymbolName,[AName]);
end; end;
if IsReservedKeyWord(Result) then begin if IsReservedKeyWord(Result) then begin
Result := '_' + Result; Result := '_' + Result;
@ -830,7 +831,7 @@ function TwstPasTreeContainer.AddBinding(const AName : string; AIntf : TPasClass
begin begin
Result := FindBinding(AName); Result := FindBinding(AName);
if Assigned(Result) then begin if Assigned(Result) then begin
raise Exception.CreateFmt('Duplicated binding : "%s"',[AName]); raise Exception.CreateFmt(SERR_DuplicateBindingName,[AName]);
end; end;
Result := TwstBinding.Create(AName, AIntf, AIntf.Parent); Result := TwstBinding.Create(AName, AIntf, AIntf.Parent);
FBindingList.Add(Result); FBindingList.Add(Result);

View File

@ -170,11 +170,10 @@ type
function Parse():TPasType;override; function Parse():TPasType;override;
end; end;
resourcestring
SResolveError = 'Unable to resolve this namespace : "%s".';
implementation implementation
uses dom_cursors, parserutils, StrUtils, xsd_consts; uses
dom_cursors, parserutils, StrUtils, xsd_consts, wst_consts;
{ TAbstractTypeParser } { TAbstractTypeParser }
@ -310,7 +309,7 @@ begin
locNS := ANameSpace locNS := ANameSpace
end else begin end else begin
if not FContext.FindNameSpace(ANameSpace,locNS) then if not FContext.FindNameSpace(ANameSpace,locNS) then
raise EXsdParserAssertException.CreateFmt(SResolveError,[ANameSpace]); raise EXsdParserAssertException.CreateFmt(SERR_CannotResolveNamespace,[ANameSpace]);
end; end;
Result := FSymbols.FindElementNS(ALocalName,locNS); Result := FSymbols.FindElementNS(ALocalName,locNS);
end; end;
@ -1454,7 +1453,7 @@ begin
if Assigned(tmpNode) then begin if Assigned(tmpNode) then begin
ExplodeQName(tmpNode.NodeValue,FBaseName,spaceShort); ExplodeQName(tmpNode.NodeValue,FBaseName,spaceShort);
if not FContext.FindNameSpace(spaceShort,FBaseNameSpace) then if not FContext.FindNameSpace(spaceShort,FBaseNameSpace) then
raise EXsdParserAssertException.CreateFmt(SResolveError,[spaceShort]); raise EXsdParserAssertException.CreateFmt(SERR_CannotResolveNamespace,[spaceShort]);
end; end;
locCrs := CreateChildrenCursor(FRestrictionNode,cetRttiNode) as IObjectCursor; locCrs := CreateChildrenCursor(FRestrictionNode,cetRttiNode) as IObjectCursor;
if Assigned(locCrs) then begin if Assigned(locCrs) then begin

View File

@ -17,16 +17,44 @@ unit wst_consts;
interface interface
resourcestring resourcestring
SERR_CannotMakeInternalSymbolName ='Unable to make an internal symbol Name from "%s".';
SERR_CannotResolveNamespace = 'Unable to resolve this namespace : "%s".';
SERR_DuplicateBindingName = 'Duplicated binding : "%s".';
SERR_ExpectingRemotableObjectClass = 'Expecting remotable object class but found "%s".';
SERR_HeaderNotUnderstood = 'Header "%s" not Understood.';
SERR_IllegalChar = 'Illegal character for that encoding : "%s".';
SERR_IndexOutOfBound = 'Index out of bound : %d.';
SERR_IncompleteParamTypeRegistration = 'Incomplete type registration for the type of this parameter : "%s".';
SERR_InnerScopeMustBeSimpleType = 'Inner Scope value must be a "simple type" value.';
SERR_InsupportedOperation = 'Insupported operation : "%s".'; SERR_InsupportedOperation = 'Insupported operation : "%s".';
SERR_InvalidArrayBounds = 'Invalid array bounds.';
SERR_InvalidArrayLength = 'Invalid array length : %d.'; SERR_InvalidArrayLength = 'Invalid array length : %d.';
SERR_InvalidCollectionLength = 'Invalid collection length : %d.'; SERR_InvalidCollectionLength = 'Invalid collection length : %d.';
SERR_InvalidDataTypeInContext = 'Invalid data type in this context : "%s".';
SERR_InvalidEncodedData = 'Invalid encoded data.';
SERR_InvalidHourOffetValue = '"%d" is not a valid hour offset value.'; SERR_InvalidHourOffetValue = '"%d" is not a valid hour offset value.';
SERR_InvalidMinuteOffetValue = '"%d" is not a valid minute offset value.'; SERR_InvalidMinuteOffetValue = '"%d" is not a valid minute offset value.';
SERR_InvalidEmbeddedScopeOperation = 'Invalid opération on scope, their are no embedded scope.';
SERR_InvalidParameter = 'Invalid parameter : "%s".'; SERR_InvalidParameter = 'Invalid parameter : "%s".';
SERR_InvalidParameterProc = 'Invalid parameter : "%s"; Procedure = "%s".';
SERR_InvalidParameters = 'Invalid parameters.';
SERR_InvalidPoolParametersArgs = 'Invalid pool arguments Min = %d; Max = %d .';
SERR_IsNotAFieldOf = '"%s" is not a field of "%s".';
SERR_NodeNotFoundByID = 'Node not found with this ID in the document : "%s".';
SERR_NoHandlerForThatVerb = 'No handler for that verb : "%s".';
SERR_NoReaderProc = 'No reader proc for that type, Prop : "(%s : %s)".'; SERR_NoReaderProc = 'No reader proc for that type, Prop : "(%s : %s)".';
SERR_NoScope = 'There is no scope.';
SERR_NoSerializerFoThisType = 'No serializer for this type : "%s".'; SERR_NoSerializerFoThisType = 'No serializer for this type : "%s".';
SERRE_ObjectCreationTimeOut = 'Unable to create the object : Timeout expired.';
SERR_OperationNotAllowedOnActivePool = 'Operation not allowed on an active pool.';
SERR_ParamaterNotFound = 'Parameter non found : "%s".'; SERR_ParamaterNotFound = 'Parameter non found : "%s".';
SERR_RecordExtendedRttiNotFound = 'Record extended RTTI informations not found in type registry : "%s".';
SERR_RootObjectCannotBeNIL = 'The root object cannot be NIL.';
SERR_SerializerInitializationException = 'Unable to initialize the serializer of that type : "%s".'; SERR_SerializerInitializationException = 'Unable to initialize the serializer of that type : "%s".';
SERR_ServiceNotFound = 'Service not found : "%s".';
SERR_ScopeNotFound = 'Scope not found : "%s".';
SERR_TypeNotRegistered = 'Type not registered : "%s".';
SERR_UnexpectedEndOfData = 'Unexpected end of data.';
implementation implementation