TVariable Array access Operators
Find and return a TVariable within a structured variable or array.
TVariable& operator[]( __int64 index ); TVariable& operator[]( unsigned __int64 index ); TVariable& operator[]( int index ); TVariable& operator[]( unsigned int index ); TVariable& operator[]( long index ); TVariable& operator[]( unsigned long index ); //Windows does not generate the casting error TVariable& operator[]( const char *label ){ throw u"TVariable labels are UTF-16 and __int64 only"; } TVariable& operator[]( const char16_t *label ); //for Windows compatibility TVariable& operator[]( const wchar_t *label ); TVariable& operator[]( const TVariable &variable );
Parameters
index | 64 bit signed array index value. There are various different type implementations, as the compiler can auto cast to the incorrect one |
label | 16 bit wide character string for TVariable label. The const char* throw an error as compilers can call the unsigned int version if not implemented |
variable | TVariable that contains either an index or label value. |
Return Values
These method will return the variable that fits the position, if no one exists, it will create a new one at that position.
Remarks
- You need to be careful with the label value as MS VC++ don't provide a linking error if you use an ASCII string. All labels are 16 bit unicode string.
Example Use
- C++
#include "TScript.h" int wmain(int argc, wchar_t* argv[]) { TVariable var; var[0][u"fieldName"] = u"This is a string"; MessageBox((wchar_t*)var.WString(),NULL,0); return NO_ERROR; }
Also See
Index Operators, Label OperatorsListen All
Comments (0)