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

sourcefile.c

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

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


#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 _AfroditeSourceFilePrivate AfroditeSourceFilePrivate;

#define AFRODITE_TYPE_DATA_TYPE (afrodite_data_type_get_type ())
#define AFRODITE_DATA_TYPE(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), AFRODITE_TYPE_DATA_TYPE, AfroditeDataType))
#define AFRODITE_DATA_TYPE_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), AFRODITE_TYPE_DATA_TYPE, AfroditeDataTypeClass))
#define AFRODITE_IS_DATA_TYPE(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), AFRODITE_TYPE_DATA_TYPE))
#define AFRODITE_IS_DATA_TYPE_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), AFRODITE_TYPE_DATA_TYPE))
#define AFRODITE_DATA_TYPE_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), AFRODITE_TYPE_DATA_TYPE, AfroditeDataTypeClass))

typedef struct _AfroditeDataType AfroditeDataType;
typedef struct _AfroditeDataTypeClass AfroditeDataTypeClass;

#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 _vala_collection_object_unref0(var) ((var == NULL) ? NULL : (var = (vala_collection_object_unref (var), NULL)))
#define _g_free0(var) (var = (g_free (var), NULL))
#define _afrodite_data_type_unref0(var) ((var == NULL) ? NULL : (var = (afrodite_data_type_unref (var), NULL)))
typedef struct _AfroditeParamSpecSourceFile AfroditeParamSpecSourceFile;

struct _AfroditeSourceFile {
      GTypeInstance parent_instance;
      volatile int ref_count;
      AfroditeSourceFilePrivate * priv;
};

struct _AfroditeSourceFileClass {
      GTypeClass parent_class;
      void (*finalize) (AfroditeSourceFile *self);
};

00079 struct _AfroditeSourceFilePrivate {
      ValaList* _using_directives;
      ValaList* _symbols;
      char* _filename;
};

00085 struct _AfroditeParamSpecSourceFile {
      GParamSpec parent_instance;
};


static gpointer afrodite_source_file_parent_class = NULL;

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;
gpointer afrodite_data_type_ref (gpointer instance);
void afrodite_data_type_unref (gpointer instance);
GParamSpec* afrodite_param_spec_data_type (const gchar* name, const gchar* nick, const gchar* blurb, GType object_type, GParamFlags flags);
void afrodite_value_set_data_type (GValue* value, gpointer v_object);
void afrodite_value_take_data_type (GValue* value, gpointer v_object);
gpointer afrodite_value_get_data_type (const GValue* value);
GType afrodite_data_type_get_type (void) G_GNUC_CONST;
GType afrodite_symbol_get_type (void) G_GNUC_CONST;
#define AFRODITE_SOURCE_FILE_GET_PRIVATE(o) (G_TYPE_INSTANCE_GET_PRIVATE ((o), AFRODITE_TYPE_SOURCE_FILE, AfroditeSourceFilePrivate))
enum  {
      AFRODITE_SOURCE_FILE_DUMMY_PROPERTY
};
AfroditeSourceFile* afrodite_source_file_new (const char* filename);
AfroditeSourceFile* afrodite_source_file_construct (GType object_type, const char* filename);
void afrodite_source_file_set_filename (AfroditeSourceFile* self, const char* value);
AfroditeDataType* afrodite_source_file_add_using_directive (AfroditeSourceFile* self, const char* name);
AfroditeDataType* afrodite_source_file_lookup_using_directive (AfroditeSourceFile* self, const char* name);
ValaList* afrodite_source_file_get_using_directives (AfroditeSourceFile* self);
void afrodite_source_file_set_using_directives (AfroditeSourceFile* self, ValaList* value);
AfroditeDataType* afrodite_data_type_new (const char* type_name, const char* name);
AfroditeDataType* afrodite_data_type_construct (GType object_type, const char* type_name, const char* name);
const char* afrodite_data_type_get_type_name (AfroditeDataType* self);
void afrodite_source_file_remove_using_directive (AfroditeSourceFile* self, const char* name);
void afrodite_source_file_add_symbol (AfroditeSourceFile* self, AfroditeSymbol* symbol);
ValaList* afrodite_source_file_get_symbols (AfroditeSourceFile* self);
void afrodite_source_file_set_symbols (AfroditeSourceFile* self, ValaList* value);
void afrodite_source_file_remove_symbol (AfroditeSourceFile* self, AfroditeSymbol* symbol);
const char* afrodite_source_file_get_filename (AfroditeSourceFile* self);
gboolean afrodite_source_file_get_has_using_directives (AfroditeSourceFile* self);
gboolean afrodite_source_file_get_has_symbols (AfroditeSourceFile* self);
static void afrodite_source_file_finalize (AfroditeSourceFile* obj);
static int _vala_strcmp0 (const char * str1, const char * str2);



AfroditeSourceFile* afrodite_source_file_construct (GType object_type, const char* filename) {
      AfroditeSourceFile* self;
      g_return_val_if_fail (filename != NULL, NULL);
      self = (AfroditeSourceFile*) g_type_create_instance (object_type);
      afrodite_source_file_set_filename (self, filename);
      return self;
}


