After an evaluation, GNOME has moved from Bugzilla to GitLab. Learn more about GitLab.
No new issues can be reported in GNOME Bugzilla anymore.
To report an issue in a GNOME project, go to GNOME GitLab.
Do not go to GNOME Gitlab for: Bluefish, Doxygen, GnuCash, GStreamer, java-gnome, LDTP, NetworkManager, Tomboy.
Bug 749360 - Add to_string() functions for enums and flags
Add to_string() functions for enums and flags
Status: RESOLVED DUPLICATE of bug 447907
Product: glib
Classification: Platform
Component: gobject
unspecified
Other Linux
: Normal normal
: ---
Assigned To: gtkdev
gtkdev
Depends on:
Blocks:
 
 
Reported: 2015-05-14 09:49 UTC by Garrett Regier
Modified: 2015-05-14 10:31 UTC
See Also:
GNOME target: ---
GNOME version: ---


Attachments
Add to_string() functions for Enum and Flags types (6.88 KB, patch)
2015-05-14 10:10 UTC, Garrett Regier
none Details | Review

Description Garrett Regier 2015-05-14 09:49:04 UTC
This is useful for debugging. It would be nice, for usability, to also have a function which took a GType and not just GEnumsClass/GFlagsClass.

In fact for GEnumsClass it is so easy to get the to_string() value that it might make sense to not have a function for it and only have one taking a enum GType.

Builder currently has a flags_to_string() function used for debugging: https://git.gnome.org/browse/gnome-builder/tree/contrib/egg/egg-binding-set.c#n80
Comment 1 Emmanuele Bassi (:ebassi) 2015-05-14 09:59:21 UTC
Thanks for taking the time to report this.
This particular bug has already been reported into our bug tracking system, but please feel free to report any further bugs you find.

*** This bug has been marked as a duplicate of bug 447907 ***
Comment 2 Garrett Regier 2015-05-14 10:10:00 UTC
Created attachment 303357 [details] [review]
Add to_string() functions for Enum and Flags types
Comment 3 Garrett Regier 2015-05-14 10:12:13 UTC
Bug 447907 is about adding from_string() functions, this is about adding to_string() functions.
Comment 4 Emmanuele Bassi (:ebassi) 2015-05-14 10:28:12 UTC
Should still consolidate the enumeration/string type conversion into a single bug instead of having two of them, especially if we want to roundtrip between enum and string.
Comment 5 Garrett Regier 2015-05-14 10:31:09 UTC
(In reply to Emmanuele Bassi (:ebassi) from comment #4)
> Should still consolidate the enumeration/string type conversion into a
> single bug instead of having two of them, especially if we want to roundtrip
> between enum and string.

Makes sense, closing again. Sorry for the noise!

*** This bug has been marked as a duplicate of bug 447907 ***