1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 418 419 420 421 422 423 424 425 426 427 428 429 430 431 432 433
|
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html><head><meta http-equiv="Content-Type" content="text/html;charset=iso-8859-1">
<title>QOF: Class</title>
<link href="doxygen.css" rel="stylesheet" type="text/css">
</head><body>
<!-- Generated by Doxygen 1.3.6-20040222 -->
<div class="qindex"><a class="qindex" href="index.html">Main Page</a> | <a class="qindex" href="modules.html">Modules</a> | <a class="qindex" href="classes.html">Alphabetical List</a> | <a class="qindex" href="annotated.html">Data Structures</a> | <a class="qindex" href="files.html">File List</a> | <a class="qindex" href="functions.html">Data Fields</a> | <a class="qindex" href="globals.html">Globals</a> | <a class="qindex" href="pages.html">Related Pages</a></div>
<h1>Class<br>
<small>
[<a class="el" href="group__Object.html">Object: Dynamic Object Class Framework</a>]</small>
</h1><hr><a name="_details"></a><h2>Detailed Description</h2>
This file defines a class messaging system reminiscent of traditional OO-style setter and getter interfaces to object properties. A C-language object can declare a collection of setters and getters on itself that can then be used to perform run-time (as opposed to compile-time) bindings to the object.<p>
To put it differently, a QOF class is a set of parameter getters and setters that are associated with an object type. Given a pointer to some thing, the setters and getters can be used to get and set values out of that thing. Note that the pointer to "some thing" need not be a pointer to a QOF Entity or Instance (although QOF classes are more interesting when used with Entities/Instances). What "some thing" is defined entirely by the programmer declaring a new QOF Class.<p>
Because a QOF Class associates getters and setters with a type, one can then ask, at run time, what paramters are associated with a given type, even if those paramters were not known at compile time. Thus, a QOF Class is sort-of like a DynAny implementation. QOF classes can be used to provide "object introspection", i.e. asking object to describe itself.<p>
The QOF Query subsystem depends on QOF classes having been declared; the Query uses the getters to get values associated with particular instances.
<p>
<table border=0 cellpadding=0 cellspacing=0>
<tr><td></td></tr>
<tr><td colspan=2><br><h2>Files</h2></td></tr>
<tr><td class="memItemLeft" nowrap align=right valign=top>file </td><td class="memItemRight" valign=bottom><a class="el" href="qofclass_8h.html">qofclass.h</a></td></tr>
<tr><td class="mdescLeft"> </td><td class="mdescRight">API for registering paramters on objects. <br><br></td></tr>
<p>
<tr><td colspan=2><br><h2>Data Structures</h2></td></tr>
<tr><td class="memItemLeft" nowrap align=right valign=top>struct </td><td class="memItemRight" valign=bottom><a class="el" href="struct__QofParam.html">_QofParam</a></td></tr>
<tr><td colspan=2><br><h2>Defines</h2></td></tr>
<tr><td class="memItemLeft" nowrap align=right valign=top>#define </td><td class="memItemRight" valign=bottom><a class="el" href="group__Class.html#ga11">QOF_TYPE_STRING</a> "string"</td></tr>
<tr><td class="memItemLeft" nowrap align=right valign=top><a class="anchor" name="ga12" doxytag="Class::QOF_TYPE_DATE" ></a>
#define </td><td class="memItemRight" valign=bottom><b>QOF_TYPE_DATE</b> "date"</td></tr>
<tr><td class="memItemLeft" nowrap align=right valign=top><a class="anchor" name="ga13" doxytag="Class::QOF_TYPE_NUMERIC" ></a>
#define </td><td class="memItemRight" valign=bottom><b>QOF_TYPE_NUMERIC</b> "numeric"</td></tr>
<tr><td class="memItemLeft" nowrap align=right valign=top><a class="anchor" name="ga14" doxytag="Class::QOF_TYPE_DEBCRED" ></a>
#define </td><td class="memItemRight" valign=bottom><b>QOF_TYPE_DEBCRED</b> "debcred"</td></tr>
<tr><td class="memItemLeft" nowrap align=right valign=top><a class="anchor" name="ga15" doxytag="Class::QOF_TYPE_GUID" ></a>
#define </td><td class="memItemRight" valign=bottom><b>QOF_TYPE_GUID</b> "guid"</td></tr>
<tr><td class="memItemLeft" nowrap align=right valign=top><a class="anchor" name="ga16" doxytag="Class::QOF_TYPE_INT32" ></a>
#define </td><td class="memItemRight" valign=bottom><b>QOF_TYPE_INT32</b> "gint32"</td></tr>
<tr><td class="memItemLeft" nowrap align=right valign=top><a class="anchor" name="ga17" doxytag="Class::QOF_TYPE_INT64" ></a>
#define </td><td class="memItemRight" valign=bottom><b>QOF_TYPE_INT64</b> "gint64"</td></tr>
<tr><td class="memItemLeft" nowrap align=right valign=top><a class="anchor" name="ga18" doxytag="Class::QOF_TYPE_DOUBLE" ></a>
#define </td><td class="memItemRight" valign=bottom><b>QOF_TYPE_DOUBLE</b> "double"</td></tr>
<tr><td class="memItemLeft" nowrap align=right valign=top><a class="anchor" name="ga19" doxytag="Class::QOF_TYPE_BOOLEAN" ></a>
#define </td><td class="memItemRight" valign=bottom><b>QOF_TYPE_BOOLEAN</b> "boolean"</td></tr>
<tr><td class="memItemLeft" nowrap align=right valign=top><a class="anchor" name="ga20" doxytag="Class::QOF_TYPE_KVP" ></a>
#define </td><td class="memItemRight" valign=bottom><b>QOF_TYPE_KVP</b> "kvp"</td></tr>
<tr><td class="memItemLeft" nowrap align=right valign=top><a class="anchor" name="ga21" doxytag="Class::QOF_TYPE_CHAR" ></a>
#define </td><td class="memItemRight" valign=bottom><b>QOF_TYPE_CHAR</b> "character"</td></tr>
<tr><td colspan=2><br><h2>Typedefs</h2></td></tr>
<tr><td class="memItemLeft" nowrap align=right valign=top>typedef const char * </td><td class="memItemRight" valign=bottom><a class="el" href="group__Class.html#ga0">QofType</a></td></tr>
<tr><td class="memItemLeft" nowrap align=right valign=top><a class="anchor" name="ga1" doxytag="Class::QofParam" ></a>
typedef <a class="el" href="struct__QofParam.html">_QofParam</a> </td><td class="memItemRight" valign=bottom><b>QofParam</b></td></tr>
<tr><td class="memItemLeft" nowrap align=right valign=top>typedef gpointer(* </td><td class="memItemRight" valign=bottom><a class="el" href="group__Class.html#ga2">QofAccessFunc</a> )(gpointer object, const <a class="el" href="struct__QofParam.html">QofParam</a> *param)</td></tr>
<tr><td class="memItemLeft" nowrap align=right valign=top>typedef void(* </td><td class="memItemRight" valign=bottom><a class="el" href="group__Class.html#ga3">QofSetterFunc</a> )(gpointer, gpointer)</td></tr>
<tr><td class="memItemLeft" nowrap align=right valign=top>typedef int(* </td><td class="memItemRight" valign=bottom><a class="el" href="group__Class.html#ga4">QofSortFunc</a> )(gpointer, gpointer)</td></tr>
<tr><td colspan=2><br><h2>Functions</h2></td></tr>
<tr><td class="memItemLeft" nowrap align=right valign=top>void </td><td class="memItemRight" valign=bottom><a class="el" href="group__Class.html#ga5">qof_class_register</a> (QofIdTypeConst obj_name, <a class="el" href="group__Class.html#ga4">QofSortFunc</a> default_sort_fcn, const <a class="el" href="struct__QofParam.html">QofParam</a> *params)</td></tr>
<tr><td class="memItemLeft" nowrap align=right valign=top>gboolean </td><td class="memItemRight" valign=bottom><a class="el" href="group__Class.html#ga6">qof_class_is_registered</a> (QofIdTypeConst obj_name)</td></tr>
<tr><td class="memItemLeft" nowrap align=right valign=top><a class="el" href="group__Class.html#ga0">QofType</a> </td><td class="memItemRight" valign=bottom><a class="el" href="group__Class.html#ga7">qof_class_get_parameter_type</a> (QofIdTypeConst obj_name, const char *param_name)</td></tr>
<tr><td class="memItemLeft" nowrap align=right valign=top>const <a class="el" href="struct__QofParam.html">QofParam</a> * </td><td class="memItemRight" valign=bottom><a class="el" href="group__Class.html#ga8">qof_class_get_parameter</a> (QofIdTypeConst obj_name, const char *parameter)</td></tr>
<tr><td class="memItemLeft" nowrap align=right valign=top><a class="el" href="group__Class.html#ga2">QofAccessFunc</a> </td><td class="memItemRight" valign=bottom><a class="el" href="group__Class.html#ga9">qof_class_get_parameter_getter</a> (QofIdTypeConst obj_name, const char *parameter)</td></tr>
<tr><td class="memItemLeft" nowrap align=right valign=top><a class="el" href="group__Class.html#ga3">QofSetterFunc</a> </td><td class="memItemRight" valign=bottom><a class="el" href="group__Class.html#ga10">qof_class_get_parameter_setter</a> (QofIdTypeConst obj_name, const char *parameter)</td></tr>
</table>
<hr><h2>Define Documentation</h2>
<a class="anchor" name="ga11" doxytag="qofclass.h::QOF_TYPE_STRING" ></a><p>
<table class="mdTable" width="100%" cellpadding="2" cellspacing="0">
<tr>
<td class="mdRow">
<table cellpadding="0" cellspacing="0" border="0">
<tr>
<td class="md" nowrap valign="top"> #define QOF_TYPE_STRING "string"
</table>
</td>
</tr>
</table>
<table cellspacing=5 cellpadding=0 border=0>
<tr>
<td>
</td>
<td>
<p>
Core types of objects that can be used in parameters. Note that QofIdTypes may also be used. </td>
</tr>
</table>
<hr><h2>Typedef Documentation</h2>
<a class="anchor" name="ga2" doxytag="qofclass.h::QofAccessFunc" ></a><p>
<table class="mdTable" width="100%" cellpadding="2" cellspacing="0">
<tr>
<td class="mdRow">
<table cellpadding="0" cellspacing="0" border="0">
<tr>
<td class="md" nowrap valign="top"> typedef gpointer(* <a class="el" href="group__Class.html#ga2">QofAccessFunc</a>)(gpointer object, const <a class="el" href="struct__QofParam.html">QofParam</a> *param)
</table>
</td>
</tr>
</table>
<table cellspacing=5 cellpadding=0 border=0>
<tr>
<td>
</td>
<td>
<p>
The QofAccessFunc defines an arbitrary function pointer for access functions. This is needed because C doesn't have templates, so we just cast a lot. Real functions must be of the form:<p>
param_type getter_func (object_type *self); or param_type getter_func (object_type *self, QofParam *param);<p>
The additional argument 'param' allows generic getter functions to be implemented, because this argument provides for a way to identify the expected getter_func return type at runtime. It also provides a place for the user to hang additional user-defined data. </td>
</tr>
</table>
<a class="anchor" name="ga3" doxytag="qofclass.h::QofSetterFunc" ></a><p>
<table class="mdTable" width="100%" cellpadding="2" cellspacing="0">
<tr>
<td class="mdRow">
<table cellpadding="0" cellspacing="0" border="0">
<tr>
<td class="md" nowrap valign="top"> typedef void(* <a class="el" href="group__Class.html#ga3">QofSetterFunc</a>)(gpointer, gpointer)
</table>
</td>
</tr>
</table>
<table cellspacing=5 cellpadding=0 border=0>
<tr>
<td>
</td>
<td>
<p>
The QofSetterFunc defines an function pointer for parameter setters. Real functions must be of the form:<p>
void setter_func (object_type *self, param_type *param); </td>
</tr>
</table>
<a class="anchor" name="ga4" doxytag="qofclass.h::QofSortFunc" ></a><p>
<table class="mdTable" width="100%" cellpadding="2" cellspacing="0">
<tr>
<td class="mdRow">
<table cellpadding="0" cellspacing="0" border="0">
<tr>
<td class="md" nowrap valign="top"> typedef int(* <a class="el" href="group__Class.html#ga4">QofSortFunc</a>)(gpointer, gpointer)
</table>
</td>
</tr>
</table>
<table cellspacing=5 cellpadding=0 border=0>
<tr>
<td>
</td>
<td>
<p>
This function is the default sort function for a particular object type </td>
</tr>
</table>
<a class="anchor" name="ga0" doxytag="qofclass.h::QofType" ></a><p>
<table class="mdTable" width="100%" cellpadding="2" cellspacing="0">
<tr>
<td class="mdRow">
<table cellpadding="0" cellspacing="0" border="0">
<tr>
<td class="md" nowrap valign="top"> typedef const char* <a class="el" href="group__Class.html#ga0">QofType</a>
</table>
</td>
</tr>
</table>
<table cellspacing=5 cellpadding=0 border=0>
<tr>
<td>
</td>
<td>
<p>
Type of Paramters (String, Date, Numeric, GUID, etc.) </td>
</tr>
</table>
<hr><h2>Function Documentation</h2>
<a class="anchor" name="ga8" doxytag="qofclass.h::qof_class_get_parameter" ></a><p>
<table class="mdTable" width="100%" cellpadding="2" cellspacing="0">
<tr>
<td class="mdRow">
<table cellpadding="0" cellspacing="0" border="0">
<tr>
<td class="md" nowrap valign="top"> const <a class="el" href="struct__QofParam.html">QofParam</a>* qof_class_get_parameter </td>
<td class="md" valign="top">( </td>
<td class="md" nowrap valign="top">QofIdTypeConst </td>
<td class="mdname" nowrap> <em>obj_name</em>, </td>
</tr>
<tr>
<td class="md" nowrap align="right"></td>
<td></td>
<td class="md" nowrap>const char * </td>
<td class="mdname" nowrap> <em>parameter</em></td>
</tr>
<tr>
<td></td>
<td class="md">) </td>
<td class="md" colspan="2"></td>
</tr>
</table>
</td>
</tr>
</table>
<table cellspacing=5 cellpadding=0 border=0>
<tr>
<td>
</td>
<td>
<p>
Return the registered Parameter Definition for the requested parameter </td>
</tr>
</table>
<a class="anchor" name="ga9" doxytag="qofclass.h::qof_class_get_parameter_getter" ></a><p>
<table class="mdTable" width="100%" cellpadding="2" cellspacing="0">
<tr>
<td class="mdRow">
<table cellpadding="0" cellspacing="0" border="0">
<tr>
<td class="md" nowrap valign="top"> <a class="el" href="group__Class.html#ga2">QofAccessFunc</a> qof_class_get_parameter_getter </td>
<td class="md" valign="top">( </td>
<td class="md" nowrap valign="top">QofIdTypeConst </td>
<td class="mdname" nowrap> <em>obj_name</em>, </td>
</tr>
<tr>
<td class="md" nowrap align="right"></td>
<td></td>
<td class="md" nowrap>const char * </td>
<td class="mdname" nowrap> <em>parameter</em></td>
</tr>
<tr>
<td></td>
<td class="md">) </td>
<td class="md" colspan="2"></td>
</tr>
</table>
</td>
</tr>
</table>
<table cellspacing=5 cellpadding=0 border=0>
<tr>
<td>
</td>
<td>
<p>
Return the object's parameter getter function </td>
</tr>
</table>
<a class="anchor" name="ga10" doxytag="qofclass.h::qof_class_get_parameter_setter" ></a><p>
<table class="mdTable" width="100%" cellpadding="2" cellspacing="0">
<tr>
<td class="mdRow">
<table cellpadding="0" cellspacing="0" border="0">
<tr>
<td class="md" nowrap valign="top"> <a class="el" href="group__Class.html#ga3">QofSetterFunc</a> qof_class_get_parameter_setter </td>
<td class="md" valign="top">( </td>
<td class="md" nowrap valign="top">QofIdTypeConst </td>
<td class="mdname" nowrap> <em>obj_name</em>, </td>
</tr>
<tr>
<td class="md" nowrap align="right"></td>
<td></td>
<td class="md" nowrap>const char * </td>
<td class="mdname" nowrap> <em>parameter</em></td>
</tr>
<tr>
<td></td>
<td class="md">) </td>
<td class="md" colspan="2"></td>
</tr>
</table>
</td>
</tr>
</table>
<table cellspacing=5 cellpadding=0 border=0>
<tr>
<td>
</td>
<td>
<p>
Return the object's parameter setter function </td>
</tr>
</table>
<a class="anchor" name="ga7" doxytag="qofclass.h::qof_class_get_parameter_type" ></a><p>
<table class="mdTable" width="100%" cellpadding="2" cellspacing="0">
<tr>
<td class="mdRow">
<table cellpadding="0" cellspacing="0" border="0">
<tr>
<td class="md" nowrap valign="top"> <a class="el" href="group__Class.html#ga0">QofType</a> qof_class_get_parameter_type </td>
<td class="md" valign="top">( </td>
<td class="md" nowrap valign="top">QofIdTypeConst </td>
<td class="mdname" nowrap> <em>obj_name</em>, </td>
</tr>
<tr>
<td class="md" nowrap align="right"></td>
<td></td>
<td class="md" nowrap>const char * </td>
<td class="mdname" nowrap> <em>param_name</em></td>
</tr>
<tr>
<td></td>
<td class="md">) </td>
<td class="md" colspan="2"></td>
</tr>
</table>
</td>
</tr>
</table>
<table cellspacing=5 cellpadding=0 border=0>
<tr>
<td>
</td>
<td>
<p>
Return the core datatype of the specified object's parameter </td>
</tr>
</table>
<a class="anchor" name="ga6" doxytag="qofclass.h::qof_class_is_registered" ></a><p>
<table class="mdTable" width="100%" cellpadding="2" cellspacing="0">
<tr>
<td class="mdRow">
<table cellpadding="0" cellspacing="0" border="0">
<tr>
<td class="md" nowrap valign="top"> gboolean qof_class_is_registered </td>
<td class="md" valign="top">( </td>
<td class="md" nowrap valign="top">QofIdTypeConst </td>
<td class="mdname1" valign="top" nowrap> <em>obj_name</em> </td>
<td class="md" valign="top"> ) </td>
<td class="md" nowrap></td>
</tr>
</table>
</td>
</tr>
</table>
<table cellspacing=5 cellpadding=0 border=0>
<tr>
<td>
</td>
<td>
<p>
Return true if the the indicated type is registered, else return FALSE. </td>
</tr>
</table>
<a class="anchor" name="ga5" doxytag="qofclass.h::qof_class_register" ></a><p>
<table class="mdTable" width="100%" cellpadding="2" cellspacing="0">
<tr>
<td class="mdRow">
<table cellpadding="0" cellspacing="0" border="0">
<tr>
<td class="md" nowrap valign="top"> void qof_class_register </td>
<td class="md" valign="top">( </td>
<td class="md" nowrap valign="top">QofIdTypeConst </td>
<td class="mdname" nowrap> <em>obj_name</em>, </td>
</tr>
<tr>
<td class="md" nowrap align="right"></td>
<td></td>
<td class="md" nowrap><a class="el" href="group__Class.html#ga4">QofSortFunc</a> </td>
<td class="mdname" nowrap> <em>default_sort_fcn</em>, </td>
</tr>
<tr>
<td class="md" nowrap align="right"></td>
<td></td>
<td class="md" nowrap>const <a class="el" href="struct__QofParam.html">QofParam</a> * </td>
<td class="mdname" nowrap> <em>params</em></td>
</tr>
<tr>
<td></td>
<td class="md">) </td>
<td class="md" colspan="2"></td>
</tr>
</table>
</td>
</tr>
</table>
<table cellspacing=5 cellpadding=0 border=0>
<tr>
<td>
</td>
<td>
<p>
This function registers a new object class with the Qof subsystem. In particular, it registers the set of setters and getters for controlling the object. The getters are typically used by the query subsystem to query type specific data. Note that there is no particular reqquirement for there to be a setter for every getter or even v.v. nor is there any requeirement for these to map 'cleanly' or orthogonaly to the actual object design.<p>
The "params" argument must be a NULL-terminated array of QofParam. It may be NULL if there are no parameters to be registered. </td>
</tr>
</table>
<hr size="1"><address style="align: right;"><small>Generated on Sun May 23 15:41:48 2004 for QOF by
<a href="http://www.doxygen.org/index.html">
<img src="doxygen.png" alt="doxygen" align="middle" border=0 > </a>1.3.6-20040222 </small></address>
</body>
</html>
|