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

sourceitem.c

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

/* sourceitem.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 <stdlib.h>
#include <string.h>
#include <vala.h>
#include <gobject/gvaluecollector.h>


#define AFRODITE_TYPE_SOURCE_ITEM (afrodite_source_item_get_type ())
#define AFRODITE_SOURCE_ITEM(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), AFRODITE_TYPE_SOURCE_ITEM, AfroditeSourceItem))
#define AFRODITE_SOURCE_ITEM_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), AFRODITE_TYPE_SOURCE_ITEM, AfroditeSourceItemClass))
#define AFRODITE_IS_SOURCE_ITEM(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), AFRODITE_TYPE_SOURCE_ITEM))
#define AFRODITE_IS_SOURCE_ITEM_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), AFRODITE_TYPE_SOURCE_ITEM))
#define AFRODITE_SOURCE_ITEM_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), AFRODITE_TYPE_SOURCE_ITEM, AfroditeSourceItemClass))

typedef struct _AfroditeSourceItem AfroditeSourceItem;
typedef struct _AfroditeSourceItemClass AfroditeSourceItemClass;
typedef struct _AfroditeSourceItemPrivate AfroditeSourceItemPrivate;
#define _g_free0(var) (var = (g_free (var), NULL))
#define _vala_code_context_unref0(var) ((var == NULL) ? NULL : (var = (vala_code_context_unref (var), NULL)))
#define _afrodite_source_item_unref0(var) ((var == NULL) ? NULL : (var = (afrodite_source_item_unref (var), NULL)))
typedef struct _AfroditeParamSpecSourceItem AfroditeParamSpecSourceItem;

struct _AfroditeSourceItem {
      GTypeInstance parent_instance;
      volatile int ref_count;
      AfroditeSourceItemPrivate * priv;
      char* path;
      char* content;
      gboolean is_glib;
      ValaCodeContext* context;
};

struct _AfroditeSourceItemClass {
      GTypeClass parent_class;
      void (*finalize) (AfroditeSourceItem *self);
};

00063 struct _AfroditeParamSpecSourceItem {
      GParamSpec parent_instance;
};


static gpointer afrodite_source_item_parent_class = NULL;

gpointer afrodite_source_item_ref (gpointer instance);
void afrodite_source_item_unref (gpointer instance);
GParamSpec* afrodite_param_spec_source_item (const gchar* name, const gchar* nick, const gchar* blurb, GType object_type, GParamFlags flags);
void afrodite_value_set_source_item (GValue* value, gpointer v_object);
void afrodite_value_take_source_item (GValue* value, gpointer v_object);
gpointer afrodite_value_get_source_item (const GValue* value);
GType afrodite_source_item_get_type (void) G_GNUC_CONST;
enum  {
      AFRODITE_SOURCE_ITEM_DUMMY_PROPERTY
};
AfroditeSourceItem* afrodite_source_item_copy (AfroditeSourceItem* self);
AfroditeSourceItem* afrodite_source_item_new (void);
AfroditeSourceItem* afrodite_source_item_construct (GType object_type);
gboolean afrodite_source_item_get_is_vapi (AfroditeSourceItem* self);
static void afrodite_source_item_finalize (AfroditeSourceItem* obj);



AfroditeSourceItem* afrodite_source_item_copy (AfroditeSourceItem* self) {
      AfroditeSourceItem* result = NULL;
      AfroditeSourceItem* item;
      char* _tmp0_;
      char* _tmp1_;
      g_return_val_if_fail (self != NULL, NULL);
      item = afrodite_source_item_new ();
      item->path = (_tmp0_ = g_strdup (self->path), _g_free0 (item->path), _tmp0_);
      item->content = (_tmp1_ = g_strdup (self->content), _g_free0 (item->content), _tmp1_);
      item->is_glib = self->is_glib;
      result = item;
      return result;
}


AfroditeSourceItem* afrodite_source_item_construct (GType object_type) {
      AfroditeSourceItem* self;
      self = (AfroditeSourceItem*) g_type_create_instance (object_type);
      return self;
}


AfroditeSourceItem* afrodite_source_item_new (void) {
      return afrodite_source_item_construct (AFRODITE_TYPE_SOURCE_ITEM);
}


gboolean afrodite_source_item_get_is_vapi (AfroditeSourceItem* self) {
      gboolean result;
      gboolean _tmp0_ = FALSE;
      g_return_val_if_fail (self != NULL, FALSE);
      if (self->path != NULL) {
            _tmp0_ = g_str_has_suffix (self->path, ".vapi");
      } else {
            _tmp0_ = FALSE;
      }
      result = _tmp0_;
      return result;
}


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


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


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


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


static gchar* afrodite_value_source_item_collect_value (GValue* value, guint n_collect_values, GTypeCValue* collect_values, guint collect_flags) {
      if (collect_values[0].v_pointer) {
            AfroditeSourceItem* 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_source_item_ref (object);
      } else {
            value->data[0].v_pointer = NULL;
      }
      return NULL;
}


static gchar* afrodite_value_source_item_lcopy_value (const GValue* value, guint n_collect_values, GTypeCValue* collect_values, guint collect_flags) {
      AfroditeSourceItem** 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_source_item_ref (value->data[0].v_pointer);
      }
      return NULL;
}


GParamSpec* afrodite_param_spec_source_item (const gchar* name, const gchar* nick, const gchar* blurb, GType object_type, GParamFlags flags) {
      AfroditeParamSpecSourceItem* spec;
      g_return_val_if_fail (g_type_is_a (object_type, AFRODITE_TYPE_SOURCE_ITEM), 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_source_item (const GValue* value) {
      g_return_val_if_fail (G_TYPE_CHECK_VALUE_TYPE (value, AFRODITE_TYPE_SOURCE_ITEM), NULL);
      return value->data[0].v_pointer;
}


void afrodite_value_set_source_item (GValue* value, gpointer v_object) {
      AfroditeSourceItem* old;
      g_return_if_fail (G_TYPE_CHECK_VALUE_TYPE (value, AFRODITE_TYPE_SOURCE_ITEM));
      old = value->data[0].v_pointer;
      if (v_object) {
            g_return_if_fail (G_TYPE_CHECK_INSTANCE_TYPE (v_object, AFRODITE_TYPE_SOURCE_ITEM));
            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_source_item_ref (value->data[0].v_pointer);
      } else {
            value->data[0].v_pointer = NULL;
      }
      if (old) {
            afrodite_source_item_unref (old);
      }
}


void afrodite_value_take_source_item (GValue* value, gpointer v_object) {
      AfroditeSourceItem* old;
      g_return_if_fail (G_TYPE_CHECK_VALUE_TYPE (value, AFRODITE_TYPE_SOURCE_ITEM));
      old = value->data[0].v_pointer;
      if (v_object) {
            g_return_if_fail (G_TYPE_CHECK_INSTANCE_TYPE (v_object, AFRODITE_TYPE_SOURCE_ITEM));
            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_source_item_unref (old);
      }
}


static void afrodite_source_item_class_init (AfroditeSourceItemClass * klass) {
      afrodite_source_item_parent_class = g_type_class_peek_parent (klass);
      AFRODITE_SOURCE_ITEM_CLASS (klass)->finalize = afrodite_source_item_finalize;
}


static void afrodite_source_item_instance_init (AfroditeSourceItem * self) {
      self->is_glib = FALSE;
      self->context = NULL;
      self->ref_count = 1;
}


static void afrodite_source_item_finalize (AfroditeSourceItem* obj) {
      AfroditeSourceItem * self;
      self = AFRODITE_SOURCE_ITEM (obj);
      _g_free0 (self->path);
      _g_free0 (self->content);
      _vala_code_context_unref0 (self->context);
}


GType afrodite_source_item_get_type (void) {
      static volatile gsize afrodite_source_item_type_id__volatile = 0;
      if (g_once_init_enter (&afrodite_source_item_type_id__volatile)) {
            static const GTypeValueTable g_define_type_value_table = { afrodite_value_source_item_init, afrodite_value_source_item_free_value, afrodite_value_source_item_copy_value, afrodite_value_source_item_peek_pointer, "p", afrodite_value_source_item_collect_value, "p", afrodite_value_source_item_lcopy_value };
            static const GTypeInfo g_define_type_info = { sizeof (AfroditeSourceItemClass), (GBaseInitFunc) NULL, (GBaseFinalizeFunc) NULL, (GClassInitFunc) afrodite_source_item_class_init, (GClassFinalizeFunc) NULL, NULL, sizeof (AfroditeSourceItem), 0, (GInstanceInitFunc) afrodite_source_item_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_source_item_type_id;
            afrodite_source_item_type_id = g_type_register_fundamental (g_type_fundamental_next (), "AfroditeSourceItem", &g_define_type_info, &g_define_type_fundamental_info, 0);
            g_once_init_leave (&afrodite_source_item_type_id__volatile, afrodite_source_item_type_id);
      }
      return afrodite_source_item_type_id__volatile;
}


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


void afrodite_source_item_unref (gpointer instance) {
      AfroditeSourceItem* self;
      self = instance;
      if (g_atomic_int_dec_and_test (&self->ref_count)) {
            AFRODITE_SOURCE_ITEM_GET_CLASS (self)->finalize (self);
            g_type_free_instance ((GTypeInstance *) self);
      }
}





Generated by  Doxygen 1.6.0   Back to index