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

vbfconfignodelist.c

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

/*
 *  vbfconfignodelist.vala - Vala Build Framework library
 *  
 *  Copyright (C) 2008 - Andrea Del Signore <sejerpz@tin.it>
 *  
 *  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., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301  USA
 */

#include <glib.h>
#include <glib-object.h>
#include <stdlib.h>
#include <string.h>
#include <valagee.h>


#define VBF_TYPE_CONFIG_NODE (vbf_config_node_get_type ())
#define VBF_CONFIG_NODE(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), VBF_TYPE_CONFIG_NODE, VbfConfigNode))
#define VBF_CONFIG_NODE_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), VBF_TYPE_CONFIG_NODE, VbfConfigNodeClass))
#define VBF_IS_CONFIG_NODE(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), VBF_TYPE_CONFIG_NODE))
#define VBF_IS_CONFIG_NODE_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), VBF_TYPE_CONFIG_NODE))
#define VBF_CONFIG_NODE_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), VBF_TYPE_CONFIG_NODE, VbfConfigNodeClass))

typedef struct _VbfConfigNode VbfConfigNode;
typedef struct _VbfConfigNodeClass VbfConfigNodeClass;
typedef struct _VbfConfigNodePrivate VbfConfigNodePrivate;

#define VBF_TYPE_CONFIG_NODE_LIST (vbf_config_node_list_get_type ())
#define VBF_CONFIG_NODE_LIST(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), VBF_TYPE_CONFIG_NODE_LIST, VbfConfigNodeList))
#define VBF_CONFIG_NODE_LIST_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), VBF_TYPE_CONFIG_NODE_LIST, VbfConfigNodeListClass))
#define VBF_IS_CONFIG_NODE_LIST(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), VBF_TYPE_CONFIG_NODE_LIST))
#define VBF_IS_CONFIG_NODE_LIST_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), VBF_TYPE_CONFIG_NODE_LIST))
#define VBF_CONFIG_NODE_LIST_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), VBF_TYPE_CONFIG_NODE_LIST, VbfConfigNodeListClass))

typedef struct _VbfConfigNodeList VbfConfigNodeList;
typedef struct _VbfConfigNodeListClass VbfConfigNodeListClass;
typedef struct _VbfConfigNodeListPrivate VbfConfigNodeListPrivate;
#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 _g_object_unref0(var) ((var == NULL) ? NULL : (var = (g_object_unref (var), NULL)))

struct _VbfConfigNode {
      GObject parent_instance;
      VbfConfigNodePrivate * priv;
      VbfConfigNode* parent;
};

struct _VbfConfigNodeClass {
      GObjectClass parent_class;
      char* (*to_string) (VbfConfigNode* self);
};

struct _VbfConfigNodeList {
      VbfConfigNode parent_instance;
      VbfConfigNodeListPrivate * priv;
      ValaList* values;
};

struct _VbfConfigNodeListClass {
      VbfConfigNodeClass parent_class;
};


static gpointer vbf_config_node_list_parent_class = NULL;

GType vbf_config_node_get_type (void) G_GNUC_CONST;
GType vbf_config_node_list_get_type (void) G_GNUC_CONST;
enum  {
      VBF_CONFIG_NODE_LIST_DUMMY_PROPERTY
};
ValaList* vbf_config_node_list_get_values (VbfConfigNodeList* self);
void vbf_config_node_list_add_value (VbfConfigNodeList* self, VbfConfigNode* val);
void vbf_config_node_list_replace_config_node (VbfConfigNodeList* self, VbfConfigNode* source, VbfConfigNode* target);
static char* vbf_config_node_list_real_to_string (VbfConfigNode* base);
char* vbf_config_node_to_string (VbfConfigNode* self);
VbfConfigNodeList* vbf_config_node_list_new (void);
VbfConfigNodeList* vbf_config_node_list_construct (GType object_type);
VbfConfigNode* vbf_config_node_construct (GType object_type);
static void vbf_config_node_list_finalize (GObject* obj);



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


ValaList* vbf_config_node_list_get_values (VbfConfigNodeList* self) {
      ValaList* result = NULL;
      g_return_val_if_fail (self != NULL, NULL);
      result = _vala_collection_object_ref0 (self->values);
      return result;
}


void vbf_config_node_list_add_value (VbfConfigNodeList* self, VbfConfigNode* val) {
      g_return_if_fail (self != NULL);
      g_return_if_fail (val != NULL);
      vala_collection_add ((ValaCollection*) self->values, val);
}


void vbf_config_node_list_replace_config_node (VbfConfigNodeList* self, VbfConfigNode* source, VbfConfigNode* target) {
      g_return_if_fail (self != NULL);
      g_return_if_fail (source != NULL);
      g_return_if_fail (target != NULL);
      if (vala_collection_contains ((ValaCollection*) self->values, source)) {
            vala_collection_remove ((ValaCollection*) self->values, source);
            if (target != NULL) {
                  vala_collection_add ((ValaCollection*) self->values, target);
            }
      }
}


