midgard/midgard_object.h

00001 /* 
00002  * Copyright (C) 2005 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_OBJECT_H
00020 #define MIDGARD_OBJECT_H
00021 
00030 #include <glib.h>
00031 #include <midgard/types.h>
00032 
00033 /*
00034  * Returns table name used for object.
00035  *
00036  * @param klass MidgardObjectClass pointer
00037  *
00038  * @return table name
00039  *
00040  * Returned string  is a pointer to table name used for object's class.
00041  */ 
00042 extern const gchar *midgard_object_class_get_table(MidgardObjectClass *klass);
00043 
00044 /*
00045  * Returns table names used for object.
00046  * 
00047  * @param klass MidgardObjectClass pointer
00048  * 
00049  * @return table name 
00050  * 
00051  * Returned string is a pointer to table names used for object's class.
00052  * One table name is returned if  object's class uses one table, or
00053  * table names separated by comas otherwise
00054  */
00055 extern const gchar *midgard_object_class_get_tables(MidgardObjectClass *klass);
00056 
00057 /*
00058  * Returns primary field name used for object's class.
00059  *  
00060  * @param klass MidgardObjectClass pointer
00061  * 
00062  * @return field name 
00063  * 
00064  * Returned string name is a pointer to primary field name used for object's class.
00065  * Primary field is a field with unique value used by table ( auto_incremnented id 
00066  * or guid or uuid for example)
00067  */
00068 extern const gchar *midgard_object_class_get_primary_field(MidgardObjectClass *klass);
00069 
00070 /*
00071  * Returns table name used for property
00072  *
00073  * @param klass MidgardObjectClass
00074  * @param property_name name of property 
00075  *
00076  * @return table name
00077  *
00078  * Returned string is a pointer to table name used for property_name property's value.
00079  */
00080 extern const gchar *midgard_object_class_get_property_table(
00081         MidgardObjectClass *klass, const gchar *property_name);
00082 
00083 /*
00084  * Returns field name used for property name.
00085  * 
00086  * @param klass MidgardObjectClass pointer
00087  * @parame property_name object's property name  
00088  *  
00089  * @return field name
00090  * 
00091  * Returned string is a pointer to field name used for object's property name.
00092  * 
00093  */
00094 extern const gchar *midgard_object_class_get_property_field(
00095         MidgardObjectClass *klass, const gchar *property_name);
00096 
00097 /*
00098  * \ingroup moc 
00099  *
00100  * Returns MidgardObjectClass for linked object.
00101  * 
00102  * @param klass MidgardObjectClass pointer
00103  * @parame property_name object's property name  
00104  *  
00105  * @return linked object's class pointer
00106  *  
00107  * Returned class is a pointer to object's class which is linked to property_name
00108  * property and defined in schema. It's owned by midgard core so you shouldn't 
00109  * free it.
00110  */
00111 extern  MidgardObjectClass *midgard_object_class_get_link_target(
00112         MidgardObjectClass *klass, const gchar *property_name);
00113 
00114 /*
00115  * \ingroup moc
00116  *
00117  * Returns the name of object's primary property.
00118  * 
00119  * @param klass MidgardObjectClass pointer
00120  *  
00121  * @return primary property name
00122  * 
00123  * Returned string is a pointer to object's primary property.
00124  * Primary property is a property which holds value of object's primary field
00125  * (midgard_object_class_get_primary_field)
00126  */           
00127 extern const gchar *midgard_object_class_get_primary_property(MidgardObjectClass *klass); 
00128 
00129 /*
00130  * \ingroup moc
00131  *
00132  * Returns the name of object's parent property.
00133  *  
00134  * @param klass MidgardObjectClass pointer
00135  *
00136  * @return parent property name
00137  * 
00138  * Returned string is a pointer to object's parent property.
00139  * Parent property is a property which holds value of field which points to 
00140  * parent object's identifier. Parent property always points to object's 
00141  * identifier which is not the same type as MidgardObjectClass klass.
00142  */
00143 extern const gchar *midgard_object_class_get_parent_property(MidgardObjectClass *klass);
00144 
00145 /*
00146  * \ingroup moc
00147  *
00148  * Returns the name of object's up property.
00149  * 
00150  * @param klass MidgardObjectClass pointer
00151  * 
00152  * @return up property name
00153  * 
00154  * Returned string is a pointer to object's up property.
00155  * Up property is a property which holds value of field which points to 
00156  * "upper" object's identifier. Up property always points to object's
00157  * dentifier which is the same type as MidgardObjectClass klass.
00158  */
00159 extern const gchar *midgard_object_class_get_up_property(MidgardObjectClass *klass);
00160 
00161 /*
00162  * \ingroup moc
00163  *
00164  * Returns class' lang usage information.
00165  *
00166  * @param klass MidgardObjectClass pointer
00167  *
00168  * @return TRUE or FALSE
00169  *
00170  * Returns TRUE if class uses multilang feature, FALSE otherwise.
00171  */ 
00172 extern gboolean midgard_object_class_is_multilang(MidgardObjectClass *klass);
00173 
00186 MidgardObjectClass **midgard_object_class_list_children(
00187         MidgardObjectClass *klass);
00188 
00189 #endif /* MIDGARD_OBJECT_H */
00190 

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