Logo Search packages:      
Sourcecode: valatoys version File versions  Download package

queryresult.c

/* queryresult.c generated by valac 0.10.0, the Vala compiler
 * generated from queryresult.vala, do not modify */

/* queryresult.vala
 *
 * Copyright (C) 2010  Andrea Del Signore
 *
 * 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/>.
 *
 * Author:
 *    Andrea Del Signore <sejerpz@tin.it>
 */

#include <glib.h>
#include <glib-object.h>
#include <valagee.h>
#include <gobject/gvaluecollector.h>


#define AFRODITE_TYPE_QUERY_RESULT (afrodite_query_result_get_type ())
#define AFRODITE_QUERY_RESULT(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), AFRODITE_TYPE_QUERY_RESULT, AfroditeQueryResult))
#define AFRODITE_QUERY_RESULT_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), AFRODITE_TYPE_QUERY_RESULT, AfroditeQueryResultClass))
#define AFRODITE_IS_QUERY_RESULT(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), AFRODITE_TYPE_QUERY_RESULT))
#define AFRODITE_IS_QUERY_RESULT_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), AFRODITE_TYPE_QUERY_RESULT))
#define AFRODITE_QUERY_RESULT_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), AFRODITE_TYPE_QUERY_RESULT, AfroditeQueryResultClass))

typedef struct _AfroditeQueryResult AfroditeQueryResult;
typedef struct _AfroditeQueryResultClass AfroditeQueryResultClass;
typedef struct _AfroditeQueryResultPrivate AfroditeQueryResultPrivate;

#define AFRODITE_TYPE_RESULT_ITEM (afrodite_result_item_get_type ())
#define AFRODITE_RESULT_ITEM(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), AFRODITE_TYPE_RESULT_ITEM, AfroditeResultItem))
#define AFRODITE_RESULT_ITEM_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), AFRODITE_TYPE_RESULT_ITEM, AfroditeResultItemClass))
#define AFRODITE_IS_RESULT_ITEM(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), AFRODITE_TYPE_RESULT_ITEM))
#define AFRODITE_IS_RESULT_ITEM_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), AFRODITE_TYPE_RESULT_ITEM))
#define AFRODITE_RESULT_ITEM_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), AFRODITE_TYPE_RESULT_ITEM, AfroditeResultItemClass))

typedef struct _AfroditeResultItem AfroditeResultItem;
typedef struct _AfroditeResultItemClass AfroditeResultItemClass;
#define _vala_collection_object_unref0(var) ((var == NULL) ? NULL : (var = (vala_collection_object_unref (var), NULL)))

#define AFRODITE_TYPE_SYMBOL (afrodite_symbol_get_type ())
#define AFRODITE_SYMBOL(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), AFRODITE_TYPE_SYMBOL, AfroditeSymbol))
#define AFRODITE_SYMBOL_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), AFRODITE_TYPE_SYMBOL, AfroditeSymbolClass))
#define AFRODITE_IS_SYMBOL(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), AFRODITE_TYPE_SYMBOL))
#define AFRODITE_IS_SYMBOL_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), AFRODITE_TYPE_SYMBOL))
#define AFRODITE_SYMBOL_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), AFRODITE_TYPE_SYMBOL, AfroditeSymbolClass))

typedef struct _AfroditeSymbol AfroditeSymbol;
typedef struct _AfroditeSymbolClass AfroditeSymbolClass;
#define _afrodite_result_item_unref0(var) ((var == NULL) ? NULL : (var = (afrodite_result_item_unref (var), NULL)))
typedef struct _AfroditeParamSpecQueryResult AfroditeParamSpecQueryResult;

struct _AfroditeQueryResult {
      GTypeInstance parent_instance;
      volatile int ref_count;
      AfroditeQueryResultPrivate * priv;
      gint items_created;
};

struct _AfroditeQueryResultClass {
      GTypeClass parent_class;
      void (*finalize) (AfroditeQueryResult *self);
};

00077 struct _AfroditeQueryResultPrivate {
      ValaList* _children;
};

00081 struct _AfroditeParamSpecQueryResult {
      GParamSpec parent_instance;
};


static gpointer afrodite_query_result_parent_class = NULL;

