Dieses struct möchte ich übersetzen:
Code: Alles auswählen
struct mpd_entity {
/**
* The type of this entity.
*/
enum mpd_entity_type type;
/**
* This union contains type-safe pointers to the real object.
* Check the entity type before attempting to obtain the
* object!
*/
union {
/**
* Only valid if type==#MPD_ENTITY_TYPE_DIRECTORY.
*/
struct mpd_directory *directory;
/**
* Only valid if type==#MPD_ENTITY_TYPE_SONG.
*/
struct mpd_song *song;
/**
* Only valid if type==#MPD_ENTITY_TYPE_PLAYLIST.
*/
struct mpd_playlist *playlistFile;
} info;
};
Code: Alles auswählen
Tmpd_entity = packed record
type_r: Tmpd_entity_type; // Das Enum hab ich definiert, es wird auch gesetzt und kann ausgelesen werden
info: record
case Tmpd_entity_type of
NMPD_ENTITY_TYPE_DIRECTORY: (directory: Pmpd_directory);
NMPD_ENTITY_TYPE_SONG: (song: Pmpd_song);
NMPD_ENTITY_TYPE_PLAYLIST: (playlist: Pmpd_playlist);
end;
end;