summaryrefslogtreecommitdiff
path: root/glib/src/nodetree.ccg
diff options
context:
space:
mode:
Diffstat (limited to 'glib/src/nodetree.ccg')
-rw-r--r--glib/src/nodetree.ccg38
1 files changed, 38 insertions, 0 deletions
diff --git a/glib/src/nodetree.ccg b/glib/src/nodetree.ccg
index 6ee2218c..dbfc52e5 100644
--- a/glib/src/nodetree.ccg
+++ b/glib/src/nodetree.ccg
@@ -1 +1,39 @@
+/* Copyright (C) 2007 glibmm development team
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2.1 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library. If not, see <http://www.gnu.org/licenses/>.
+ */
+
#include <glibmm/nodetree.h>
+
+namespace Glib
+{
+extern "C"
+{
+// A function with external linkage and C linkage does not get a mangled name.
+// Even though glibmm_NodeTree_c_callback_traverse() and glibmm_NodeTree_c_callback_foreach()
+// are declared in a named namespace, the linker does not see the namespace name.
+// Therefore the function names shall have a prefix, hopefully unique.
+gboolean glibmm_NodeTree_c_callback_traverse(GNode* node, gpointer data)
+{
+ auto traverse_data = reinterpret_cast<NodeTreeCallbackTraverseData*>(data);
+ return (*traverse_data->func)(node, traverse_data->data);
+}
+
+void glibmm_NodeTree_c_callback_foreach(GNode* node, gpointer data)
+{
+ auto foreach_data = reinterpret_cast<NodeTreeCallbackForeachData*>(data);
+ (*foreach_data->func)(node, foreach_data->data);
+}
+} // extern "C"
+} // namespace Glib