midgard/midgard_schema.h

00001 /* 
00002  * Copyright (C) 2006 Piotr Pokora <piotr.pokora@infoglob.pl>
00003  *
00004  * This program is free software; you can redistribute it and/or modify it
00005  * under the terms of the GNU Lesser General Public License as published
00006  * by the Free Software Foundation; either version 2 of the License, or
00007  * (at your option) any later version.
00008  * 
00009  * This program is distributed in the hope that it will be useful,
00010  * but WITHOUT ANY WARRANTY; without even the implied warranty of
00011  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
00012  * GNU General Public License for more details.
00013  * 
00014  * You should have received a copy of the GNU General Public License
00015  * along with this program; if not, write to the Free Software
00016  * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
00017  */
00018 
00019 #ifndef MIDGARD_SCHEMA_H
00020 #define MIDGARD_SCHEMA_H
00021 
00022 #include <stdlib.h>
00023 #include <glib.h>
00024 #include <glib-object.h>
00025 
00026 /* Undefine XMLCALL defined in expat library needed by repligard
00027    and already included in midgard.h file. */
00028 #ifdef XMLCALL
00029 #undef XMLCALL
00030 #endif
00031 
00032 extern GType midgard_schema_get_type(void);
00033 
00034 /* convention macros */
00035 #define MIDGARD_TYPE_SCHEMA (midgard_schema_get_type())
00036 #define MIDGARD_SCHEMA(object)  \
00037         (G_TYPE_CHECK_INSTANCE_CAST ((object),MIDGARD_TYPE_SCHEMA, midgard))
00038 #define MIDGARD_SCHEMA_CLASS(klass)  \
00039         (G_TYPE_CHECK_CLASS_CAST ((klass), MIDGARD_TYPE_SCHEMA, MidgardSchemaClass))
00040 #define MIDGARD_IS_SCHEMA(object)   \
00041         (G_TYPE_CHECK_INSTANCE_TYPE ((object), MIDGARD_TYPE_SCHEMA))
00042 #define MIDGARD_IS_SCHEMA_CLASS(klass) \
00043         (G_TYPE_CHECK_CLASS_TYPE ((klass), MIDGARD_TYPE_SCHEMA))
00044 #define MIDGARD_SCHEMA_GET_CLASS(obj) \
00045         (G_TYPE_INSTANCE_GET_CLASS ((obj), MIDGARD_TYPE_SCHEMA, MidgardSchemaClass))
00046 
00047 typedef struct _MidgardSchema MidgardSchema;
00048 typedef struct _MidgardSchemaClass MidgardSchemaClass;
00049 
00050 
00051 typedef struct _MgdSchema MgdSchema; 
00052 
00053 /* FIXME , move MgdSchema structure to source file */
00054 struct _MgdSchema {
00055         GHashTable *types;
00056 };
00057 
00058 
00069 struct _MidgardSchema {
00070         GObject parent;
00071 
00072         /* < private > */
00073         GHashTable *types;
00074 };
00075 
00082 struct _MidgardSchemaClass{
00083         GObjectClass parent;
00084 
00085         /* < public > */
00086         void      (*init) (MidgardSchema *self);
00087         gboolean  (*read_dir) (MidgardSchema *self, const gchar *dirname);
00088         void      (*read_file) (MidgardSchema *self, const gchar *filename);    
00089         gboolean  (*type_exists) (MidgardSchema *self, const gchar *classname);
00090 };
00091 
00106 extern void midgard_schema_init(MidgardSchema *self);
00107 
00124 extern gboolean midgard_schema_read_dir(MidgardSchema *self, const gchar *dirname);
00125 
00136 extern gboolean midgard_schema_type_exists(MidgardSchema *self, const gchar *classname);
00137 
00150 extern void midgard_schema_read_file(MidgardSchema *self, const gchar *filename);
00151 
00152 #endif /* MIDGARD_SCHEMA_H */

Generated on Thu Feb 22 06:15:14 2007 for midgard-core by  doxygen 1.4.6