AGB  ·  Datenschutz  ·  Impressum  







Anmelden
Nützliche Links
Registrieren
Zurück Delphi-PRAXiS Sprachen und Entwicklungsumgebungen Object-Pascal / Delphi-Language Delphi Set-Type (also Menge) und for-in-Schleife
Thema durchsuchen
Ansicht
Themen-Optionen

Set-Type (also Menge) und for-in-Schleife

Ein Thema von s.h.a.r.k · begonnen am 28. Mai 2010 · letzter Beitrag vom 28. Mai 2010
 
Benutzerbild von himitsu
himitsu

Registriert seit: 11. Okt 2003
Ort: Elbflorenz
44.342 Beiträge
 
Delphi 12 Athens
 
#8

Re: Set-Type (also Menge) und for-in-Schleife

  Alt 28. Mai 2010, 06:24
Zitat:
Delphi-Quellcode:
TRttiPropertyInfoAttributeTypesSet =
  Low(TRttiPropertyInfoAttributeTypes)..High(TRttiPropertyInfoAttributeTypes);
Wie schon gesagt wurde: TRttiPropertyInfoAttributeTypesSet ist kein SET, sondern ebenfalls ein ENUM!

Es ist quasi nur sowas wie eine Kopie von TRttiPropertyInfoAttributeTypes.
(ein neuer Typ, mit dem selben Wertebereich)
Code:
TRttiPropertyInfoAttributeTypesSet =
  [color=#ff0000][[/color]Low(TRttiPropertyInfoAttributeTypes)..High(TRttiPropertyInfoAttributeTypes)[color=#ff0000]][/color];

// oder

TRttiPropertyInfoAttributeTypesSet = [color=#ff0000]set of[/color]
  Low(TRttiPropertyInfoAttributeTypes)..High(TRttiPropertyInfoAttributeTypes);

// oder

TRttiPropertyInfoAttributeTypesSet = set of [color=#ff0000]TRttiPropertyInfoAttributeTypes[/color];





für SETs geht aber sowas:
Code:
for AttributeType in [color=#ff003f]TRttiPropertyInfoAttributeTypesSet[/color] do
Da gehört eine Variable oder Konstante und kein Typ hin.

IN durchläuft Speicherinhalte und keine Deklarationen.

for AttributeType = Low(TRttiPropertyInfoAttributeTypesSet) to High(TRttiPropertyInfoAttributeTypesSet) do

Delphi-Quellcode:
for AttributeType = Low(TRttiPropertyInfoAttributeTypes) to High(TRttiPropertyInfoAttributeTypes) do


temp := [Low(TRttiPropertyInfoAttributeTypes)..High(TRttiPropertyInfoAttributeTypes)];
for AttributeType in temp do
PS: Es gab schonmal 'nen Thread zu sowas (letztes Jah ... find ihn nur grade nicht), in welchem es auch darum ging alle Felder eines SET zu durchlaufen.

Und da nur ein Hinweis: sowas geht nur mit vollständigen SETs

Sobald etwas wie Folgendes vorkommt, dann gibt es keine RTTI zu den Feldern des Enum/Set.
Delphi-Quellcode:
type
  a = (c=3, e=9, f);
  b = set of a;
Ein Therapeut entspricht 1024 Gigapeut.
  Mit Zitat antworten Zitat
 


Forumregeln

Es ist dir nicht erlaubt, neue Themen zu verfassen.
Es ist dir nicht erlaubt, auf Beiträge zu antworten.
Es ist dir nicht erlaubt, Anhänge hochzuladen.
Es ist dir nicht erlaubt, deine Beiträge zu bearbeiten.

BB-Code ist an.
Smileys sind an.
[IMG] Code ist an.
HTML-Code ist aus.
Trackbacks are an
Pingbacks are an
Refbacks are aus

Gehe zu:

Impressum · AGB · Datenschutz · Nach oben
Alle Zeitangaben in WEZ +1. Es ist jetzt 04:26 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