/* Copyright 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, write to the Free
 * Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
 */

#include <glibmm/varianttype.h>
#include <glibmm/utility.h>
#include <glib/gvarianttype.h>

namespace Glib
{

VariantType::VariantType(const GVariantType* castitem)
{
  if(castitem)
    gobject_ = g_variant_type_copy(castitem);
  else
    gobject_ = 0;
}

VariantType::VariantType(const std::string& type_string)
: gobject_(g_variant_type_new(type_string.c_str()))
{
}

VariantType& VariantType::operator=(const GVariantType* castitem)
{
  if(gobject_)
  {
    g_variant_type_free (gobject_);
  }
  
  if(castitem)
    gobject_ = g_variant_type_copy(castitem);
  else
    gobject_ = 0;
    
  return *this;
}


const VariantType VariantTypeBool(G_VARIANT_TYPE_BOOLEAN);

const VariantType VariantTypeByte(G_VARIANT_TYPE_BYTE);

const VariantType VariantTypeInt16(G_VARIANT_TYPE_INT16);

const VariantType VariantTypeUint16(G_VARIANT_TYPE_UINT16);

const VariantType VariantTypeInt32(G_VARIANT_TYPE_INT32);

const VariantType VariantTypeUint32(G_VARIANT_TYPE_UINT32);

const VariantType VariantTypeInt64(G_VARIANT_TYPE_INT64);

const VariantType VariantTypeUint64(G_VARIANT_TYPE_UINT64);

const VariantType VariantTypeDouble(G_VARIANT_TYPE_DOUBLE);

const VariantType VariantTypeString(G_VARIANT_TYPE_STRING);

const VariantType VariantTypeObjectPath(G_VARIANT_TYPE_OBJECT_PATH);

const VariantType VariantTypeSignature(G_VARIANT_TYPE_SIGNATURE);

const VariantType VariantTypeVariant(G_VARIANT_TYPE_VARIANT);

const VariantType VariantTypeHandle(G_VARIANT_TYPE_HANDLE);

const VariantType VariantTypeUnit(G_VARIANT_TYPE_UNIT);

const VariantType VariantTypeAny(G_VARIANT_TYPE_ANY);

const VariantType VariantTypeBasic(G_VARIANT_TYPE_BASIC);

const VariantType VariantTypeMaybe(G_VARIANT_TYPE_MAYBE);

const VariantType VariantTypeArray(G_VARIANT_TYPE_ARRAY);

const VariantType VariantTypeTuple(G_VARIANT_TYPE_TUPLE);

const VariantType VariantTypeDictEntry(G_VARIANT_TYPE_DICT_ENTRY);

const VariantType VariantTypeDictionary(G_VARIANT_TYPE_DICTIONARY);

const VariantType VariantTypeStringArray(G_VARIANT_TYPE_STRING_ARRAY);

const VariantType VariantTypeByteString(G_VARIANT_TYPE_BYTESTRING);

const VariantType VariantTypeByteStringArray(G_VARIANT_TYPE_STRING_ARRAY);

}
