/* Copyright(C) 2010 The 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 <glib.h>
_DEFS(glibmm,glib)

namespace Glib
{

class VariantBase;
class VariantContainerBase;

//This can't be like a real iterator (like Gtk::TextIter),
//because g_iter_value_get_next_value() both gets a value and changes the iterator.
//GtkTextIter allows us to go forward and then separately get the current value.
/** VariantIter - An opaque data structure used to iterate through
 * VariantContainerBase containers such as arrays.
 * @newin{2,28}
 */
class VariantIter
{
  _CLASS_OPAQUE_COPYABLE(VariantIter, GVariantIter, NONE, g_variant_iter_copy, g_variant_iter_free)
  _IGNORE(g_variant_iter_copy, g_variant_iter_free)
public:
  explicit VariantIter(const VariantContainerBase& variant);

  _WRAP_METHOD(gsize init(const VariantContainerBase& value), g_variant_iter_init)

  dnl // Don't _IGNORE(g_variant_iter_new). It's listed in glib_functions.defs as
  dnl // a method of GVariant. Ignoring it would make gmmproc think that this
  dnl // file wraps GVariant, and it would list all GVariant methods as unwrapped.

  _WRAP_METHOD(gsize get_n_children() const, g_variant_iter_n_children)

  bool next_value(VariantBase& value);
  _IGNORE(g_variant_iter_next_value)

  // Ignore varargs functions
  _IGNORE(g_variant_iter_loop, g_variant_iter_next)
};

} // namespace Glib