gpointer afrodite_query_result_ref (gpointer instance);
void afrodite_query_result_unref (gpointer instance);
GParamSpec* afrodite_param_spec_query_result (const gchar* name, const gchar* nick, const gchar* blurb, GType object_type, GParamFlags flags);
void afrodite_value_set_query_result (GValue* value, gpointer v_object);
void afrodite_value_take_query_result (GValue* value, gpointer v_object);
gpointer afrodite_value_get_query_result (const GValue* value);
GType afrodite_query_result_get_type (void) G_GNUC_CONST;
gpointer afrodite_result_item_ref (gpointer instance);
void afrodite_result_item_unref (gpointer instance);
GParamSpec* afrodite_param_spec_result_item (const gchar* name, const gchar* nick, const gchar* blurb, GType object_type, GParamFlags flags);
void afrodite_value_set_result_item (GValue* value, gpointer v_object);
void afrodite_value_take_result_item (GValue* value, gpointer v_object);
gpointer afrodite_value_get_result_item (const GValue* value);
GType afrodite_result_item_get_type (void) G_GNUC_CONST;
#define AFRODITE_QUERY_RESULT_GET_PRIVATE(o) (G_TYPE_INSTANCE_GET_PRIVATE ((o), AFRODITE_TYPE_QUERY_RESULT, AfroditeQueryResultPrivate))
enum  {
      AFRODITE_QUERY_RESULT_DUMMY_PROPERTY
};
void afrodite_query_result_add_result_item (AfroditeQueryResult* self, AfroditeResultItem* item);
ValaList* afrodite_query_result_get_children (AfroditeQueryResult* self);
GType afrodite_symbol_get_type (void) G_GNUC_CONST;
AfroditeResultItem* afrodite_query_result_new_result_item (AfroditeQueryResult* self, AfroditeResultItem* parent, AfroditeSymbol* symbol);
AfroditeResultItem* afrodite_result_item_new (void);
AfroditeResultItem* afrodite_result_item_construct (GType object_type);
void afrodite_result_item_set_symbol (AfroditeResultItem* self, AfroditeSymbol* value);
void afrodite_result_item_set_parent (AfroditeResultItem* self, AfroditeResultItem* value);
AfroditeQueryResult* afrodite_query_result_new (void);
AfroditeQueryResult* afrodite_query_result_construct (GType object_type);
void afrodite_query_result_set_children (AfroditeQueryResult* self, ValaList* value);
gboolean afrodite_query_result_get_is_empty (AfroditeQueryResult* self);
static void afrodite_query_result_finalize (AfroditeQueryResult* obj);



void afrodite_query_result_add_result_item (AfroditeQueryResult* self, AfroditeResultItem* item) {
      g_return_if_fail (self != NULL);
      g_return_if_fail (item != NULL);
      vala_collection_add ((ValaCollection*) afrodite_query_result_get_children (self), item);
}


AfroditeResultItem* afrodite_query_result_new_result_item (AfroditeQueryResult* self, AfroditeResultItem* parent, AfroditeSymbol* symbol) {
      AfroditeResultItem* result = NULL;
      AfroditeResultItem* res;
      g_return_val_if_fail (self != NULL, NULL);
      g_return_val_if_fail (symbol != NULL, NULL);
      res = afrodite_result_item_new ();
      afrodite_result_item_set_symbol (res, symbol);
      afrodite_result_item_set_parent (res, parent);
      self->items_created++;
      result = res;
      return result;
}


AfroditeQueryResult* afrodite_query_result_construct (GType object_type) {
      AfroditeQueryResult* self;
      self = (AfroditeQueryResult*) g_type_create_instance (object_type);
      return self;
}


AfroditeQueryResult* afrodite_query_result_new (void) {
      return afrodite_query_result_construct (AFRODITE_TYPE_QUERY_RESULT);
}


ValaList* afrodite_query_result_get_children (AfroditeQueryResult* self) {
      ValaList* result;
      g_return_val_if_fail (self != NULL, NULL);
      result = self->priv->_children;
      return result;
}


static gpointer _vala_collection_object_ref0 (gpointer self) {
      return self ? vala_collection_object_ref (self) : NULL;
}


void afrodite_query_result_set_children (AfroditeQueryResult* self, ValaList* value) {
      ValaList* _tmp0_;
      g_return_if_fail (self != NULL);
      self->priv->_children = (_tmp0_ = _vala_collection_object_ref0 (value), _vala_collection_object_unref0 (self->priv->_children), _tmp0_);
}


