![]() |
Set als Attribut in xml File speichern
Hallo zusammen,
steh grade ein bisschen auf dem Schlauch. Mein Problem ist das ich ein Set in der Art
Delphi-Quellcode:
TPointState = set of (psUnknown, psNormal, psPaused, psDeleted, psInsert ...);
als Attribut in einem xml File speichern will. Das speichern von TPointState geht natürlich nicht direkt. Muss ich das Set eineln zerpflücken oder gibt es eine elegantere Methode hierfür? |
AW: Set als Attribut in xml File speichern
Du kannst das Ding als Byte speichern, da ein Enum nichts anderes als ein Byte ist, ebenso eine Menge.
Delphi-Quellcode:
PS: Du kannst auch die SetToString-Methode aus der Unit TypInfo nutzen.
var
EnumValue : TPointState ; ByteValue : Byte; begin EnumValue := []; ByteValue := Byte(EnumValue); // ByteValue = 0; end;
Delphi-Quellcode:
var
TI : PTypeInfo; PS : TPointState; begin TI := TypeInfo(TPointState); Writeln(SetToString(TI, Byte(PS), True)); end; |
AW: Set als Attribut in xml File speichern
Hallo s.h.a.r.k,
so einfach können Lösungen sein... Danke für die Hilfe |
AW: Set als Attribut in xml File speichern
Zitat:
Delphi-Quellcode:
, so bekommt das Set (warum auch immer) keine TypeInfos mehr und man kann es auf diese Weise nicht ermitteln (Danke nochmal an himitsu, der mir da echt graue Haare erspaart hat).
TPointState = set of (psUnknown = 0, psNormal = 1, psPaused = 12, psDeleted = 42, psInsert = 50 ...);
|
Alle Zeitangaben in WEZ +1. Es ist jetzt 10:36 Uhr. |
Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
LinkBacks Enabled by vBSEO © 2011, Crawlability, Inc.
Delphi-PRAXiS (c) 2002 - 2023 by Daniel R. Wolf, 2024-2025 by Thomas Breitkreuz