1 /* -*- Mode: C; indent-tabs-mode: t; c-basic-offset: 4; tab-width: 4; coding: utf-8 -*- */ 2 /* amp-node.h 3 * 4 * Copyright (C) 2010 Sébastien Granjoux 5 * 6 * This program is free software; you can redistribute it and/or 7 * modify it under the terms of the GNU General Public License as 8 * published by the Free Software Foundation; either version 2 of the 9 * License, or (at your option) any later version. 10 * 11 * This program is distributed in the hope that it will be useful, 12 * but WITHOUT ANY WARRANTY; without even the implied warranty of 13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 14 * General Public License for more details. 15 * 16 * You should have received a copy of the GNU General Public 17 * License along with this program; if not, write to the 18 * Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, 19 * Boston, MA 02110-1301, USA. 20 */ 21 22 #ifndef _AMP_NODE_H_ 23 #define _AMP_NODE_H_ 24 25 #include <glib-object.h> 26 27 #include <libanjuta/anjuta-project.h> 28 #include <libanjuta/anjuta-token.h> 29 #include <libanjuta/anjuta-token-file.h> 30 31 G_BEGIN_DECLS 32 33 /* Type macros 34 *---------------------------------------------------------------------------*/ 35 36 #define AMP_TYPE_NODE (amp_node_get_type ()) 37 #define AMP_NODE(object) (G_TYPE_CHECK_INSTANCE_CAST ((object), AMP_TYPE_NODE, AmpNode)) 38 #define AMP_NODE_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), AMP_TYPE_NODE, AmpNodeClass)) 39 #define AMP_IS_NODE(object) (G_TYPE_CHECK_INSTANCE_TYPE ((object), AMP_TYPE_NODE)) 40 #define AMP_IS_NODE_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), AMP_TYPE_NODE)) 41 #define AMP_NODE_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), AMP_TYPE_NODE, AmpNodeClass)) 42 43 44 typedef struct _AmpNode AmpNode; 45 typedef struct _AmpNodeClass AmpNodeClass; 46 47 typedef struct _AmpProject AmpProject; 48 49 /** 50 * AmpNode: 51 * 52 * An object representing a autotool project node, by example a directory, a target or a source file. 53 */ 54 struct _AmpNode 55 { 56 AnjutaProjectNode parent; 57 }; 58 59 struct _AmpNodeClass 60 { 61 AnjutaProjectNodeClass parent_class; 62 63 gboolean (*load) (AmpNode *node, 64 AmpNode *parent, 65 AmpProject *project, 66 GError **error); 67 68 gboolean (*save) (AmpNode *node, 69 AmpNode *parent, 70 AmpProject *project, 71 GError **error); 72 73 gboolean (*update) (AmpNode *node, 74 AmpNode *parent); 75 76 AmpNode* (*copy) (AmpNode *node); 77 78 gboolean (*erase) (AmpNode *node, 79 AmpNode *parent, 80 AmpProject *project, 81 GError **error); 82 83 gboolean (*write) (AmpNode *node, 84 AmpNode *parent, 85 AmpProject *project, 86 GError **error); 87 }; 88 89 GType amp_node_get_type (void) G_GNUC_CONST; 90 91 92 void amp_set_error (GError **error, gint code, const gchar *message); 93 94 95 AnjutaProjectNode * amp_node_new_valid (AnjutaProjectNode *parent, 96 AnjutaProjectNodeType type, 97 GFile *file, 98 const gchar *name, 99 GError **error); 100 101 AnjutaProjectNode * amp_node_new_valid (AnjutaProjectNode *parent, 102 AnjutaProjectNodeType type, 103 GFile *file, 104 const gchar *name, 105 GError **error); 106 107 gboolean amp_node_load (AmpNode *node, 108 AmpNode *parent, 109 AmpProject *project, 110 GError **error); 111 112 gboolean amp_node_save (AmpNode *node, 113 AmpNode *parent, 114 AmpProject *project, 115 GError **error); 116 117 gboolean amp_node_update (AmpNode *node, 118 AmpNode *new_node); 119 120 AmpNode* amp_node_copy (AmpNode *node); 121 122 gboolean amp_node_write (AmpNode *node, 123 AmpNode *parent, 124 AmpProject *project, 125 GError **error); 126 127 gboolean amp_node_erase (AmpNode *node, 128 AmpNode *parent, 129 AmpProject *project, 130 GError **error); 131 132 void amp_node_register (GTypeModule *module); 133 134 G_END_DECLS 135 136 #endif /* _AMP_NODE_H_ */ 137