gboolean afrodite_query_result_get_is_empty (AfroditeQueryResult* self) {
      gboolean result;
      g_return_val_if_fail (self != NULL, FALSE);
      result = vala_collection_get_size ((ValaCollection*) afrodite_query_result_get_children (self)) == 0;
      return result;
}


static void afrodite_value_query_result_init (GValue* value) {
      value->data[0].v_pointer = NULL;
}


static void afrodite_value_query_result_free_value (GValue* value) {
      if (value->data[0].v_pointer) {
            afrodite_query_result_unref (value->data[0].v_pointer);
      }
}


static void afrodite_value_query_result_copy_value (const GValue* src_value, GValue* dest_value) {
      if (src_value->data[0].v_pointer) {
            dest_value->data[0].v_pointer = afrodite_query_result_ref (src_value->data[0].v_pointer);
      } else {
            dest_value->data[0].v_pointer = NULL;
      }
}


static gpointer afrodite_value_query_result_peek_pointer (const GValue* value) {
      return value->data[0].v_pointer;
}


static gchar* afrodite_value_query_result_collect_value (GValue* value, guint n_collect_values, GTypeCValue* collect_values, guint collect_flags) {
      if (collect_values[0].v_pointer) {
            AfroditeQueryResult* object;
            object = collect_values[0].v_pointer;
            if (object->parent_instance.g_class == NULL) {
                  return g_strconcat ("invalid unclassed object pointer for value type `", G_VALUE_TYPE_NAME (value), "'", NULL);
            } else if (!g_value_type_compatible (G_TYPE_FROM_INSTANCE (object), G_VALUE_TYPE (value))) {
                  return g_strconcat ("invalid object type `", g_type_name (G_TYPE_FROM_INSTANCE (object)), "' for value type `", G_VALUE_TYPE_NAME (value), "'", NULL);
            }
            value->data[0].v_pointer = afrodite_query_result_ref (object);
      } else {
            value->data[0].v_pointer = NULL;
      }
      return NULL;
}


static gchar* afrodite_value_query_result_lcopy_value (const GValue* value, guint n_collect_values, GTypeCValue* collect_values, guint collect_flags) {
      AfroditeQueryResult** object_p;
      object_p = collect_values[0].v_pointer;
      if (!object_p) {
            return g_strdup_printf ("value location for `%s' passed as NULL", G_VALUE_TYPE_NAME (value));
      }
      if (!value->data[0].v_pointer) {
            *object_p = NULL;
      } else if (collect_flags & G_VALUE_NOCOPY_CONTENTS) {
            *object_p = value->data[0].v_pointer;
      } else {
            *object_p = afrodite_query_result_ref (value->data[0].v_pointer);
      }
      return NULL;
}


GParamSpec* afrodite_param_spec_query_result (const gchar* name, const gchar* nick, const gchar* blurb, GType object_type, GParamFlags flags) {
      AfroditeParamSpecQueryResult* spec;
      g_return_val_if_fail (g_type_is_a (object_type, AFRODITE_TYPE_QUERY_RESULT), NULL);
      spec = g_param_spec_internal (G_TYPE_PARAM_OBJECT, name, nick, blurb, flags);
      G_PARAM_SPEC (spec)->value_type = object_type;
      return G_PARAM_SPEC (spec);
}


gpointer afrodite_value_get_query_result (const GValue* value) {
      g_return_val_if_fail (G_TYPE_CHECK_VALUE_TYPE (value, AFRODITE_TYPE_QUERY_RESULT), NULL);
      return value->data[0].v_pointer;
}


void afrodite_value_set_query_result (GValue* value, gpointer v_object) {
      AfroditeQueryResult* old;
      g_return_if_fail (G_TYPE_CHECK_VALUE_TYPE (value, AFRODITE_TYPE_QUERY_RESULT));
      old = value->data[0].v_pointer;
      if (v_object) {
            g_return_if_fail (G_TYPE_CHECK_INSTANCE_TYPE (v_object, AFRODITE_TYPE_QUERY_RESULT));
            g_return_if_fail (g_value_type_compatible (G_TYPE_FROM_INSTANCE (v_object), G_VALUE_TYPE (value)));
            value->data[0].v_pointer = v_object;
            afrodite_query_result_ref (value->data[0].v_pointer);
      } else {
            value->data[0].v_pointer = NULL;
      }
      if (old) {
            afrodite_query_result_unref (old);
      }
}


