/* 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
