Re: [Vala] translating union in vapi file
- From: "Clément DAVID" <c david86 gmail com>
- To: Vala-list gnome org
- Subject: Re: [Vala] translating union in vapi file
- Date: Mon, 3 Mar 2008 18:22:05 +0000
Hi everyone,
I answer to myself (after some times writing tests). I think it can be useful for others VAPI writers.
The solution to 'union' is exactly the same as 'struct'.
[CCode (free_function="mpd_freeInfoEntity")]
public class InfoEntity {
public int type;
public InfoEntityInfo info;
[CCode (cname="mpd_newInfoEntity")]
public InfoEntity ();
}
public struct InfoEntityInfo {
public Directory directory;
public Song song;
public PlaylistFile playlistFile;
}
2008/2/21, Clément DAVID <c david86 gmail com>:
Hi,
I'm in trouble while translating non-Object library which this kind of structure :
typedef struct mpd_InfoEntity {
/* the type of entity, use with MPD_INFO_ENTITY_TYPE_* to determine
* what this entity is (song, directory, etc...)
*/
int type;
/* the actual data you want, mpd_Song, mpd_Directory, etc */
union {
mpd_Directory * directory;
mpd_Song * song;
mpd_PlaylistFile * playlistFile;
} info;
} mpd_InfoEntity;
I don't know the way to handle that.
May Directory, Song, PlaylistFile classes must inherit from the Boxed class ?
[Joined files]
libmpdclient.h : the library H file
mpd.vapi : The current translation vapi file.
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]