RAD Studio VCL Reference
ContentsIndex
PreviousUpNext
System::TVarRec Record

System::TVarRec is used inside a function with an untyped array parameter.

Pascal
TVarRec = record
  case Byte of
    vtAnsiString: (VAnsiString: Pointer;);
    vtBoolean: (VBoolean: Boolean;);
    vtChar: (VChar: AnsiChar;);
    vtClass: (VClass: TClass;);
    vtCurrency: (VCurrency: PCurrency;);
    vtExtended: (VExtended: PExtended;);
    vtInt64: (VInt64: PInt64;);
    vtInteger: (VInteger: Integer;
                VType: Byte;);
    vtInterface: (VInterface: Pointer;);
    vtObject: (VObject: TObject;);
    vtPChar: (VPChar: PAnsiChar;);
    vtPointer: (VPointer: Pointer;);
    vtPWideChar: (VPWideChar: PWideChar;);
    vtString: (VString: PShortString;);
    vtUnicodeString: (VUnicodeString: Pointer;);
    vtVariant: (VVariant: PVariant;);
    vtWideChar: (VWideChar: WideChar;);
    vtWideString: (VWideString: Pointer;);
end;
C++
struct TVarRec {
  Integer VInteger;
  Byte VType;
  Boolean VBoolean;
  AnsiChar VChar;
  PExtended VExtended;
  PShortString VString;
  Pointer VPointer;
  PAnsiChar VPChar;
  TObject VObject;
  TClass VClass;
  WideChar VWideChar;
  PWideChar VPWideChar;
  Pointer VAnsiString;
  PCurrency VCurrency;
  PVariant VVariant;
  Pointer VInterface;
  Pointer VWideString;
  PInt64 VInt64;
  Pointer VUnicodeString;
};

The System::TVarRec type is used inside a function with a parameter type of array of const in Delphi. In Delphi, the compiler automatically translates each element in the array to a System::TVarRec value. In C++, the function parameter appears as an array of System::TVarRec values.  

Use System::TVarRec to work with individual elements of the array when implementing the function that has an array of const parameter.  

The VType field indicates the simple type of each System::TVarRec value. The variable type constants represent the values passed in the tag of the System::TVarRec structure. These constants, listed below, are defined in the System unit.  

Delphi constants :

= 0;  
= 1;  
vtCharacter  
= 2;  
= 3;  
= 4;  
= 5;  
= 6;  
= 7;  
= 8;  
= 9;  
= 10;  
= 11;  
= 12;  
= 13;  
= 14;  
= 15;  
= 16;  

C++ constants :

static const Shortint vtInteger  
= 0x0;  
static const Shortint vtBoolean  
= 0x1;  
static const Shortint vtCharacter  
= 0x2;  
static const Shortint vtExtended  
= 0x3;  
static const Shortint vtString  
= 0x4;  
static const Shortint vtPointer  
= 0x5;  
static const Shortint vtPChar  
= 0x6;  
static const Shortint vtObject  
= 0x7;  
static const Shortint vtClass  
= 0x8;  
static const Shortint vtWideChar  
= 0x9;  
static const Shortint vtPWideChar  
= 0xa;  
static const Shortint vtAnsiString  
= 0xb;  
static const Shortint vtCurrency  
= 0xc;  
static const Shortint vtVariant  
= 0xd;  
static const Shortint vtInterface  
= 0xe;  
static const Shortint vtWideString  
= 0xf;  
static const Shortint vtInt64  
= 0x10;  

Note: In C++, you can create an array of System::TVarRec values using the ARRAYOFCONST macro, which is defined in sysopen.h.
 

Copyright(C) 2009 Embarcadero Technologies, Inc. All Rights Reserved.
What do you think about this topic? Send feedback!