Re: GIO API review



Alexander Larsson wrote:
> On Thu, 2007-12-13 at 17:25 +0100, Carlos Garnacho wrote:
>> Hi all!,
>>
>> On mar, 2007-12-11 at 17:48 +0100, Michael Natterer wrote:
>>> Hey everybody,
>>>
>>> We've been doing a GIO API review in the last couple of days and
>>> here is the list of comments and issues we've come up with:
>>>
>> I Just wanted to raise another concern I have. Besides defining enums
>> containing flags like GFileBlahFlags in gio, values inside these also
>> are defined like G_FILE_BLAH_FLAGS_FOOBAR (note the "_FLAGS_" in the
>> definition)
>>
>> I don't think the values should specify too whether they're a flag, as
>> the enum is already defined as a set of these, that way it'd also
>> conform more to glib and gtk+ style.
> 
> There is actually currently some inconsistencies here:
> 
> typedef enum {
>   G_FILE_QUERY_INFO_FLAGS_NONE = 0,
>   G_FILE_QUERY_INFO_NOFOLLOW_SYMLINKS = (1<<0) 
> }
> 
> vs
> 
> typedef enum  {
>   G_FILE_MONITOR_FLAGS_NONE = 0,
>   G_FILE_MONITOR_FLAGS_MONITOR_MOUNTS = (1<<0)
> } GFileMonitorFlags;
> 
> What do people think is the best approach here?

I don't really see the need for adding symbols to the library to
represent 0. If there is only one "flag" in each of these that matters,
doesn't it make more sense to just have a boolean?

If I was writing this and used an enum to represent 0, I would use:

  G_FILE_QUERY_INFO_DEFAULT
  G_FILE_QUERY_INFO_DONT_FOLLOW_SYMLINKS

and

  G_FILE_MONITOR_DEFAULT
  G_FILE_MONITOR_MOUNTS

-- 
Regards,
Martyn


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