What is the Index option in TRemotable Derived Classes?

When the WSDL importer wizard creates the interfaces, all properties have an Index parameter, but, reading the code and the InvokeRegistry block, I can’t find out what it is, does anyone know if this is really necessary?

Like this

  Login = class(TRemotable)
  private
    [...] 
  published
    property User: string Index (IS_OPTN) read GetUser write SetUser stored User_Specified;
    [...]
  end;

I ask because I want to change this device by adding some interfaces to these classes, for integration with the MVP infrastructure.

+3
source share
3 answers

I found a more detailed explanation of this issue. When using indexes, several properties can use the same access methods.

Good example from Delphi 2009 help:

type 
   TRectangle = class 
     private 
       FCoordinates: array[0..3] of Longint; 
       function GetCoordinate(Index: Integer): Longint; 
       procedure SetCoordinate(Index: Integer; Value: Longint); 
     public 
       property Left: Longint index 0 read GetCoordinate write SetCoordinate; 
       property Top: Longint index 1 read GetCoordinate write SetCoordinate; 
       property Right: Longint index 2 read GetCoordinate write SetCoordinate; 
       property Bottom: Longint index 3 read GetCoordinate write SetCoordinate; 
       property Coordinates[Index: Integer]: Longint read GetCoordinate write SetCoordinate; 
       ... 
   end;

. .

+2

IS_OPTN GetUser SetUser "Index" .

/, , :

function GetUser(Index:Integer):String;
procedure SetUser(Index:Integer;const value:string);

, :

MyString := MyLogin.user;
// is translated to:
MyString := getUser(IS_OPTN);

MyLogin.user := 'me'; 
// is translated to:
SetUser(IS_OPTN,'me');
+2

, . , , IS_OPTN, TRemotable , XML, , , node , . :

property User: string Index (IS_OPTN) read GetUser write SetUser stored User_Specified

User XML, User_Specified true. User_Specified true, , SetUser setter.

, SOAP por, XML, , , (IS_OPTN).

0
source

All Articles