summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorKjell Ahlstedt <kjellahlstedt@gmail.com>2017-06-12 15:45:46 +0200
committerKjell Ahlstedt <kjellahlstedt@gmail.com>2017-06-12 15:45:46 +0200
commit3795f0d0601de86f3657da3e9a915e1f61e1cf6f (patch)
tree955b30b02102fb90c991a79c2a88b71a77a7d521
parent6c4124a36e7863b86d42db7c5034af9c1fb77483 (diff)
downloadglibmm-3795f0d0601de86f3657da3e9a915e1f61e1cf6f.tar.gz
Glib::NodeTree: Use _WRAP_ENUM for Glib::NodeTree::TraverseType
-rw-r--r--glib/src/glib_extra_objects.defs10
-rw-r--r--glib/src/nodetree.hg20
2 files changed, 14 insertions, 16 deletions
diff --git a/glib/src/glib_extra_objects.defs b/glib/src/glib_extra_objects.defs
index cfb6876b..2171e9e0 100644
--- a/glib/src/glib_extra_objects.defs
+++ b/glib/src/glib_extra_objects.defs
@@ -44,6 +44,11 @@
(gtype-id "G_TYPE_MATCH_INFO")
)
+(define-object NodeTree
+ (in-module "Glib")
+ (c-name "GNode")
+)
+
(define-object Object
(in-module "Glib")
(c-name "GObject")
@@ -73,6 +78,11 @@
(c-name "GTimeZone")
)
+(define-object Tree
+ (in-module "Glib")
+ (c-name "GTree")
+)
+
(define-object Variant
(in-module "Glib")
(c-name "GVariant")
diff --git a/glib/src/nodetree.hg b/glib/src/nodetree.hg
index cf41b48f..72cf86d2 100644
--- a/glib/src/nodetree.hg
+++ b/glib/src/nodetree.hg
@@ -55,20 +55,7 @@ class NodeTree
{
_CLASS_GENERIC(NodeTree, GNode)
public:
- //Hand-written, instead of using _WRAP_ENUM,
- //because the C enum values don't have a prefix.
-
- /** Specifies the type of traveral performed by methods such as NodeTree::_traverse() and NodeTree::find().
- *
- * @ingroup glibmmEnums
- */
- enum class TraverseType
- {
- IN_ORDER = G_IN_ORDER, /*!< Visits a node's left child first, then the node itself, then its right child. This is the one to use if you want the output sorted according to the compare function. */
- PRE_ORDER = G_PRE_ORDER, /*!< Visits a node, then its children. */
- POST_ORDER = G_POST_ORDER, /*!< Visits the node's children, then the node itself. */
- LEVEL_ORDER = G_LEVEL_ORDER /*!< For NodeTree, it vists the root node first, then its children, then its grandchildren, and so on. Note that this is less efficient than the other orders. This is not implemented for Glib::Tree. */
- };
+ _WRAP_ENUM(TraverseType, GTraverseType, NO_GTYPE)
using TraverseFunc = sigc::slot<bool(NodeTree<T>&)>;
using ForeachFunc = sigc::slot<void(NodeTree<T>&)>;
@@ -283,7 +270,8 @@ public:
}
_IGNORE(g_node_get_root)
-
+ // Can't use _WRAP_ENUM for a Flags-type enum in a template class.
+ // gmmproc would get the bitwise operators wrong.
/** Specifies which nodes are visited during several of the NodeTree methods,
* including traverse() and find().
*
@@ -364,7 +352,7 @@ public:
/** Finds a node in a tree.
*
- * @param order The order in which nodes are visited: IN_ORDER, TraverseType::PRE_ORDER, TraverseType::POST_ORDER, or TraverseType::LEVEL_ORDER
+ * @param order The order in which nodes are visited: TraverseType::IN_ORDER, TraverseType::PRE_ORDER, TraverseType::POST_ORDER, or TraverseType::LEVEL_ORDER
* @param flags Which types of children are to be visited: one of TraverseFlags::ALL, TraverseFlags::LEAVES or TraverseFlags::NON_LEAVES.
* @param the_data The data for which to search.
* @return The found node, or <tt>nullptr</tt> if the data is not found.