Also kann ich das weiterhin einfach so ignorieren?
Ich hab praktisch noch nie so richtig mit Variants gearbeitet und versuch das quasi jetzt so hinzubekommen (bin über die Delphi-Sourcen und die Suche via
DP/Google jetzt schon so weit gekommen)
Aktuell hab ich das Speichern von Variants so:
Delphi-Quellcode:
tkVariant: Begin
V := GetVariantProp(C, String(List[i].Name));
Case TVarData(V).VType of
varEmpty, varNull: SavePropInfos(nil, List[i]);
varShortInt: Begin
Node := AddNode(List[i].Name);
SavePropInfos(Node, List[i]);
Node.Attributes['variant'] := 'ShortInt';
Node.Data := IntToStr(TVarData(V).VShortInt);
End;
varSmallInt: Begin
Node := AddNode(List[i].Name);
SavePropInfos(Node, List[i]);
Node.Attributes['variant'] := 'SmallInt';
Node.Data := IntToStr(TVarData(V).VSmallInt);
End;
varInteger: Begin
Node := AddNode(List[i].Name);
SavePropInfos(Node, List[i]);
Node.Attributes['variant'] := 'Integer';
Node.Data := IntToStr(TVarData(V).VInteger);
End;
varError: Begin
Node := AddNode(List[i].Name);
SavePropInfos(Node, List[i]);
Node.Attributes['variant'] := 'HRESULT';
Node.Data := IntToStr(TVarData(V).VError);
End;
varInt64: Begin
Node := AddNode(List[i].Name);
SavePropInfos(Node, List[i]);
Node.Attributes['variant'] := 'Int64';
Node.Data := IntToStr(TVarData(V).VInt64);
End;
varByte: Begin
Node := AddNode(List[i].Name);
SavePropInfos(Node, List[i]);
Node.Attributes['variant'] := 'Byte';
Node.Data := IntToStr(TVarData(V).VByte);
End;
varWord: Begin
Node := AddNode(List[i].Name);
SavePropInfos(Node, List[i]);
Node.Attributes['variant'] := 'Word';
Node.Data := IntToStr(TVarData(V).VWord);
End;
varLongWord: Begin
Node := AddNode(List[i].Name);
SavePropInfos(Node, List[i]);
Node.Attributes['variant'] := 'LongWord';
Node.Data := IntToStr(TVarData(V).VLongWord);
End;
{$IF Declared(varUInt64)}
varUInt64: Begin
Node := AddNode(List[i].Name);
SavePropInfos(Node, List[i]);
Node.Attributes['variant'] := 'UInt64';
If Int64(TVarData(V).VUInt64) < 0 Then
Node.Data := '$' + IntToHex(Int64(TVarData(V).VUInt64), 16)
Else Node.Data := IntToStr(Int64(TVarData(V).VUInt64));
End;
{$IFEND}
varSingle: Begin
Node := AddNode(List[i].Name);
SavePropInfos(Node, List[i]);
Node.Attributes['variant'] := 'Single';
Node.Data := FloatToStr(TVarData(V).VSingle);
End;
varDouble: Begin
Node := AddNode(List[i].Name);
SavePropInfos(Node, List[i]);
Node.Attributes['variant'] := 'Double';
Node.Data := FloatToStr(TVarData(V).VDouble);
End;
varCurrency: Begin
Node := AddNode(List[i].Name);
SavePropInfos(Node, List[i]);
Node.Attributes['variant'] := 'Currency';
Node.Data := CurrToStr(TVarData(V).VCurrency);
End;
varDate: Begin
Node := AddNode(List[i].Name);
SavePropInfos(Node, List[i]);
Node.Attributes['variant'] := 'DateTime';
Node.Data := DateTimeToStr(TVarData(V).VDate);
End;
varBoolean: Begin
Node := AddNode(List[i].Name);
SavePropInfos(Node, List[i]);
Node.Attributes['variant'] := 'Boolean';
Node.Data := BooleanIdents[TVarData(V).VBoolean];
End;
varOleStr: Begin
Node := AddNode(List[i].Name);
SavePropInfos(Node, List[i]);
Node.Attributes['variant'] := 'OLEStr';
Node.Data := WideString(Pointer(TVarData(V).VOleStr));
End;
varString: Begin
Node := AddNode(List[i].Name);
SavePropInfos(Node, List[i]);
Node.Attributes['variant'] := 'AnsiString';
Node.Data := AnsiString(TVarData(V).VString);
End;
{$IF Declared(UnicodeString)}
varUString: Begin
Node := AddNode(List[i].Name);
SavePropInfos(Node, List[i]);
Node.Attributes['variant'] := 'WideString';
Node.Data := UnicodeString(TVarData(V).VUString);
End;
{$IFEND}
{varStrArg: Begin
Node := AddNode(List[i].Name);
SavePropInfos(Node, List[i]);
Node.Attributes['variant'] := 'OLEStr';
Node.Data := TVarData(V).vt_clsid
End;}
Else CheckUsupported(List[i]);
End;
End;