/src/wrappers/gobject/library/g_flags.e

http://github.com/tybor/Liberty · Specman e · 357 lines · 28 code · 121 blank · 208 comment · 2 complexity · 076c5b69b834e02c8a6d3f43fa2383a1 MD5 · raw file

  1. indexing
  2. description: "Flags type."
  3. copyright: "[
  4. Copyright (C) 2006 eiffel-libraries team, GTK+ team
  5. This library is free software; you can redistribute it and/or
  6. modify it under the terms of the GNU Lesser General Public License
  7. as published by the Free Software Foundation; either version 2.1 of
  8. the License, or (at your option) any later version.
  9. This library is distributed in the hope that it will be useful, but
  10. WITHOUT ANY WARRANTY; without even the implied warranty of
  11. MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
  12. Lesser General Public License for more details.
  13. You should have received a copy of the GNU Lesser General Public
  14. License along with this library; if not, write to the Free Software
  15. Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
  16. 02110-1301 USA
  17. ]"
  18. deferred class G_FLAGS
  19. -- The GLib type system provides fundamental types for enumeration
  20. -- and flags types. (Flags types are like enumerations, but allow
  21. -- their values to be combined by bitwise or). A registered
  22. -- enumeration or flags type associates a name and a nickname with
  23. -- each allowed value, and the methods g_enum_get_value_by_name(),
  24. -- g_enum_get_value_by_nick(), g_flags_get_value_by_name() and
  25. -- g_flags_get_value_by_nick() can look up values by their name or
  26. -- nickname. When an enumeration or flags type is registered with
  27. -- the GLib type system, it can be used as value type for object
  28. -- properties, using g_param_spec_enum() or g_param_spec_flags().
  29. -- GObject ships with a utility called glib-mkenums that can
  30. -- construct suitable type registration functions from C
  31. -- enumeration definitions.
  32. inherit
  33. G_FLAGS_EXTERNALS
  34. C_STRUCT
  35. feature -- size
  36. struct_size: INTEGER is
  37. external "C inline use <gtk/gtk.h>"
  38. alias "sizeof(GFlags)"
  39. end
  40. feature {} -- Creation
  41. -- G_ENUM_CLASS_TYPE()
  42. -- #define G_ENUM_CLASS_TYPE(class) (G_TYPE_FROM_CLASS (class))
  43. -- Returns the type identifier from a given GEnumClass structure.
  44. -- class : a GEnumClass
  45. -- ------------------------------------------------------------------------
  46. -- G_ENUM_CLASS_TYPE_NAME()
  47. -- #define G_ENUM_CLASS_TYPE_NAME(class) (g_type_name (G_ENUM_CLASS_TYPE (class)))
  48. -- Returns the static type name from a given GEnumClass structure.
  49. -- class : a GEnumClass
  50. -- ------------------------------------------------------------------------
  51. -- G_TYPE_IS_ENUM()
  52. -- #define G_TYPE_IS_ENUM(type) (G_TYPE_FUNDAMENTAL (type) == G_TYPE_ENUM)
  53. -- Returns whether type "is a" G_TYPE_ENUM.
  54. -- type : a GType ID.
  55. -- ------------------------------------------------------------------------
  56. -- G_ENUM_CLASS()
  57. -- #define G_ENUM_CLASS(class) (G_TYPE_CHECK_CLASS_CAST ((class), G_TYPE_ENUM, GEnumClass))
  58. -- Casts a derived GEnumClass structure into a GEnumClass structure.
  59. -- class : a valid GEnumClass
  60. -- ------------------------------------------------------------------------
  61. -- G_IS_ENUM_CLASS()
  62. -- #define G_IS_ENUM_CLASS(class) (G_TYPE_CHECK_CLASS_TYPE ((class), G_TYPE_ENUM))
  63. -- Checks whether class "is a" valid GEnumClass structure of type
  64. -- G_TYPE_ENUM or derived.
  65. -- class : a GEnumClass
  66. -- ------------------------------------------------------------------------
  67. -- G_TYPE_IS_FLAGS()
  68. -- #define G_TYPE_IS_FLAGS(type) (G_TYPE_FUNDAMENTAL (type) == G_TYPE_FLAGS)
  69. -- Returns whether type "is a" G_TYPE_FLAGS.
  70. -- type : a GType ID.
  71. -- ------------------------------------------------------------------------
  72. -- G_FLAGS_CLASS()
  73. -- #define G_FLAGS_CLASS(class) (G_TYPE_CHECK_CLASS_CAST ((class), G_TYPE_FLAGS, GFlagsClass))
  74. -- Casts a derived GFlagsClass structure into a GFlagsClass structure.
  75. -- class : a valid GFlagsClass
  76. -- ------------------------------------------------------------------------
  77. -- G_IS_FLAGS_CLASS()
  78. -- #define G_IS_FLAGS_CLASS(class) (G_TYPE_CHECK_CLASS_TYPE ((class), G_TYPE_FLAGS))
  79. -- Checks whether class "is a" valid GFlagsClass structure of type
  80. -- G_TYPE_FLAGS or derived.
  81. -- class : a GFlagsClass
  82. -- ------------------------------------------------------------------------
  83. -- G_FLAGS_CLASS_TYPE()
  84. -- #define G_FLAGS_CLASS_TYPE(class) (G_TYPE_FROM_CLASS (class))
  85. -- Returns the type identifier from a given GFlagsClass structure.
  86. -- class : a GFlagsClass
  87. -- ------------------------------------------------------------------------
  88. -- G_FLAGS_CLASS_TYPE_NAME()
  89. -- #define G_FLAGS_CLASS_TYPE_NAME(class) (g_type_name (G_FLAGS_CLASS_TYPE (class)))
  90. -- Returns the static type name from a given GFlagsClass structure.
  91. -- class : a GFlagsClass
  92. -- ------------------------------------------------------------------------
  93. -- GEnumValue
  94. -- typedef struct {
  95. -- gint value;
  96. -- gchar *value_name;
  97. -- gchar *value_nick;
  98. -- } GEnumValue;
  99. -- A structure which contains a single enum value, it's name, and it's
  100. -- nickname.
  101. -- gint value; the enum value
  102. -- gchar *value_name; the name of the value
  103. -- gchar *value_nick; the nickname of the value
  104. -- ------------------------------------------------------------------------
  105. -- GFlagsValue
  106. -- typedef struct {
  107. -- guint value;
  108. -- gchar *value_name;
  109. -- gchar *value_nick;
  110. -- } GFlagsValue;
  111. -- A structure which contains a single flags value, it's name, and it's
  112. -- nickname.
  113. -- guint value; the flags value
  114. -- gchar *value_name; the name of the value
  115. -- gchar *value_nick; the nickname of the value
  116. -- ------------------------------------------------------------------------
  117. -- g_enum_get_value ()
  118. -- GEnumValue* g_enum_get_value (GEnumClass *enum_class,
  119. -- gint value);
  120. -- Returns the GEnumValue for a value.
  121. -- enum_class : a GEnumClass
  122. -- value : the value to look up
  123. -- Returns : the GEnumValue for value, or NULL if value is not a member
  124. -- of the enumeration
  125. -- ------------------------------------------------------------------------
  126. -- g_enum_get_value_by_name ()
  127. -- GEnumValue* g_enum_get_value_by_name (GEnumClass *enum_class,
  128. -- const gchar *name);
  129. -- Looks up a GEnumValue by name.
  130. -- enum_class : a GEnumClass
  131. -- name : the name to look up
  132. -- Returns : the GEnumValue with name name, or NULL if the enumeration
  133. -- doesn' t have a member with that name
  134. -- ------------------------------------------------------------------------
  135. -- g_enum_get_value_by_nick ()
  136. -- GEnumValue* g_enum_get_value_by_nick (GEnumClass *enum_class,
  137. -- const gchar *nick);
  138. -- Looks up a GEnumValue by nickname.
  139. -- enum_class : a GEnumClass
  140. -- nick : the nickname to look up
  141. -- Returns : the GEnumValue with nickname nick, or NULL if the
  142. -- enumeration doesn' t have a member with that nickname
  143. -- ------------------------------------------------------------------------
  144. -- g_flags_get_first_value ()
  145. -- GFlagsValue* g_flags_get_first_value (GFlagsClass *flags_class,
  146. -- guint value);
  147. -- Returns the first GFlagsValue which is set in value.
  148. -- flags_class : a GFlagsClass
  149. -- value : the value
  150. -- Returns : the first GFlagsValue which is set in value, or NULL if
  151. -- none is set
  152. -- ------------------------------------------------------------------------
  153. -- g_flags_get_value_by_name ()
  154. -- GFlagsValue* g_flags_get_value_by_name (GFlagsClass *flags_class,
  155. -- const gchar *name);
  156. -- Looks up a GFlagsValue by name.
  157. -- flags_class : a GFlagsClass
  158. -- name : the name to look up
  159. -- Returns : the GFlagsValue with name name, or NULL if there is no
  160. -- flag with that name
  161. -- ------------------------------------------------------------------------
  162. -- g_flags_get_value_by_nick ()
  163. -- GFlagsValue* g_flags_get_value_by_nick (GFlagsClass *flags_class,
  164. -- const gchar *nick);
  165. -- Looks up a GFlagsValue by nickname.
  166. -- flags_class : a GFlagsClass
  167. -- nick : the nickname to look up
  168. -- Returns : the GFlagsValue with nickname nick, or NULL if there is no
  169. -- flag with that nickname
  170. -- ------------------------------------------------------------------------
  171. -- g_enum_register_static ()
  172. -- GType g_enum_register_static (const gchar *name,
  173. -- const GEnumValue *const_static_values);
  174. -- Registers a new static enumeration type with the name name.
  175. -- It is normally more convenient to let glib-mkenums generate a
  176. -- my_enum_get_type() function from a usual C enumeration definition than
  177. -- to write one yourself using g_enum_register_static().
  178. -- name : A nul-terminated string used as the name of the
  179. -- new type.
  180. -- const_static_values : An array of GEnumValue structs for the possible
  181. -- enumeration values. The array is terminated by a
  182. -- struct with all members being 0.
  183. -- Returns : The new type identifier.
  184. -- ------------------------------------------------------------------------
  185. -- g_flags_register_static ()
  186. -- GType g_flags_register_static (const gchar *name,
  187. -- const GFlagsValue *const_static_values);
  188. -- Registers a new static flags type with the name name.
  189. -- It is normally more convenient to let glib-mkenums generate a
  190. -- my_flags_get_type() function from a usual C enumeration definition than
  191. -- to write one yourself using g_flags_register_static().
  192. -- name : A nul-terminated string used as the name of the
  193. -- new type.
  194. -- const_static_values : An array of GFlagsValue structs for the possible
  195. -- flags values. The array is terminated by a struct
  196. -- with all members being 0.
  197. -- Returns : The new type identifier.
  198. -- ------------------------------------------------------------------------
  199. -- g_enum_complete_type_info ()
  200. -- void g_enum_complete_type_info (GType g_enum_type,
  201. -- GTypeInfo *info,
  202. -- const GEnumValue *const_values);
  203. -- This function is meant to be called from the complete_type_info()
  204. -- function of a GTypePlugin implementation, as in the following example:
  205. -- static void
  206. -- my_enum_complete_type_info (GTypePlugin *plugin,
  207. -- GType g_type,
  208. -- GTypeInfo *info,
  209. -- GTypeValueTable *value_table)
  210. -- {
  211. -- static const GEnumValue values[] = {
  212. -- { MY_ENUM_FOO, "MY_ENUM_FOO", "foo" },
  213. -- { MY_ENUM_BAR, "MY_ENUM_BAR", "bar" },
  214. -- { 0, NULL, NULL }
  215. -- };
  216. -- g_enum_complete_type_info (type, info, values);
  217. -- }
  218. -- g_enum_type : the type identifier of the type being completed
  219. -- info : the GTypeInfo struct to be filled in
  220. -- const_values : An array of GEnumValue structs for the possible
  221. -- enumeration values. The array is terminated by a struct
  222. -- with all members being 0.
  223. -- ------------------------------------------------------------------------
  224. -- g_flags_complete_type_info ()
  225. -- void g_flags_complete_type_info (GType g_flags_type,
  226. -- GTypeInfo *info,
  227. -- const GFlagsValue *const_values);
  228. -- This function is meant to be called from the complete_type_info()
  229. -- function of a GTypePlugin implementation, see the example for
  230. -- g_enumeration_complete_type_info() above.
  231. -- g_flags_type : the type identifier of the type being completed
  232. -- info : the GTypeInfo struct to be filled in
  233. -- const_values : An array of GFlagsValue structs for the possible
  234. -- enumeration values. The array is terminated by a struct
  235. -- with all members being 0.
  236. end -- G_FLAGS