📄 rtcinfo.pas
字号:
you can use 'copyOf' to assign a copy of this object instead of the original. }
function copyOf:TRtcValueObject; override;
{ Create a String containing all object information. }
procedure to_Code(const Result:TRtcHugeString); override;
{ Create a XML-RPC String containing all object information. }
procedure to_XMLRPC(const Result:TRtcHugeString); override;
end;
{ @abstract(Abstract Value Object)
There are two ways to work with TRtcAbsValue objects.
One is to let the stored object be auto-created on first read access
to the asStream/asArray/asRecord/asDataSet/asFunction properties (AutoCreate=TRUE),
the other is to use NewStream/NewArray/NewRecord/NewFunction/NewDataSet functions
to create objects before first usage (AutoCreate=FALSE). You control the behavior
by setting the AutoCreate property to TRUE or FALSE. Any child object created
using the New... function will inherit this property state. You can change this
property at any time, on any object. Default AutoCreate state for objects
created by using the Create and FromCode methods is always FALSE. }
TRtcAbsValue = class(TRtcValueObject)
protected
// @exclude
FAutoCreate:boolean;
// @exclude
procedure SetObject(const Value:TRtcValueObject; asCopy:boolean=False); virtual; abstract;
// @exclude
procedure SetAsObject(const Value:TRtcValueObject);
// @exclude
function GetObject:TRtcValueObject; virtual; abstract;
// @exclude
function GetArray: TRtcArray;
// @exclude
function GetRecord: TRtcRecord;
// @exclude
function GetDataSet: TRtcDataSet;
// @exclude
function GetFunctionInfo: TRtcFunctionInfo;
// @exclude
function GetBoolean: boolean;
// @exclude
function GetCurrency: Currency;
// @exclude
function GetDateTime: TDateTime;
// @exclude
function GetException: String;
// @exclude
function GetVarName: String;
// @exclude
function GetInteger: rtcInteger;
// @exclude
function GetLargeInt: rtcLargeInt;
// @exclude
function GetNull: boolean;
// @exclude
function GetFloat: rtcFloat;
// @exclude
function GetString: String;
// @exclude
function GetWideString: WideString;
// @exclude
function GetText: String;
// @exclude
function GetByteStream: TStream;
// @exclude
function GetVariant: Variant;
// @exclude
procedure SetVariant(const Value: Variant);
// @exclude
procedure SetArray(const Value: TRtcArray);
// @exclude
procedure SetRecord(const Value: TRtcRecord);
// @exclude
procedure SetDataSet(const Value: TRtcDataSet);
// @exclude
procedure SetFunctionInfo(const Value: TRtcFunctionInfo);
// @exclude
procedure SetBoolean(const Value: boolean);
// @exclude
procedure SetCurrency(const Value: Currency);
// @exclude
procedure SetDateTime(const Value: TDateTime);
// @exclude
procedure SetException(const Value: String);
// @exclude
procedure SetVarName(const Value: String);
// @exclude
procedure SetInteger(const Value: rtcInteger);
// @exclude
procedure SetLargeInt(const Value: rtcLargeInt);
// @exclude
procedure SetNull(const Value: boolean);
// @exclude
procedure SetFloat(const Value: rtcFloat);
// @exclude
procedure SetString(const Value: String);
// @exclude
procedure SetWideString(const Value: WideString);
// @exclude
procedure SetText(const Value: String);
// @exclude
procedure SetByteStream(const Value: TStream);
// @exclude
function GetCode: String;
// @exclude
procedure SetCode(const Value: String);
// @exclude
function GetXMLrpc: String;
// @exclude
procedure SetXMLrpc(const Value: String);
public
{ Clear this object (initialize: Free all values and objects assigned) }
procedure Clear; virtual; abstract;
{ Assign a new, fresh Array.
To turn this Value object into an array of values,
you have to call "newArray" or assign already created TRtcArray
using asArray:= (assigns a copy of the array) or
asObject:= (assigns existing array instance). }
function NewArray: TRtcArray;
{ Assign a new, fresh Record.
To turn this Value object into a record of values,
you have to call "newRecord" or assign already created TRtcRecord
using asRecord:= (assigns a copy of the record) or
asObject:= (assigns existing record instance). }
function NewRecord: TRtcRecord;
{ Assign a new, fresh DataSet.
To turn this Value object into a dataset of values,
you have to call "newDataSet" or assign already created TRtcDataSet
using asDataSet:= (assigns a copy of the dataset) or
asObject:= (assigns existing dataset instance). }
function NewDataSet: TRtcDataSet;
{ Assign a new, fresh FunctionInfo.
To turn this Value object into a function call,
you have to call this "newFunction" method, or: @html(<br><br>)
assign already created TRtcFunctionInfo using asFunction:= (assigns a copy of the Function object) or @html(<br><br>)
asObject:= (assigns existing TRtcFunctionInfo instance). }
function NewFunction(const func_name:String=''): TRtcFunctionInfo; overload;
{ Assign a new, fresh Byte Stream.
To turn this Value object into a Byte Stream,
you have to call this "newByteStream" method, or: @html(<br><br>)
assign already created TStream using asByteStream:= (assigns a copy of the Stream data). }
function NewByteStream: TStream;
{ Assign a new, fresh Boolean value.
Only sets the type to Boolean.
You DO NOT have to use this function before accessing as Boolean value. }
function NewBoolean: boolean;
{ Assign a new, fresh Currency value.
Only sets the type to Currency.
You DO NOT have to use this function before accessing as Currency value. }
function NewCurrency: Currency;
{ Assign a new, fresh DateTime value.
Only sets the type to DateTime.
You DO NOT have to use this function before accessing as DateTime value. }
function NewDateTime: TDateTime;
{ Assign a new, fresh Exception value.
Only sets the type to Exception.
You DO NOT have to use this function before accessing as Exception value. }
function NewException: String;
{ Assign a new, fresh VariableName value.
Only sets the type to VariableName.
You DO NOT have to use this function before accessing as VariableName value. }
function NewVariable: String;
{ Assign a new, fresh Integer value.
Only sets the type to Integer.
You DO NOT have to use this function before accessing as Integer value. }
function NewInteger: rtcInteger;
{ Assign a new, fresh Large Integer value.
Only sets the type to Large Integer.
You DO NOT have to use this function before accessing as Large Integer value. }
function NewLargeInt: rtcLargeInt;
{ Assign a new, fresh Floating-point value.
Only sets the type to Floating-point.
You DO NOT have to use this function before accessing as Floating-point value. }
function NewFloat: rtcFloat;
{ Assign a new, fresh String value.
Only sets the type to String.
You DO NOT have to use this function before accessing as String value. }
function NewString: String;
{ Assign a new, fresh WideString value.
Only sets the type to WideString.
You DO NOT have to use this function before accessing as WideString value. }
function NewWideString: WideString;
{ Assign a new, fresh Text value.
Only sets the type to Text.
You DO NOT have to use this function before accessing as Text value. }
function NewText: String;
{ read: Is the Value NULL (not assigned) ? /
write: TRUE = destroy any object stored here and set value to null. }
property isNull:boolean read GetNull write SetNull;
{ Check Value type. NULL values always return rtc_NULL }
property isType:TRtcValueTypes read GetType;
{ Read/Write as native value (Variant). @html(<br>)
You can use this property to get/set all native types:
Boolean,Integer,Float,Currency,DateTime,String. @html(<br>)
You CAN NOT use this property to get or set complex structures like
ByteStream, Record, Array, DataSet or FunctionInfo. }
property Value:Variant read GetVariant write SetVariant;
{ alias for @Link(TRtcAbsValue.Value) }
property asValue:Variant read GetVariant write SetVariant;
{ Read/Write as Boolean value }
property asBoolean:boolean read GetBoolean write SetBoolean;
{ Read/Write as Integer value }
property asInteger:rtcInteger read GetInteger write SetInteger;
{ Read/Write as Large Integer value }
property asLargeInt:rtcLargeInt read GetLargeInt write SetLargeInt;
{ Read/Write as Float value }
property asFloat:rtcFloat read GetFloat write SetFloat;
{ Read/Write as Currency value }
property asCurrency:Currency read GetCurrency write SetCurrency;
{ Read/Write as DataTime value }
property asDateTime:TDateTime read GetDateTime write SetDateTime;
{ Read/Write as Exception value (String) }
property asException:String read GetException write SetException;
{ Read/Write as VariableName (String) }
property asVarName:String read GetVarName write SetVarName;
{ Read/Write as String value (access as raw String) }
property asString:String read GetString write SetString;
{ Read/Write as WideString value (access as raw WideString) }
property asWideString:WideString read GetWideString write SetWideString;
{ Read/Write as Text value (uses UTF-8 encode to write and UTF-8 decode to read String) }
property asText:String read GetText write SetText;
{ Read: return this object coded as a String, from which the object can be reconstructed anytime. /
Write: reconstruct object from assigned String. }
property asCode:String read GetCode write SetCode;
{ Read: return this object coded as a XML-RPC String,
from which the object can be reconstructed. /
Write: reconstruct object from assigned XML-RPC String. }
property asXMLrpc:String read GetXMLrpc write SetXMLrpc;
{ read: Access stored ByteStream / write: assign a copy of the source Stream }
property asByteStream:TStream read GetByteStream write SetByteStream;
{ read: Access stored array / write: assign a copy of the source TRtcArray }
property asArray:TRtcArray read GetArray write SetArray;
{ read: Access stored record / write: assign a copy of the source TRtcRecord }
property asRecord:TRtcRecord read GetRecord write SetRecord;
{ read: Access stored DataSet / write: assign a copy of the source TRtcDataset }
property asDataSet:TRtcDataSet read GetDataSet write SetDataSet;
{ read: Access stored FunctionInfo / write: assign a copy of the source TRtcFunctionInfo }
property asFunction:TRtcFunctionInfo read GetFunctionInfo write SetFunctionInfo;
{ Read: Access stored information as TRtcValueObject / @html(<br>)
Write: NIL = remove object without destroying it / @html(<br>)
Write: object = Assign object to this structure. It will be maintained and destroyed
with this structure, as long as it isn't removed by calling asObject:=nil. @html(<br><br>)
WARNING: NEVER! use asObject to assign an object which you did not create yourself,
or to assign an object to more than one TRtcValueObject structure.
If the same object instance is assigned to more than one structure,
you WILL end up with Access Violation Errors when those objects are
released by the connection component. To assign a copy of an object,
allways use the object.CopyOf function or assign the object using
specific 'as...' property (which doesn't assign the object itself,
but rather creates a copy of the object). }
property asObject:TRtcValueObject read GetObject write SetAsObject;
{ There are two ways to work with TRtcValue objects.
One is to let the stored object be auto-created on first read access
to the asArray/asRecord/asDataSet/asFunction properties (AutoCreate=TRUE),
the other is to use NewArray/NewRecord/NewFunction/NewDataSet functions
to create objects before first usage (AutoCreate=FALSE). You control the behavior
by setting the AutoCreate property to TRUE or FALSE. Any child object created
using the New... function will inherit this property state. You can change this
property at any time, on any object. Default AutoCreate state for objects
created by using the Create and FromCode methods is always FALSE. }
property AutoCreate:boolean read FAutoCreate write FAutoCreate;
end;
{ @abstract(Abstract Record Object)
There are two ways to work with TRtcAbsRecord objects. @html(<br>)
One is to let the stored object be auto-created on first read access
to the asArray/asRecord/asDataSet/asFunction properties (AutoCreate=TRUE),
the other is to use NewArray/NewRecord/NewFunction/NewDataSet functions
to create objects before first usage (AutoCreate=FALSE). You control the behavior
by setting the AutoCreate property to TRUE or FALSE. Any child object created
using the New... function will inherit this property state. You can change this
property at any time, on any object. Default AutoCreate state for objects
created by using the Create and FromCode methods is always FALSE. }
TRtcAbsRecord = class(TRtcValueObject)
protected
// @exclude
FAutoCreate:boolean;
// @exclude
function GetObject(const index: String): TRtcValueObject; virtual; abstract;
// @exclude
procedure SetObject(const index: String; Value:TRtcValueObject; asCopy:boolean=False); virtual; abstract;
// @exclude
procedure SetAsO
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -