fiddle with the documentation

git-svn-id: svn+ssh://svn.gnucash.org/repo/gnucash/trunk@8441 57a11ea4-9604-0410-9ed3-97b8803252fd
This commit is contained in:
Linas Vepstas 2003-05-29 04:48:23 +00:00
parent dbed96de7b
commit bf488bff50
3 changed files with 61 additions and 49 deletions

View File

@ -21,6 +21,11 @@
* *
\********************************************************************/
/** @file QueryCore.h
@breif API for providing core Query data types
@author Copyright (C) 2002 Derek Atkins <warlord@MIT.EDU>
*/
#ifndef GNC_QUERYCORE_H
#define GNC_QUERYCORE_H
@ -32,11 +37,20 @@
typedef struct query_pred_data *QueryPredData_t;
/* Type of Query Core Objects (String, Date, Numeric, GUID, etc. */
/** Type of Query Core Objects (String, Date, Numeric, GUID, etc. */
typedef const char * QueryCoreType;
/* Standard Query comparitors, for how to compare objects in a predicate.
* Note that not all core types implement all comparitors
/** The QueryAccess type 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:
*
* <param_type> function (object_type *obj);
*/
typedef gpointer (*QueryAccess)(gpointer);
/** Standard Query comparitors, for how to compare objects in a predicate.
* Note that not all core types implement all comparitors
*/
typedef enum {
COMPARE_LT = 1,
@ -47,9 +61,8 @@ typedef enum {
COMPARE_NEQ
} query_compare_t;
/*
* List of known core query data-types...
* Each core query type defines it's set of optional "comparitor qualifiers".
/** List of known core query data-types...
* Each core query type defines it's set of optional "comparitor qualifiers".
*/
#define QUERYCORE_STRING "string"
typedef enum {
@ -84,20 +97,20 @@ typedef enum {
#define QUERYCORE_BOOLEAN "boolean"
#define QUERYCORE_KVP "kvp"
/* A CHAR type is for a RECNCell */
/** A CHAR type is for a RECNCell */
#define QUERYCORE_CHAR "character"
typedef enum {
CHAR_MATCH_ANY = 1,
CHAR_MATCH_NONE
} char_match_t;
/* Head of Predicate Data structures. All PData must start like this. */
/** Head of Predicate Data structures. All PData must start like this. */
typedef struct query_pred_data {
QueryCoreType type_name; /* QUERYCORE_* */
query_compare_t how;
} QueryPredDataDef;
/* Core Data Type Predicates */
/** Core Data Type Predicates */
QueryPredData_t gncQueryStringPredicate (query_compare_t how, char *str,
string_match_t options,
gboolean is_regex);
@ -115,16 +128,14 @@ QueryPredData_t gncQueryCharPredicate (char_match_t options,
QueryPredData_t gncQueryKVPPredicate (query_compare_t how,
GSList *path, const kvp_value *value);
#include "QueryObject.h" /* for QueryAccess */
/* Copy a predicate */
/** Copy a predicate. */
QueryPredData_t gncQueryCorePredicateCopy (QueryPredData_t pdata);
/* Destroy a predicate */
/** Destroy a predicate. */
void gncQueryCorePredicateFree (QueryPredData_t pdata);
/* Return a printable string for a core data object. Caller needs
* to g_free() the returned string
/** Return a printable string for a core data object. Caller needs
* to g_free() the returned string.
*/
char * gncQueryCoreToString (char const *type, gpointer object,
QueryAccess fcn);

View File

@ -1,6 +1,5 @@
/********************************************************************\
* QueryNew.h -- API for finding Gnucash objects *
* Copyright (C) 2002 Derek Atkins <warlord@MIT.EDU> *
* *
* This program is free software; you can redistribute it and/or *
* modify it under the terms of the GNU General Public License as *
@ -21,16 +20,22 @@
* *
\********************************************************************/
/** @file QueryNew.h
@breif API for finding Gnucash objects
@author Copyright (C) 2002 Derek Atkins <warlord@MIT.EDU>
*/
#ifndef GNC_QUERYNEW_H
#define GNC_QUERYNEW_H
#include "GNCId.h"
#include "QueryCore.h"
/* A Query */
/** A Query */
typedef struct querynew_s QueryNew;
/* Query Term Operators, for combining Query Terms */
/** Query Term Operators, for combining Query Terms */
typedef enum {
QUERY_AND=1,
QUERY_OR,
@ -39,33 +44,33 @@ typedef enum {
QUERY_XOR
} QueryOp;
/* Default sort object type */
/** Default sort object type */
#define QUERY_DEFAULT_SORT "GnucashQueryDefaultSortObject"
/* "Known" Object Parameters -- all objects must support these */
/** "Known" Object Parameters -- all objects must support these */
#define QUERY_PARAM_BOOK "book"
#define QUERY_PARAM_GUID "guid"
#define QUERY_PARAM_ACTIVE "active" /* it's ok if an object does
* not support this */
/* Basic API Functions */
/** Basic API Functions */
GSList * gncQueryBuildParamList (char const *param, ...);
/* Create a new query. A Query MUST be set with a 'search-for' type.
* you can create and set this value in one step or two */
/** Create a new query. A Query MUST be set with a 'search-for' type.
* you can create and set this value in one step or two */
QueryNew * gncQueryCreate (void);
QueryNew * gncQueryCreateFor (GNCIdTypeConst obj_type);
void gncQueryDestroy (QueryNew *q);
/* Set the object type to be searched for */
/** Set the object type to be searched for */
void gncQuerySearchFor (QueryNew *query, GNCIdTypeConst obj_type);
/* Set the book to be searched (you can search multiple books) */
/** Set the book to be searched (you can search multiple books) */
void gncQuerySetBook (QueryNew *q, GNCBook *book);
/* This is the general function that adds a new Query Term to a query.
/** This is the general function that adds a new Query Term to a query.
* It will find the 'obj_type' object of the search item and compare
* the 'param_list' parameter to the predicate data via the comparitor.
*
@ -96,10 +101,10 @@ void gncQueryAddGUIDListMatch (QueryNew *q, GSList *param_list,
void gncQueryAddBooleanMatch (QueryNew *q, GSList *param_list, gboolean value,
QueryOp op);
/* Run the query: */
/** Run the query: */
GList * gncQueryRun (QueryNew *query);
/* Return the results of the last query, without re-running */
/** Return the results of the last query, without re-running */
GList * gncQueryLastRun (QueryNew *query);
void gncQueryClear (QueryNew *query);
@ -112,7 +117,7 @@ gboolean gncQueryHasTermType (QueryNew *q, GSList *term_param);
QueryNew * gncQueryCopy (QueryNew *q);
QueryNew * gncQueryInvert(QueryNew *q);
/* Merges two queries together. Both queries must be compatible
/** Merges two queries together. Both queries must be compatible
* search-types. If both queries are set, they must search for the
* same object type. If only one is set, the resulting query will
* search for the set type. If neither query has the search-type set,
@ -120,12 +125,12 @@ QueryNew * gncQueryInvert(QueryNew *q);
*/
QueryNew * gncQueryMerge(QueryNew *q1, QueryNew *q2, QueryOp op);
/* Like gncQueryMerge, but this will merge q2 into q1. q2 remains
/** Like gncQueryMerge, but this will merge q2 into q1. q2 remains
* unchanged.
*/
void gncQueryMergeInPlace(QueryNew *q1, QueryNew *q2, QueryOp op);
/* The lists become the property of the Query and will be freed
/** The lists become the property of the Query and will be freed
* by the query when it is destroyed.
*/
void gncQuerySetSortOrder (QueryNew *q,
@ -142,7 +147,7 @@ void gncQuerySetSortIncreasing (QueryNew *q, gboolean prim_inc,
void gncQuerySetMaxResults (QueryNew *q, int n);
/* compare two queries for equality. this is a simplistic
/** Compare two queries for equality. This is a simplistic
* implementation -- logical equivalences between different
* and/or trees are ignored. */
gboolean gncQueryEqual (QueryNew *q1, QueryNew *q2);

View File

@ -1,6 +1,5 @@
/********************************************************************\
* QueryObject.h -- API for registering queriable Gnucash objects *
* Copyright (C) 2002 Derek Atkins <warlord@MIT.EDU> *
* *
* This program is free software; you can redistribute it and/or *
* modify it under the terms of the GNU General Public License as *
@ -21,21 +20,18 @@
* *
\********************************************************************/
/** @file QueryObject.h
@brief API for registering queriable GnuCash objects
@author Copyright (C) 2002 Derek Atkins <warlord@MIT.EDU>
*/
#ifndef GNC_QUERYOBJECT_H
#define GNC_QUERYOBJECT_H
/* Define an arbitrary function pointer for access functions. This is
* because C doesn't have templates, so we just cast a lot. Real
* functions must be of the form:
*
* <param_type> function (object_type *obj);
*/
typedef gpointer (*QueryAccess)(gpointer);
#include "QueryNew.h"
#include "QueryCore.h"
#include "QueryNew.h"
/* This structure is for each queriable parameter in an object
/** This structure is for each queriable parameter in an object
*
* -- param_name is the name of the parameter.
* -- param_type is the type of the parameter, which can be either another
@ -48,10 +44,10 @@ typedef struct query_object_def {
QueryAccess param_getfcn;
} QueryObjectDef;
/* This function is the default sort function for a particular object type */
/** This function is the default sort function for a particular object type */
typedef int (*QuerySort)(gpointer, gpointer);
/* This function registers a new Gnucash Object with the QueryNew
/** This function registers a new Gnucash Object with the QueryNew
* subsystem. In particular it registers the set of parameters and
* converters to query the type-specific data. Both "params" and
* "converters" are NULL-terminated arrays of structures. Either
@ -61,7 +57,7 @@ void gncQueryObjectRegister (GNCIdTypeConst obj_name,
QuerySort default_sort_fcn,
const QueryObjectDef *params);
/* An example:
/** An example:
*
* #define MY_QUERY_OBJ_MEMO "memo"
* #define MY_QUERY_OBJ_VALUE "value"
@ -81,15 +77,15 @@ void gncQueryObjectRegister (GNCIdTypeConst obj_name,
* &myQueryObjectParams);
*/
/* Return the core datatype of the specified object's parameter */
/** Return the core datatype of the specified object's parameter */
QueryCoreType gncQueryObjectParameterType (GNCIdTypeConst obj_name,
const char *param_name);
/* Return the registered Object Definition for the requested parameter */
/** Return the registered Object Definition for the requested parameter */
const QueryObjectDef * gncQueryObjectGetParameter (GNCIdTypeConst obj_name,
const char *parameter);
/* Return the object's parameter getter function */
/** Return the object's parameter getter function */
QueryAccess gncQueryObjectGetParameterGetter (GNCIdTypeConst obj_name,
const char *parameter);