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

vbfvariable.c

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

/*
 *  vbfvariable.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_VARIABLE (vbf_variable_get_type ())
#define VBF_VARIABLE(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), VBF_TYPE_VARIABLE, VbfVariable))
#define VBF_VARIABLE_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), VBF_TYPE_VARIABLE, VbfVariableClass))
#define VBF_IS_VARIABLE(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), VBF_TYPE_VARIABLE))
#define VBF_IS_VARIABLE_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), VBF_TYPE_VARIABLE))
#define VBF_VARIABLE_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), VBF_TYPE_VARIABLE, VbfVariableClass))

typedef struct _VbfVariable VbfVariable;
typedef struct _VbfVariableClass VbfVariableClass;
typedef struct _VbfVariablePrivate VbfVariablePrivate;
#define _g_free0(var) (var = (g_free (var), NULL))
#define _g_object_unref0(var) ((var == NULL) ? NULL : (var = (g_object_unref (var), NULL)))
#define _vala_collection_object_unref0(var) ((var == NULL) ? NULL : (var = (vala_collection_object_unref (var), NULL)))

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

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

struct _VbfVariable {
      VbfConfigNode parent_instance;
      VbfVariablePrivate * priv;
      char* name;
      VbfConfigNode* data;
};

struct _VbfVariableClass {
      VbfConfigNodeClass parent_class;
};

00078 struct _VbfVariablePrivate {
      ValaList* childs;
};


static gpointer vbf_variable_parent_class = NULL;

GType vbf_config_node_get_type (void) G_GNUC_CONST;
GType vbf_variable_get_type (void) G_GNUC_CONST;
#define VBF_VARIABLE_GET_PRIVATE(o) (G_TYPE_INSTANCE_GET_PRIVATE ((o), VBF_TYPE_VARIABLE, VbfVariablePrivate))
enum  {
      VBF_VARIABLE_DUMMY_PROPERTY
};
VbfVariable* vbf_variable_new (const char* name, VbfConfigNode* parent);
VbfVariable* vbf_variable_construct (GType object_type, const char* name, VbfConfigNode* parent);
VbfConfigNode* vbf_config_node_construct (GType object_type);
ValaList* vbf_variable_get_childs (VbfVariable* self);
void vbf_variable_add_child (VbfVariable* self, VbfVariable* variable);
static char* vbf_variable_real_to_string (VbfConfigNode* base);
char* vbf_config_node_to_string (VbfConfigNode* self);
VbfConfigNode* vbf_variable_get_value (VbfVariable* self);
static void vbf_variable_finalize (GObject* obj);



VbfVariable* vbf_variable_construct (GType object_type, const char* name, VbfConfigNode* parent) {
      VbfVariable * self;
      char* _tmp0_;
      g_return_val_if_fail (name != NULL, NULL);
      g_return_val_if_fail (parent != NULL, NULL);
      self = (VbfVariable*) vbf_config_node_construct (object_type);
      self->name = (_tmp0_ = g_strdup (name), _g_free0 (self->name), _tmp0_);
      return self;
}


VbfVariable* vbf_variable_new (const char* name, VbfConfigNode* parent) {
      return vbf_variable_construct (VBF_TYPE_VARIABLE, name, parent);
}


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


ValaList* vbf_variable_get_childs (VbfVariable* self) {
      ValaList* result = NULL;
      g_return_val_if_fail (self != NULL, NULL);
      result = _vala_collection_object_ref0 (self->priv->childs);
      return result;
}


void vbf_variable_add_child (VbfVariable* self, VbfVariable* variable) {
      g_return_if_fail (self != NULL);
      g_return_if_fail (variable != NULL);
      vala_collection_add ((ValaCollection*) self->priv->childs, variable);
}


static char* vbf_variable_real_to_string (VbfConfigNode* base) {
      VbfVariable * self;
      char* result = NULL;
      char* res;
      self = (VbfVariable*) base;
      res = NULL;
      if (VBF_IS_VARIABLE (self->data)) {
            char* _tmp0_;
            res = (_tmp0_ = g_strdup_printf ("$(%s)=", self->name), _g_free0 (res), _tmp0_);
      } else {
            char* _tmp1_;
            res = (_tmp1_ = g_strdup_printf ("%s=", self->name), _g_free0 (res), _tmp1_);
      }
      if (self->data == NULL) {
            char* _tmp2_;
            res = (_tmp2_ = g_strconcat (res, "(null)", NULL), _g_free0 (res), _tmp2_);
      } else {
            char* _tmp3_;
            char* _tmp4_;
            res = (_tmp4_ = g_strconcat (res, _tmp3_ = vbf_config_node_to_string (self->data), NULL), _g_free0 (res), _tmp4_);
            _g_free0 (_tmp3_);
      }
      result = res;
      return result;
}


static gpointer _g_object_ref0 (gpointer self) {
      return self ? g_object_ref (self) : NULL;
}


VbfConfigNode* vbf_variable_get_value (VbfVariable* self) {
      VbfConfigNode* result = NULL;
      g_return_val_if_fail (self != NULL, NULL);
      if (VBF_IS_VARIABLE (self->data)) {
            result = vbf_variable_get_value (VBF_VARIABLE (self->data));
            return result;
      } else {
            result = _g_object_ref0 (self->data);
            return result;
      }
}


static void vbf_variable_class_init (VbfVariableClass * klass) {
      vbf_variable_parent_class = g_type_class_peek_parent (klass);
      g_type_class_add_private (klass, sizeof (VbfVariablePrivate));
      VBF_CONFIG_NODE_CLASS (klass)->to_string = vbf_variable_real_to_string;
      G_OBJECT_CLASS (klass)->finalize = vbf_variable_finalize;
}


static void vbf_variable_instance_init (VbfVariable * self) {
      self->priv = VBF_VARIABLE_GET_PRIVATE (self);
      self->data = NULL;
      self->priv->childs = (ValaList*) vala_array_list_new (VBF_TYPE_VARIABLE, NULL, NULL, g_direct_equal);
}


static void vbf_variable_finalize (GObject* obj) {
      VbfVariable * self;
      self = VBF_VARIABLE (obj);
      _g_free0 (self->name);
      _g_object_unref0 (self->data);
      _vala_collection_object_unref0 (self->priv->childs);
      G_OBJECT_CLASS (vbf_variable_parent_class)->finalize (obj);
}


GType vbf_variable_get_type (void) {
      static volatile gsize vbf_variable_type_id__volatile = 0;
      if (g_once_init_enter (&vbf_variable_type_id__volatile)) {
            static const GTypeInfo g_define_type_info = { sizeof (VbfVariableClass), (GBaseInitFunc) NULL, (GBaseFinalizeFunc) NULL, (GClassInitFunc) vbf_variable_class_init, (GClassFinalizeFunc) NULL, NULL, sizeof (VbfVariable), 0, (GInstanceInitFunc) vbf_variable_instance_init, NULL };
            GType vbf_variable_type_id;
            vbf_variable_type_id = g_type_register_static (VBF_TYPE_CONFIG_NODE, "VbfVariable", &g_define_type_info, 0);
            g_once_init_leave (&vbf_variable_type_id__volatile, vbf_variable_type_id);
      }
      return vbf_variable_type_id__volatile;
}





Generated by  Doxygen 1.6.0   Back to index