AfroditeSourceFile* afrodite_source_file_new (const char* filename) {
      return afrodite_source_file_construct (AFRODITE_TYPE_SOURCE_FILE, filename);
}


AfroditeDataType* afrodite_source_file_add_using_directive (AfroditeSourceFile* self, const char* name) {
      AfroditeDataType* result = NULL;
      AfroditeDataType* u;
      g_return_val_if_fail (self != NULL, NULL);
      g_return_val_if_fail (name != NULL, NULL);
      u = afrodite_source_file_lookup_using_directive (self, name);
      if (u == NULL) {
            AfroditeDataType* _tmp1_;
            if (self->priv->_using_directives == NULL) {
                  ValaArrayList* _tmp0_;
                  afrodite_source_file_set_using_directives (self, (ValaList*) (_tmp0_ = vala_array_list_new (AFRODITE_TYPE_DATA_TYPE, (GBoxedCopyFunc) afrodite_data_type_ref, afrodite_data_type_unref, g_direct_equal)));
                  _vala_collection_object_unref0 (_tmp0_);
            }
            u = (_tmp1_ = afrodite_data_type_new (name, "UsingDirective"), _afrodite_data_type_unref0 (u), _tmp1_);
            vala_collection_add ((ValaCollection*) self->priv->_using_directives, u);
      }
      result = u;
      return result;
}


AfroditeDataType* afrodite_source_file_lookup_using_directive (AfroditeSourceFile* self, const char* name) {
      AfroditeDataType* result = NULL;
      g_return_val_if_fail (self != NULL, NULL);
      g_return_val_if_fail (name != NULL, NULL);
      if (self->priv->_using_directives != NULL) {
            {
                  ValaIterator* _u_it;
                  _u_it = vala_iterable_iterator ((ValaIterable*) self->priv->_using_directives);
                  while (TRUE) {
                        AfroditeDataType* u;
                        if (!vala_iterator_next (_u_it)) {
                              break;
                        }
                        u = (AfroditeDataType*) vala_iterator_get (_u_it);
                        if (_vala_strcmp0 (afrodite_data_type_get_type_name (u), name) == 0) {
                              result = u;
                              _vala_collection_object_unref0 (_u_it);
                              return result;
                        }
                        _afrodite_data_type_unref0 (u);
                  }
                  _vala_collection_object_unref0 (_u_it);
            }
      }
      result = NULL;
      return result;
}


void afrodite_source_file_remove_using_directive (AfroditeSourceFile* self, const char* name) {
      AfroditeDataType* u;
      g_return_if_fail (self != NULL);
      g_return_if_fail (name != NULL);
      u = afrodite_source_file_lookup_using_directive (self, name);
      if (u != NULL) {
            vala_collection_remove ((ValaCollection*) self->priv->_using_directives, u);
            if (vala_collection_get_size ((ValaCollection*) self->priv->_using_directives) == 0) {
                  afrodite_source_file_set_using_directives (self, NULL);
            }
      }
      _afrodite_data_type_unref0 (u);
}


void afrodite_source_file_add_symbol (AfroditeSourceFile* self, AfroditeSymbol* symbol) {
      g_return_if_fail (self != NULL);
      g_return_if_fail (symbol != NULL);
      if (self->priv->_symbols == NULL) {
            ValaArrayList* _tmp0_;
            afrodite_source_file_set_symbols (self, (ValaList*) (_tmp0_ = vala_array_list_new (AFRODITE_TYPE_SYMBOL, (GBoxedCopyFunc) g_object_ref, g_object_unref, g_direct_equal)));
            _vala_collection_object_unref0 (_tmp0_);
      }
      vala_collection_add ((ValaCollection*) self->priv->_symbols, symbol);
}


void afrodite_source_file_remove_symbol (AfroditeSourceFile* self, AfroditeSymbol* symbol) {
      g_return_if_fail (self != NULL);
      g_return_if_fail (symbol != NULL);
      vala_collection_remove ((ValaCollection*) self->priv->_symbols, symbol);
      if (vala_collection_get_size ((ValaCollection*) self->priv->_symbols) == 0) {
            afrodite_source_file_set_symbols (self, NULL);
      }
}


ValaList* afrodite_source_file_get_using_directives (AfroditeSourceFile* self) {
      ValaList* result;
      g_return_val_if_fail (self != NULL, NULL);
      result = self->priv->_using_directives;
      return result;
}


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


void afrodite_source_file_set_using_directives (AfroditeSourceFile* self, ValaList* value) {
      ValaList* _tmp0_;
      g_return_if_fail (self != NULL);
      self->priv->_using_directives = (_tmp0_ = _vala_collection_object_ref0 (value), _vala_collection_object_unref0 (self->priv->_using_directives), _tmp0_);
}


