Einzelnen Beitrag anzeigen

Benutzerbild von himitsu
himitsu

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

AW: C++ Struct nach Delphi portieren

  Alt 8. Feb 2011, 09:42
Also, der Record selber sieht so aus, von den Daten her:
Delphi-Quellcode:
HPOLY = record
  m_nPolyIndex, m_nWorldIndex: LongInt;
end;
HPOLY() wäre wohl eine Art Constructor, welches bei Delphi-Records nicht gibt, bzw. welches nicht nötig ist, da man es ja manuell aufrufen muß, denn eine automatische Initialisierung gibt es leider nicht
Da wirst'e dir wohl besser eine Init-Prozedur draus machen müssen.

Die nächsten zwei HPOLY( sind och sowas, nut mir Parametern zur Initialisiereung,
also nochein Init, aber mit m_nPolyIndex, m_nWorldIndex: LongInt; als Parameter,
das 3. HPOLY( kannst'e eigentlich weglassen, da es nur den record kopiert, was Delphi automatisch macht.

und danach kommen dann ein paar Klassenoperatoren (Hier im Forum suchenclass operator ).

[add]
Delphi-Quellcode:
HPOLY = record
  FPolyIndex, FWorldIndex: LongInt;
  procedure Init;
  procedure Init(PolyIndex, WorldIndex: LongInt);
  procedure Init(const Source: HPOLY);
//class operator Implicit(const Source: HPOLY): HPOLY;
  class operator Equal (const Source: HPOLY): Boolean;
  class operator NotEqual(const Source: HPOLY): Boolean;
end;
Delphi-Quellcode:
HPOLY = record
  FPolyIndex, FWorldIndex: LongInt;
  class function Init: HPOLY;
  class function Init(PolyIndex, WorldIndex: LongInt): HPOLY;
  class function Init(const Source: HPOLY): HPOLY;
//class operator Implicit(const Source: HPOLY): HPOLY;
  class operator Equal (const Source: HPOLY): Boolean;
  class operator NotEqual(const Source: HPOLY): Boolean;
end;
Delphi-Quellcode:
HPOLY = record
  FPolyIndex, FWorldIndex: LongInt;
  constructor Create;
  constructor Create(PolyIndex, WorldIndex: LongInt);
  constructor Create(const Source: HPOLY);
//class operator Implicit(const Source: HPOLY): HPOLY;
  class operator Equal (const Source: HPOLY): Boolean;
  class operator NotEqual(const Source: HPOLY): Boolean;
end;
Garbage Collector ... Delphianer erzeugen keinen Müll, also brauchen sie auch keinen Müllsucher.
my Delphi wish list : BugReports/FeatureRequests

Geändert von himitsu ( 8. Feb 2011 um 09:54 Uhr)
  Mit Zitat antworten Zitat