quicklist.c

Go to the documentation of this file.
00001 /*
00002  *      quicklist.c
00003  *
00004  *      Copyright 2007 Neil Williams <linux@codehelp.co.uk>
00005  *
00006  */
00042 /*
00043     This package is free software; you can redistribute it and/or modify
00044     it under the terms of the GNU General Public License as published by
00045     the Free Software Foundation; either version 3 of the License, or
00046     (at your option) any later version.
00047 
00048     This program is distributed in the hope that it will be useful,
00049     but WITHOUT ANY WARRANTY; without even the implied warranty of
00050     MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
00051     GNU General Public License for more details.
00052 
00053     You should have received a copy of the GNU General Public License
00054     along with this program.  If not, see <http://www.gnu.org/licenses/>.
00055  */
00056 
00057 QlReportInfo *
00058 ql_get_reportinfo (QlTabData * tab, gint report_index)
00059 {
00060     QlFieldInfo * field;
00061 
00062     g_return_val_if_fail (tab, NULL);
00063     field = (QlReportInfo*)g_hash_table_lookup (tab->file->report_ptr,
00064         GINT_TO_POINTER(report_index));
00065     return field;
00066 }
00067 
00068 gboolean
00069 ql_add_reportinfo (QlTabData * tab, QlReportInfo * report)
00070 {
00071     gint size;
00072     g_return_val_if_fail (tab, FALSE);
00073     g_return_val_if_fail (report, FALSE);
00074     size = g_hash_table_size (tab->file->report_ptr);
00075     g_hash_table_insert (tab->file->report_ptr, GINT_TO_POINTER(size), report);
00076     return TRUE;
00077 }
00078 
00079 gboolean
00080 ql_set_reportinfo (QlTabData * tab, QlReportInfo * report, gint report_index)
00081 {
00082     g_return_val_if_fail (tab, FALSE);
00083     g_return_val_if_fail (report, FALSE);
00084     g_return_val_if_fail (g_hash_table_lookup(tab->file->report,
00085         GINT_TO_POINTER(report_index)), FALSE);
00086     g_hash_table_replace (tab->file->report_ptr, GINT_TO_POINTER (report_index), report);
00087     return TRUE;
00088 }
00089 
00090 void
00091 ql_remove_reportinfo (QlTabData * tab, gint report_index)
00092 {
00093     g_return_if_fail (tab);
00094     g_return_if_fail (g_hash_table_lookup(tab->file->report_ptr,
00095         GINT_TO_POINTER(report_index)));
00096     g_hash_table_remove (tab->file->report_ptr, GINT_TO_POINTER (report_index));
00097 }
00098 
00099 gint
00100 ql_get_last_report (QlTabData * tab)
00101 {
00102     g_return_val_if_fail (tab, -1);
00103     return g_hash_table_size (tab->file->report_ptr);
00104 }
00105 
00106 void
00107 ql_fieldinfo_foreach (QlTabData * tab, QlReportInfoCB cb, gpointer user_data)
00108 {
00109     g_return_if_fail (tab);
00110     g_hash_table_foreach (tab->file->report_ptr, cb, user_data);
00111 }
00112 

Generated on Mon Jan 28 22:02:10 2008 for quicklist by  doxygen 1.5.4