void afrodite_value_take_query_result (GValue* value, gpointer v_object) {
      AfroditeQueryResult* old;
      g_return_if_fail (G_TYPE_CHECK_VALUE_TYPE (value, AFRODITE_TYPE_QUERY_RESULT));
      old = value->data[0].v_pointer;
      if (v_object) {
            g_return_if_fail (G_TYPE_CHECK_INSTANCE_TYPE (v_object, AFRODITE_TYPE_QUERY_RESULT));
            g_return_if_fail (g_value_type_compatible (G_TYPE_FROM_INSTANCE (v_object), G_VALUE_TYPE (value)));
            value->data[0].v_pointer = v_object;
      } else {
            value->data[0].v_pointer = NULL;
      }
      if (old) {
            afrodite_query_result_unref (old);
      }
}


static void afrodite_query_result_class_init (AfroditeQueryResultClass * klass) {
      afrodite_query_result_parent_class = g_type_class_peek_parent (klass);
      AFRODITE_QUERY_RESULT_CLASS (klass)->finalize = afrodite_query_result_finalize;
      g_type_class_add_private (klass, sizeof (AfroditeQueryResultPrivate));
}


static void afrodite_query_result_instance_init (AfroditeQueryResult * self) {
      self->priv = AFRODITE_QUERY_RESULT_GET_PRIVATE (self);
      self->priv->_children = (ValaList*) vala_array_list_new (AFRODITE_TYPE_RESULT_ITEM, (GBoxedCopyFunc) afrodite_result_item_ref, afrodite_result_item_unref, g_direct_equal);
      self->items_created = 0;
      self->ref_count = 1;
}


static void afrodite_query_result_finalize (AfroditeQueryResult* obj) {
      AfroditeQueryResult * self;
      self = AFRODITE_QUERY_RESULT (obj);
      {
            afrodite_query_result_set_children (self, NULL);
      }
      _vala_collection_object_unref0 (self->priv->_children);
}


GType afrodite_query_result_get_type (void) {
      static volatile gsize afrodite_query_result_type_id__volatile = 0;
      if (g_once_init_enter (&afrodite_query_result_type_id__volatile)) {
            static const GTypeValueTable g_define_type_value_table = { afrodite_value_query_result_init, afrodite_value_query_result_free_value, afrodite_value_query_result_copy_value, afrodite_value_query_result_peek_pointer, "p", afrodite_value_query_result_collect_value, "p", afrodite_value_query_result_lcopy_value };
            static const GTypeInfo g_define_type_info = { sizeof (AfroditeQueryResultClass), (GBaseInitFunc) NULL, (GBaseFinalizeFunc) NULL, (GClassInitFunc) afrodite_query_result_class_init, (GClassFinalizeFunc) NULL, NULL, sizeof (AfroditeQueryResult), 0, (GInstanceInitFunc) afrodite_query_result_instance_init, &g_define_type_value_table };
            static const GTypeFundamentalInfo g_define_type_fundamental_info = { (G_TYPE_FLAG_CLASSED | G_TYPE_FLAG_INSTANTIATABLE | G_TYPE_FLAG_DERIVABLE | G_TYPE_FLAG_DEEP_DERIVABLE) };
            GType afrodite_query_result_type_id;
            afrodite_query_result_type_id = g_type_register_fundamental (g_type_fundamental_next (), "AfroditeQueryResult", &g_define_type_info, &g_define_type_fundamental_info, 0);
            g_once_init_leave (&afrodite_query_result_type_id__volatile, afrodite_query_result_type_id);
      }
      return afrodite_query_result_type_id__volatile;
}


gpointer afrodite_query_result_ref (gpointer instance) {
      AfroditeQueryResult* self;
      self = instance;
      g_atomic_int_inc (&self->ref_count);
      return instance;
}


void afrodite_query_result_unref (gpointer instance) {
      AfroditeQueryResult* self;
      self = instance;
      if (g_atomic_int_dec_and_test (&self->ref_count)) {
            AFRODITE_QUERY_RESULT_GET_CLASS (self)->finalize (self);
            g_type_free_instance ((GTypeInstance *) self);
      }
}





Generated by  Doxygen 1.6.0   Back to index