static glong string_get_length (const char* self) {
      glong result;
      g_return_val_if_fail (self != NULL, 0L);
      result = g_utf8_strlen (self, (gssize) (-1));
      return result;
}


static char* string_substring (const char* self, glong offset, glong len) {
      char* result = NULL;
      glong string_length;
      const char* start;
      g_return_val_if_fail (self != NULL, NULL);
      string_length = string_get_length (self);
      if (offset < 0) {
            offset = string_length + offset;
            g_return_val_if_fail (offset >= 0, NULL);
      } else {
            g_return_val_if_fail (offset <= string_length, NULL);
      }
      if (len < 0) {
            len = string_length - offset;
      }
      g_return_val_if_fail ((offset + len) <= string_length, NULL);
      start = g_utf8_offset_to_pointer (self, offset);
      result = g_strndup (start, ((gchar*) g_utf8_offset_to_pointer (start, len)) - ((gchar*) start));
      return result;
}


static char* vbf_config_node_list_real_to_string (VbfConfigNode* base) {
      VbfConfigNodeList * self;
      char* result = NULL;
      char* res;
      self = (VbfConfigNodeList*) base;
      res = g_strdup ("");
      {
            ValaIterator* _item_it;
            _item_it = vala_iterable_iterator ((ValaIterable*) self->values);
            while (TRUE) {
                  VbfConfigNode* item;
                  if (!vala_iterator_next (_item_it)) {
                        break;
                  }
                  item = (VbfConfigNode*) vala_iterator_get (_item_it);
                  if (item != NULL) {
                        char* _tmp0_;
                        char* _tmp1_;
                        char* _tmp2_;
                        res = (_tmp2_ = g_strconcat (res, _tmp1_ = g_strdup_printf ("%s, ", _tmp0_ = vbf_config_node_to_string (item)), NULL), _g_free0 (res), _tmp2_);
                        _g_free0 (_tmp1_);
                        _g_free0 (_tmp0_);
                  } else {
                        g_critical ("vbfconfignodelist.vala:56: item is null");
                  }
                  _g_object_unref0 (item);
            }
            _vala_collection_object_unref0 (_item_it);
      }
      if (string_get_length (res) > 2) {
            char* _tmp3_;
            res = (_tmp3_ = string_substring (res, (glong) 0, string_get_length (res) - 2), _g_free0 (res), _tmp3_);
      }
      result = res;
      return result;
}


VbfConfigNodeList* vbf_config_node_list_construct (GType object_type) {
      VbfConfigNodeList * self;
      self = (VbfConfigNodeList*) vbf_config_node_construct (object_type);
      return self;
}


VbfConfigNodeList* vbf_config_node_list_new (void) {
      return vbf_config_node_list_construct (VBF_TYPE_CONFIG_NODE_LIST);
}


static void vbf_config_node_list_class_init (VbfConfigNodeListClass * klass) {
      vbf_config_node_list_parent_class = g_type_class_peek_parent (klass);
      VBF_CONFIG_NODE_CLASS (klass)->to_string = vbf_config_node_list_real_to_string;
      G_OBJECT_CLASS (klass)->finalize = vbf_config_node_list_finalize;
}


static void vbf_config_node_list_instance_init (VbfConfigNodeList * self) {
      self->values = (ValaList*) vala_array_list_new (VBF_TYPE_CONFIG_NODE, (GBoxedCopyFunc) g_object_ref, g_object_unref, g_direct_equal);
}


static void vbf_config_node_list_finalize (GObject* obj) {
      VbfConfigNodeList * self;
      self = VBF_CONFIG_NODE_LIST (obj);
      _vala_collection_object_unref0 (self->values);
      G_OBJECT_CLASS (vbf_config_node_list_parent_class)->finalize (obj);
}


GType vbf_config_node_list_get_type (void) {
      static volatile gsize vbf_config_node_list_type_id__volatile = 0;
      if (g_once_init_enter (&vbf_config_node_list_type_id__volatile)) {
            static const GTypeInfo g_define_type_info = { sizeof (VbfConfigNodeListClass), (GBaseInitFunc) NULL, (GBaseFinalizeFunc) NULL, (GClassInitFunc) vbf_config_node_list_class_init, (GClassFinalizeFunc) NULL, NULL, sizeof (VbfConfigNodeList), 0, (GInstanceInitFunc) vbf_config_node_list_instance_init, NULL };
            GType vbf_config_node_list_type_id;
            vbf_config_node_list_type_id = g_type_register_static (VBF_TYPE_CONFIG_NODE, "VbfConfigNodeList", &g_define_type_info, 0);
            g_once_init_leave (&vbf_config_node_list_type_id__volatile, vbf_config_node_list_type_id);
      }
      return vbf_config_node_list_type_id__volatile;
}





Generated by  Doxygen 1.6.0   Back to index