MidgardSchemaObjectFactory

MidgardSchemaObjectFactory

Synopsis

#include <midgard/midgard.h>

struct              MidgardSchema;
struct              MidgardSchemaClass;
void                midgard_schema_init                 (MidgardSchema *self,
                                                         const gchar *path);
gboolean            midgard_schema_read_dir             (MidgardSchema *self,
                                                         const gchar *dirname);
gboolean            midgard_schema_type_exists          (MidgardSchema *self,
                                                         const gchar *classname);
void                midgard_schema_read_file            (MidgardSchema *self,
                                                         const gchar *filename);

Object Hierarchy

  GObject
   +----MidgardSchema

Description

Details

struct MidgardSchema

struct MidgardSchema;


struct MidgardSchemaClass

struct MidgardSchemaClass {
	GObjectClass parent;
};


midgard_schema_init ()

void                midgard_schema_init                 (MidgardSchema *self,
                                                         const gchar *path);

Reads xml file which defines very basic and common classes. By default it's `/usr/local/share/midgard/MidgardObjects.xml` file.

self :

MidgardSchema instance

path :

full path to a xml file with common classes

midgard_schema_read_dir ()

gboolean            midgard_schema_read_dir             (MidgardSchema *self,
                                                         const gchar *dirname);

This function expects 'schema' subdirectory at least. 'views' subdirectory is optional, and if missed, won't be read. midgard_schema_read_file() is invoked for every valid xml MgdSchema file found in 'schema' subdirectory found in given directory.

You can also use explicit NULL instead of directory path. In such case, MIDGARD_ENV_GLOBAL_SHAREDIR environment variable is checked. If it's not set, directory path is determined using prefix set for compile and build time.

self :

MidgardSchema instance

dirname :

a directory with 'schema' and 'views' subdirectories.

Returns :

TRUE if files has been read, FALSE otherwise

midgard_schema_type_exists ()

gboolean            midgard_schema_type_exists          (MidgardSchema *self,
                                                         const gchar *classname);

self :

MidgardSchema instance

classname :

GObjectClass derived class name

Returns :

TRUE if class is registered as MidgardObjectClass derived, FALSE otherwise

midgard_schema_read_file ()

void                midgard_schema_read_file            (MidgardSchema *self,
                                                         const gchar *filename);

Reads file at given path and initialize all MidgardObjectClass derived classes defined in this file. Also reads all files which are included in this file. Such files are read and parsed when given file is already parsed and all classes defined in given file are already registered in GType system.

self :

MidgardSchema instance

filename :

full path to a file