summaryrefslogtreecommitdiff
path: root/glib/src/nodetree.ccg
blob: dbfc52e544b4d3f8cf854ebf439ea1e07c2ca6ae (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
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