pilot-qof  0.2.3
qof-main.h
Go to the documentation of this file.
00001 /***************************************************************************
00002  *            qof-main.h
00003  *
00004  *  This is an auto-generated file. Patches are available from
00005  *  http://qof-gen.sourceforge.net/
00006  *  For QOF 0.7.0, using QofTime.
00007  *
00008  *  Thu Jan 13 12:15:41 2005
00009  *  Copyright  2005-2006  Neil Williams
00010  *  linux@codehelp.co.uk
00011  ****************************************************************************/
00012 /*
00013     This program is free software; you can redistribute it and/or modify
00014     it under the terms of the GNU General Public License as published by
00015     the Free Software Foundation; either version 3 of the License, or
00016     (at your option) any later version.
00017 
00018     This program is distributed in the hope that it will be useful,
00019     but WITHOUT ANY WARRANTY; without even the implied warranty of
00020     MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
00021     GNU General Public License for more details.
00022 
00023     You should have received a copy of the GNU General Public License
00024     along with this program.  If not, see <http://www.gnu.org/licenses/>.
00025  */
00026 
00051 #ifndef _QOF_MAIN_H
00052 #define _QOF_MAIN_H
00053 
00070 void qof_main_wrap_line (FILE * fp, gint indent,
00071     const gchar * template_str, ...)
00072     __attribute__ ((format (printf, 3, 4)));
00073 
00075 #define ERR_INDENT strlen(PACKAGE) + 2
00076 
00093 GSList*
00094 qof_main_get_param_list(QofIdTypeConst object_type, QofType param_type);
00095 
00100 #define QOF_DATE_STRING_LENGTH  MAX_DATE_LENGTH
00101 
00103 #define QOF_MAIN_CLI  "QOF-mod-command-line"
00104 
00118 #define CATEGORY_NAME "category"
00119 
00127 #define QSF_COMPRESS "compression_level"
00128 
00130 #define QSF_ENCODING "encoding_string"
00131 
00133 #define QSF_DATE_CONVERT "convert_date_to_time"
00134 
00159 #define QOF_SQL_SUPPORTED  "^SELECT|INSERT"
00160 
00178 glong
00179 qof_mod_get_local_offset (void);
00180 
00191 void qof_main_show_error (QofSession * session);
00192 
00198 typedef struct QofMain_s
00199 {
00201     gchar *filename;
00203     gchar *write_file;
00205     gchar *input_file;
00207     gchar *sql_file;
00210     gchar *sql_str;
00212     gchar *database;
00214     gchar *exclude;
00216     gchar *category;
00219     QofTime *min_qt;
00222     QofTime *max_qt;
00224     QofSession *input_session;
00226     QofSession *export_session;
00228     gboolean error;
00230     QofQuery *query;
00232     GList *sql_list;
00234     gint64 gz_level;
00236     const gchar *encoding;
00239     gint64 convert;
00241     QofType param_type;
00242 } QofMainContext;
00243 
00245 void qof_main_free (QofMainContext * context);
00246 
00248 void qof_cmd_xmlfile (QofMainContext * context);
00249 
00255 void qof_cmd_list (void);
00256 
00263 void 
00264 qof_mod_category (const gchar * category, QofMainContext * data);
00265 
00272 void 
00273 qof_mod_database (const gchar * database, QofMainContext * data);
00274 
00302 void 
00303 qof_mod_time (const gchar * date_time, QofMainContext * data);
00304 
00309 void 
00310 qof_mod_exclude (const gchar * exclude, QofMainContext * data);
00311 
00351 void 
00352 qof_mod_sql (const gchar * sql_query, QofMainContext * data);
00353 
00362 void 
00363 qof_mod_sql_file (const gchar * sql_file, QofMainContext * data);
00364 
00369 void 
00370 qof_mod_write (const gchar * write_file, QofMainContext * data);
00371 
00378 void 
00379 qof_mod_compression (gint64 gz_level, QofMainContext * context);
00380 
00382 void 
00383 qof_mod_encoding (const gchar * encoding, QofMainContext * context);
00384 
00386 void
00387 qof_mod_convert_deprecated (gint64 convert, QofMainContext * context);
00388 
00398 void qof_main_moderate_query (QofMainContext * context);
00399 
00405 void qof_cmd_explain (QofMainContext * context);
00406 
00407 void qof_main_select (QofMainContext * context);
00408 
00421 /* Translators: ignore the above comment, gettext is too dumb to detect 
00422 documentation. */
00423 
00424 #define QOF_CLI_OPTIONS \
00425     { NULL, '\0', POPT_ARG_INCLUDE_TABLE, poptHelpOptionsI18N, \
00426         0, _("Help options:"), NULL }, \
00427     {"list", 'l', POPT_ARG_NONE, NULL, qof_op_list, \
00428      _("List all databases supported by the current QOF framework " \
00429         "and exit."), NULL}, \
00430     {"explain", 0, POPT_ARG_NONE, NULL, qof_op_explain, \
00431      _("List the fields within the specified database and " \
00432         "exit, requires -d."), NULL}, \
00433     {"xml-file", 'x', POPT_ARG_STRING, &filename, qof_op_offline, \
00434      _("Query the QSF XML data in <filename>"),  _("filename")}, \
00435     {"date", 't', POPT_ARG_STRING, &date_time, qof_op_time, \
00436      _("Shorthand to only query objects that contain the " \
00437         "specified date."), _("string")}, \
00438     {"database", 'd', POPT_ARG_STRING, &database, qof_op_database, \
00439      _("Shorthand to only query objects within a specific " \
00440         "supported database. "), _("string")}, \
00441     {"exclude", 'e', POPT_ARG_STRING, &exclude, qof_op_exclude, \
00442      _("Shorthand to exclude a supported database from the query."), \
00443      _("string")}, \
00444     {"sql", 's', POPT_ARG_STRING, &sql_query, qof_op_sql, \
00445      _("Specify a SQL query on the command line."), _("string")}, \
00446     {"sql-file", 'f', POPT_ARG_STRING, &sql_file, qof_op_sql_file, \
00447      _("Specify one or more SQL queries contained in a file."), \
00448      _("filename")}, \
00449     {"write", 'w', POPT_ARG_STRING, &write_file, qof_op_write, \
00450      _("Write the results of any query to the file"), _("filename")}, \
00451     {"compress", 0, POPT_ARG_INT, &gz_level, qof_op_compress, \
00452      _("Compress output files, 0 for none, 9 for maximum"), _("integer")}, \
00453     {"debug", 0, POPT_ARG_NONE, NULL, qof_op_debug, \
00454      _("Print debugging information to a temporary file."), NULL}, \
00455     {"version", 0, POPT_ARG_NONE, NULL, qof_op_vers, \
00456      _("Display version information"), NULL}, \
00457     {"category", 'c', POPT_ARG_STRING, &category, qof_op_category, \
00458      _("Shorthand to only query objects that are set to the specified category."), \
00459      _("string")},
00460 
00462 #define QOF_MAIN_OP \
00463     _(qof_op_noop, = 0) \
00464     _(qof_op_list,)     \
00465     _(qof_op_xmlfile,)  \
00466     _(qof_op_category,) \
00467     _(qof_op_database,) \
00468     _(qof_op_time,) \
00469     _(qof_op_exclude,)  \
00470     _(qof_op_sql,)      \
00471     _(qof_op_sql_file,) \
00472     _(qof_op_write, )   \
00473     _(qof_op_explain,)  \
00474     _(qof_op_vers,)     \
00475     _(qof_op_compress,) \
00476     _(qof_op_debug,)
00477 
00483 #define QOF_OP_VARS \
00484     const gchar *exclude,  *date_time,  *category,  *database; \
00485     const gchar *sql_file, *write_file, *sql_query, *filename;
00486 
00491 #define QOF_OP_INIT    \
00492     exclude = NULL;    \
00493     category = NULL;   \
00494     database = NULL;   \
00495     sql_file = NULL;   \
00496     write_file = NULL; \
00497     sql_query = NULL;  \
00498     filename = NULL;
00499 
00503 #endif /* _QOF_MAIN_H */