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

sourcereference.c

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

/* sourcereference.vala
 *
 * Copyright (C) 2009  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 <gobject/gvaluecollector.h>


#define AFRODITE_TYPE_SOURCE_REFERENCE (afrodite_source_reference_get_type ())
#define AFRODITE_SOURCE_REFERENCE(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), AFRODITE_TYPE_SOURCE_REFERENCE, AfroditeSourceReference))
#define AFRODITE_SOURCE_REFERENCE_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), AFRODITE_TYPE_SOURCE_REFERENCE, AfroditeSourceReferenceClass))
#define AFRODITE_IS_SOURCE_REFERENCE(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), AFRODITE_TYPE_SOURCE_REFERENCE))
#define AFRODITE_IS_SOURCE_REFERENCE_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), AFRODITE_TYPE_SOURCE_REFERENCE))
#define AFRODITE_SOURCE_REFERENCE_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), AFRODITE_TYPE_SOURCE_REFERENCE, AfroditeSourceReferenceClass))

typedef struct _AfroditeSourceReference AfroditeSourceReference;
typedef struct _AfroditeSourceReferenceClass AfroditeSourceReferenceClass;
typedef struct _AfroditeSourceReferencePrivate AfroditeSourceReferencePrivate;

#define AFRODITE_TYPE_SOURCE_FILE (afrodite_source_file_get_type ())
#define AFRODITE_SOURCE_FILE(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), AFRODITE_TYPE_SOURCE_FILE, AfroditeSourceFile))
#define AFRODITE_SOURCE_FILE_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), AFRODITE_TYPE_SOURCE_FILE, AfroditeSourceFileClass))
#define AFRODITE_IS_SOURCE_FILE(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), AFRODITE_TYPE_SOURCE_FILE))
#define AFRODITE_IS_SOURCE_FILE_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), AFRODITE_TYPE_SOURCE_FILE))
#define AFRODITE_SOURCE_FILE_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), AFRODITE_TYPE_SOURCE_FILE, AfroditeSourceFileClass))

typedef struct _AfroditeSourceFile AfroditeSourceFile;
typedef struct _AfroditeSourceFileClass AfroditeSourceFileClass;
typedef struct _AfroditeParamSpecSourceReference AfroditeParamSpecSourceReference;

struct _AfroditeSourceReference {
      GTypeInstance parent_instance;
      volatile int ref_count;
      AfroditeSourceReferencePrivate * priv;
};

struct _AfroditeSourceReferenceClass {
      GTypeClass parent_class;
      void (*finalize) (AfroditeSourceReference *self);
};

00063 struct _AfroditeSourceReferencePrivate {
      AfroditeSourceFile* _file;
      gint _first_line;
      gint _last_line;
      gint _first_column;
      gint _last_column;
};

00071 struct _AfroditeParamSpecSourceReference {
      GParamSpec parent_instance;
};


static gpointer afrodite_source_reference_parent_class = NULL;

gpointer afrodite_source_reference_ref (gpointer instance);
void afrodite_source_reference_unref (gpointer instance);
GParamSpec* afrodite_param_spec_source_reference (const gchar* name, const gchar* nick, const gchar* blurb, GType object_type, GParamFlags flags);
void afrodite_value_set_source_reference (GValue* value, gpointer v_object);
void afrodite_value_take_source_reference (GValue* value, gpointer v_object);
gpointer afrodite_value_get_source_reference (const GValue* value);
GType afrodite_source_reference_get_type (void) G_GNUC_CONST;
gpointer afrodite_source_file_ref (gpointer instance);
void afrodite_source_file_unref (gpointer instance);
GParamSpec* afrodite_param_spec_source_file (const gchar* name, const gchar* nick, const gchar* blurb, GType object_type, GParamFlags flags);
void afrodite_value_set_source_file (GValue* value, gpointer v_object);
void afrodite_value_take_source_file (GValue* value, gpointer v_object);
gpointer afrodite_value_get_source_file (const GValue* value);
GType afrodite_source_file_get_type (void) G_GNUC_CONST;
#define AFRODITE_SOURCE_REFERENCE_GET_PRIVATE(o) (G_TYPE_INSTANCE_GET_PRIVATE ((o), AFRODITE_TYPE_SOURCE_REFERENCE, AfroditeSourceReferencePrivate))
enum  {
      AFRODITE_SOURCE_REFERENCE_DUMMY_PROPERTY
};
AfroditeSourceReference* afrodite_source_reference_new (void);
AfroditeSourceReference* afrodite_source_reference_construct (GType object_type);
AfroditeSourceFile* afrodite_source_reference_get_file (AfroditeSourceReference* self);
void afrodite_source_reference_set_file (AfroditeSourceReference* self, AfroditeSourceFile* value);
gint afrodite_source_reference_get_first_line (AfroditeSourceReference* self);
void afrodite_source_reference_set_first_line (AfroditeSourceReference* self, gint value);
gint afrodite_source_reference_get_last_line (AfroditeSourceReference* self);
void afrodite_source_reference_set_last_line (AfroditeSourceReference* self, gint value);
gint afrodite_source_reference_get_first_column (AfroditeSourceReference* self);
void afrodite_source_reference_set_first_column (AfroditeSourceReference* self, gint value);
gint afrodite_source_reference_get_last_column (AfroditeSourceReference* self);
void afrodite_source_reference_set_last_column (AfroditeSourceReference* self, gint value);
static void afrodite_source_reference_finalize (AfroditeSourceReference* obj);



AfroditeSourceReference* afrodite_source_reference_construct (GType object_type) {
      AfroditeSourceReference* self;
      self = (AfroditeSourceReference*) g_type_create_instance (object_type);
      return self;
}


AfroditeSourceReference* afrodite_source_reference_new (void) {
      return afrodite_source_reference_construct (AFRODITE_TYPE_SOURCE_REFERENCE);
}


AfroditeSourceFile* afrodite_source_reference_get_file (AfroditeSourceReference* self) {
      AfroditeSourceFile* result;
      g_return_val_if_fail (self != NULL, NULL);
      result = self->priv->_file;
      return result;
}


void afrodite_source_reference_set_file (AfroditeSourceReference* self, AfroditeSourceFile* value) {
      g_return_if_fail (self != NULL);
      self->priv->_file = value;
}


gint afrodite_source_reference_get_first_line (AfroditeSourceReference* self) {
      gint result;
      g_return_val_if_fail (self != NULL, 0);
      result = self->priv->_first_line;
      return result;
}


void afrodite_source_reference_set_first_line (AfroditeSourceReference* self, gint value) {
      g_return_if_fail (self != NULL);
      self->priv->_first_line = value;
}


gint afrodite_source_reference_get_last_line (AfroditeSourceReference* self) {
      gint result;
      g_return_val_if_fail (self != NULL, 0);
      result = self->priv->_last_line;
      return result;
}


void afrodite_source_reference_set_last_line (AfroditeSourceReference* self, gint value) {
      g_return_if_fail (self != NULL);
      self->priv->_last_line = value;
}


gint afrodite_source_reference_get_first_column (AfroditeSourceReference* self) {
      gint result;
      g_return_val_if_fail (self != NULL, 0);
      result = self->priv->_first_column;
      return result;
}


void afrodite_source_reference_set_first_column (AfroditeSourceReference* self, gint value) {
      g_return_if_fail (self != NULL);
      self->priv->_first_column = value;
}


gint afrodite_source_reference_get_last_column (AfroditeSourceReference* self) {
      gint result;
      g_return_val_if_fail (self != NULL, 0);
      result = self->priv->_last_column;
      return result;
}


void afrodite_source_reference_set_last_column (AfroditeSourceReference* self, gint value) {
      g_return_if_fail (self != NULL);
      self->priv->_last_column = value;
}


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


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


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


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


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


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


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


void afrodite_value_set_source_reference (GValue* value, gpointer v_object) {
      AfroditeSourceReference* old;
      g_return_if_fail (G_TYPE_CHECK_VALUE_TYPE (value, AFRODITE_TYPE_SOURCE_REFERENCE));
      old = value->data[0].v_pointer;
      if (v_object) {
            g_return_if_fail (G_TYPE_CHECK_INSTANCE_TYPE (v_object, AFRODITE_TYPE_SOURCE_REFERENCE));
            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_reference_ref (value->data[0].v_pointer);
      } else {
            value->data[0].v_pointer = NULL;
      }
      if (old) {
            afrodite_source_reference_unref (old);
      }
}


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


static void afrodite_source_reference_class_init (AfroditeSourceReferenceClass * klass) {
      afrodite_source_reference_parent_class = g_type_class_peek_parent (klass);
      AFRODITE_SOURCE_REFERENCE_CLASS (klass)->finalize = afrodite_source_reference_finalize;
      g_type_class_add_private (klass, sizeof (AfroditeSourceReferencePrivate));
}


static void afrodite_source_reference_instance_init (AfroditeSourceReference * self) {
      self->priv = AFRODITE_SOURCE_REFERENCE_GET_PRIVATE (self);
      self->ref_count = 1;
}


static void afrodite_source_reference_finalize (AfroditeSourceReference* obj) {
      AfroditeSourceReference * self;
      self = AFRODITE_SOURCE_REFERENCE (obj);
}


GType afrodite_source_reference_get_type (void) {
      static volatile gsize afrodite_source_reference_type_id__volatile = 0;
      if (g_once_init_enter (&afrodite_source_reference_type_id__volatile)) {
            static const GTypeValueTable g_define_type_value_table = { afrodite_value_source_reference_init, afrodite_value_source_reference_free_value, afrodite_value_source_reference_copy_value, afrodite_value_source_reference_peek_pointer, "p", afrodite_value_source_reference_collect_value, "p", afrodite_value_source_reference_lcopy_value };
            static const GTypeInfo g_define_type_info = { sizeof (AfroditeSourceReferenceClass), (GBaseInitFunc) NULL, (GBaseFinalizeFunc) NULL, (GClassInitFunc) afrodite_source_reference_class_init, (GClassFinalizeFunc) NULL, NULL, sizeof (AfroditeSourceReference), 0, (GInstanceInitFunc) afrodite_source_reference_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_reference_type_id;
            afrodite_source_reference_type_id = g_type_register_fundamental (g_type_fundamental_next (), "AfroditeSourceReference", &g_define_type_info, &g_define_type_fundamental_info, 0);
            g_once_init_leave (&afrodite_source_reference_type_id__volatile, afrodite_source_reference_type_id);
      }
      return afrodite_source_reference_type_id__volatile;
}


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


void afrodite_source_reference_unref (gpointer instance) {
      AfroditeSourceReference* self;
      self = instance;
      if (g_atomic_int_dec_and_test (&self->ref_count)) {
            AFRODITE_SOURCE_REFERENCE_GET_CLASS (self)->finalize (self);
            g_type_free_instance ((GTypeInstance *) self);
      }
}





Generated by  Doxygen 1.6.0   Back to index