Re: Unable to use enums that start with numbers



On Wed, Jul 6, 2016 at 12:10 AM, Christoph Reiter <reiter christoph gmail com> wrote:

> Another question I have is what might be a good way to represent a value
> where multiple enums are combined as flags.  In the C API, an audio sample
> format is represented by a single unsigned integer which has bit fields for
> different parts of the format (bit width, channel count, sign/unsigned, and
> byte order).  These values are usually just logically OR'd together.  One
> thought which comes to mind for adding a binding for this is using a struct
> with bit fields and creating a boxed type from it.  That would definitely
> break the C API though and methods would need to be provided for accessing
> the fields of the sample format.

You could mark all function arguments for that type as "(type int)"
(one such example is gtk_icon_size_lookup) so it takes the result of
your OR'd values.

That's actually how it is now and it is working.  I was just wondering if there was a better way, but this seems fine in practice, I just need to document it well.

Best regards,

Element Green


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]