ValaList* afrodite_source_file_get_symbols (AfroditeSourceFile* self) {
      ValaList* result;
      g_return_val_if_fail (self != NULL, NULL);
      result = self->priv->_symbols;
      return result;
}


void afrodite_source_file_set_symbols (AfroditeSourceFile* self, ValaList* value) {
      ValaList* _tmp0_;
      g_return_if_fail (self != NULL);
      self->priv->_symbols = (_tmp0_ = _vala_collection_object_ref0 (value), _vala_collection_object_unref0 (self->priv->_symbols), _tmp0_);
}


const char* afrodite_source_file_get_filename (AfroditeSourceFile* self) {
      const char* result;
      g_return_val_if_fail (self != NULL, NULL);
      result = self->priv->_filename;
      return result;
}


void afrodite_source_file_set_filename (AfroditeSourceFile* self, const char* value) {
      char* _tmp0_;
      g_return_if_fail (self != NULL);
      self->priv->_filename = (_tmp0_ = g_strdup (value), _g_free0 (self->priv->_filename), _tmp0_);
}


gboolean afrodite_source_file_get_has_using_directives (AfroditeSourceFile* self) {
      gboolean result;
      g_return_val_if_fail (self != NULL, FALSE);
      result = self->priv->_using_directives != NULL;
      return result;
}


gboolean afrodite_source_file_get_has_symbols (AfroditeSourceFile* self) {
      gboolean result;
      g_return_val_if_fail (self != NULL, FALSE);
      result = self->priv->_symbols != NULL;
      return result;
}


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


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


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


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


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


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


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


void afrodite_value_set_source_file (GValue* value, gpointer v_object) {
      AfroditeSourceFile* old;
      g_return_if_fail (G_TYPE_CHECK_VALUE_TYPE (value, AFRODITE_TYPE_SOURCE_FILE));
      old = value->data[0].v_pointer;
      if (v_object) {
            g_return_if_fail (G_TYPE_CHECK_INSTANCE_TYPE (v_object, AFRODITE_TYPE_SOURCE_FILE));
            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_file_ref (value->data[0].v_pointer);
      } else {
            value->data[0].v_pointer = NULL;
      }
      if (old) {
            afrodite_source_file_unref (old);
      }
}


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


static void afrodite_source_file_class_init (AfroditeSourceFileClass * klass) {
      afrodite_source_file_parent_class = g_type_class_peek_parent (klass);
      AFRODITE_SOURCE_FILE_CLASS (klass)->finalize = afrodite_source_file_finalize;
      g_type_class_add_private (klass, sizeof (AfroditeSourceFilePrivate));
}


static void afrodite_source_file_instance_init (AfroditeSourceFile * self) {
      self->priv = AFRODITE_SOURCE_FILE_GET_PRIVATE (self);
      self->ref_count = 1;
}


static void afrodite_source_file_finalize (AfroditeSourceFile* obj) {
      AfroditeSourceFile * self;
      self = AFRODITE_SOURCE_FILE (obj);
      _vala_collection_object_unref0 (self->priv->_using_directives);
      _vala_collection_object_unref0 (self->priv->_symbols);
      _g_free0 (self->priv->_filename);
}


GType afrodite_source_file_get_type (void) {
      static volatile gsize afrodite_source_file_type_id__volatile = 0;
      if (g_once_init_enter (&afrodite_source_file_type_id__volatile)) {
            static const GTypeValueTable g_define_type_value_table = { afrodite_value_source_file_init, afrodite_value_source_file_free_value, afrodite_value_source_file_copy_value, afrodite_value_source_file_peek_pointer, "p", afrodite_value_source_file_collect_value, "p", afrodite_value_source_file_lcopy_value };
            static const GTypeInfo g_define_type_info = { sizeof (AfroditeSourceFileClass), (GBaseInitFunc) NULL, (GBaseFinalizeFunc) NULL, (GClassInitFunc) afrodite_source_file_class_init, (GClassFinalizeFunc) NULL, NULL, sizeof (AfroditeSourceFile), 0, (GInstanceInitFunc) afrodite_source_file_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_file_type_id;
            afrodite_source_file_type_id = g_type_register_fundamental (g_type_fundamental_next (), "AfroditeSourceFile", &g_define_type_info, &g_define_type_fundamental_info, 0);
            g_once_init_leave (&afrodite_source_file_type_id__volatile, afrodite_source_file_type_id);
      }
      return afrodite_source_file_type_id__volatile;
}


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


void afrodite_source_file_unref (gpointer instance) {
      AfroditeSourceFile* self;
      self = instance;
      if (g_atomic_int_dec_and_test (&self->ref_count)) {
            AFRODITE_SOURCE_FILE_GET_CLASS (self)->finalize (self);
            g_type_free_instance ((GTypeInstance *) self);
      }
}


static int _vala_strcmp0 (const char * str1, const char * str2) {
      if (str1 == NULL) {
            return -(str1 != str2);
      }
      if (str2 == NULL) {
            return str1 != str2;
      }
      return strcmp (str1, str2);
}





Generated by  Doxygen 1.6.0   Back to index