MidgardReflectorProperty

MidgardReflectorProperty — Provides reflection routines for properties registered for MidgardDBObject derived classes.

Synopsis

#include <midgard/midgard.h>

struct              MidgardReflectorProperty;
MidgardReflectorProperty * midgard_reflector_property_new
                                                        (const gchar *classname);
GType               midgard_reflector_property_get_midgard_type
                                                        (MidgardReflectorProperty *self,
                                                         const gchar *propname);
gboolean            midgard_reflector_property_is_link  (MidgardReflectorProperty *self,
                                                         const gchar *propname);
gboolean            midgard_reflector_property_is_linked
                                                        (MidgardReflectorProperty *self,
                                                         const gchar *propname);
const MidgardDBObjectClass * midgard_reflector_property_get_link_class
                                                        (MidgardReflectorProperty *self,
                                                         const gchar *propname);
const gchar *       midgard_reflector_property_get_link_name
                                                        (MidgardReflectorProperty *self,
                                                         const gchar *propname);
const gchar *       midgard_reflector_property_get_link_target
                                                        (MidgardReflectorProperty *self,
                                                         const gchar *propname);
const gchar *       midgard_reflector_property_description
                                                        (MidgardReflectorProperty *self,
                                                         const gchar *propname);
const gchar *       midgard_reflector_property_get_user_value
                                                        (MidgardReflectorProperty *self,
                                                         const gchar *property,
                                                         const gchar *name);
gboolean            midgard_reflector_property_is_private
                                                        (MidgardReflectorProperty *self,
                                                         const gchar *property);
gboolean            midgard_reflector_property_is_unique
                                                        (MidgardReflectorProperty *self,
                                                         const gchar *property);
gboolean            midgard_reflector_property_is_primary
                                                        (MidgardReflectorProperty *self,
                                                         const gchar *property);
gboolean            midgard_reflector_property_has_default_value
                                                        (MidgardReflectorProperty *self,
                                                         const gchar *property);
GValue *            midgard_reflector_property_get_default_value
                                                        (MidgardReflectorProperty *self,
                                                         const gchar *property);

Object Hierarchy

  GObject
   +----MidgardReflectorProperty

Properties

  "dbclass"                  gchar*                : Write / Construct Only

Description

Main purpose of this class is to provide reflection routines for any MidgardDBObject derived class' properties. Mainly, it's most usable for Midgard Schema classes defined in xml files (MidgardObject derived), but of course properties of any class which extends Midgard Schema one may be also reflected with MidgardReflectorProperty.

Details

struct MidgardReflectorProperty

struct MidgardReflectorProperty;


midgard_reflector_property_new ()

MidgardReflectorProperty * midgard_reflector_property_new
                                                        (const gchar *classname);

classname :

Name of MidgardDBObject (or derived) class. [in]

Returns :

newly initialized MidgardReflectorProperty instance or NULL on failure. [transfer full]

Since 10.05


midgard_reflector_property_get_midgard_type ()

GType               midgard_reflector_property_get_midgard_type
                                                        (MidgardReflectorProperty *self,
                                                         const gchar *propname);

self :

MidgardReflectorProperty instance

propname :

property name which is registered for MidgardDBObjectClass

Returns :

type (GType) of the property or NULL if property is not registered for given class.

Since 10.05


midgard_reflector_property_is_link ()

gboolean            midgard_reflector_property_is_link  (MidgardReflectorProperty *self,
                                                         const gchar *propname);

Checks whether property is a link.

self :

MidgardReflectorProperty instance

propname :

property name

Returns :

TRUE if property is registered as link, FALSE otherwise (or in case if property is not registered for given class.

Since 10.05


midgard_reflector_property_is_linked ()

gboolean            midgard_reflector_property_is_linked
                                                        (MidgardReflectorProperty *self,
                                                         const gchar *propname);

Checks if property is linked with another type.

self :

MidgardReflectorProperty instance

propname :

property name

Returns :

TRUE if property is linked with another type (property of another class is defined as a link to given one). FALSE is returned if property is not linked or is not registered for given class.

Since 10.05


midgard_reflector_property_get_link_class ()

const MidgardDBObjectClass * midgard_reflector_property_get_link_class
                                                        (MidgardReflectorProperty *self,
                                                         const gchar *propname);

self :

MidgardReflectorProperty instance

propname :

property name

Returns :

the pointer to the MidgardDBObjectClass, a given property is a link to. see midgard_reflector_property_get_link_name()

Since 10.05


midgard_reflector_property_get_link_name ()

const gchar *       midgard_reflector_property_get_link_name
                                                        (MidgardReflectorProperty *self,
                                                         const gchar *propname);

self :

MidgardReflectorProperty instance

propname :

property name

Returns :

The name of the class, the given property is a link to. Or NULL if property is not a link or given property is not registered for given class. [transfer none]

Since 10.05


midgard_reflector_property_get_link_target ()

const gchar *       midgard_reflector_property_get_link_target
                                                        (MidgardReflectorProperty *self,
                                                         const gchar *propname);

self :

MidgardReflectorProperty instance

propname :

property name

Returns :

The name of the property, the given one is a link to. Or NULL if property is not a link or it's not registered for given class. [transfer none]

Since 10.05


midgard_reflector_property_description ()

const gchar *       midgard_reflector_property_description
                                                        (MidgardReflectorProperty *self,
                                                         const gchar *propname);

self :

MidgardReflectorProperty instance

propname :

property name

Returns :

description of the given property or NULL. [transfer none]

Since 10.05


midgard_reflector_property_get_user_value ()

const gchar *       midgard_reflector_property_get_user_value
                                                        (MidgardReflectorProperty *self,
                                                         const gchar *property,
                                                         const gchar *name);

self :

MidgardReflectorProperty instance

property :

property to look value for

name :

name of user defined field

Returns :

value for user defined field, or NULL if none found

Since 10.05


midgard_reflector_property_is_private ()

gboolean            midgard_reflector_property_is_private
                                                        (MidgardReflectorProperty *self,
                                                         const gchar *property);

self :

MidgardReflectorProperty instance

property :

property name to check

Returns :

TRUE, if propery is defined private, FALSE otherwise

Since 10.05


midgard_reflector_property_is_unique ()

gboolean            midgard_reflector_property_is_unique
                                                        (MidgardReflectorProperty *self,
                                                         const gchar *property);

self :

MidgardReflectorProperty instance

property :

property name to check

Returns :

TRUE, if property is defined as unique, FALSE otherwise

Since 10.05


midgard_reflector_property_is_primary ()

gboolean            midgard_reflector_property_is_primary
                                                        (MidgardReflectorProperty *self,
                                                         const gchar *property);

self :

MidgardReflectorProperty instance

property :

property name to check

Returns :

TRUE, if property is primary, FALSE otherwise

Since 10.05


midgard_reflector_property_has_default_value ()

gboolean            midgard_reflector_property_has_default_value
                                                        (MidgardReflectorProperty *self,
                                                         const gchar *property);

self :

MidgardReflectorProperty instance

property :

property name to check

Returns :

TRUE, if property has default value, FALSE otherwise

Since 10.05


midgard_reflector_property_get_default_value ()

GValue *            midgard_reflector_property_get_default_value
                                                        (MidgardReflectorProperty *self,
                                                         const gchar *property);

self :

MidgardReflectorProperty instance

property :

property name to check

Returns :

GValue value or NULL if property is not registered for the class or there's no default value for the given property

Since 10.05

Property Details

The "dbclass" property

  "dbclass"                  gchar*                : Write / Construct Only

Holds the name of the class which, MidgardReflectorProperty has been initialized for.

Default value: ""