1 /* -*- Mode: C; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 8 -*- */
4 * (LIBGLABELS) Template library for GLABELS
6 * db.h: template db module header file
8 * Copyright (C) 2006-2007 Jim Evins <evins@snaught.com>.
10 * This file is part of the LIBGLABELS library.
12 * This library is free software; you can redistribute it and/or
13 * modify it under the terms of the GNU Library General Public
14 * License as published by the Free Software Foundation; either
15 * version 2 of the License, or (at your option) any later version.
17 * This library is distributed in the hope that it will be useful,
18 * but WITHOUT ANY WARRANTY; without even the implied warranty of
19 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
20 * Library General Public License for more details.
22 * You should have received a copy of the GNU Library General Public
23 * License along with this library; if not, write to the Free
24 * Software Foundation, Inc., 59 Temple Place - Suite 330, Boston,
31 #include <glib/gtypes.h>
32 #include <glib/glist.h>
43 LGL_DB_REG_BAD_PAPER_ID = -1,
44 LGL_DB_REG_BRAND_PART_EXISTS = -2,
45 LGL_DB_REG_FILE_WRITE_ERROR = -3
49 * Module initialization
51 void lgl_db_init (void);
57 GList *lgl_db_get_paper_id_list (void);
59 void lgl_db_free_paper_id_list (GList *ids);
61 GList *lgl_db_get_paper_name_list (void);
63 void lgl_db_free_paper_name_list (GList *names);
65 lglPaper *lgl_db_lookup_paper_from_name (const gchar *name);
67 lglPaper *lgl_db_lookup_paper_from_id (const gchar *id);
69 gchar *lgl_db_lookup_paper_id_from_name (const gchar *name);
71 gchar *lgl_db_lookup_paper_name_from_id (const gchar *id);
73 gboolean lgl_db_is_paper_id_known (const gchar *id);
75 gboolean lgl_db_is_paper_id_other (const gchar *id);
82 GList *lgl_db_get_category_id_list (void);
84 void lgl_db_free_category_id_list (GList *ids);
86 GList *lgl_db_get_category_name_list (void);
88 void lgl_db_free_category_name_list (GList *names);
90 lglCategory *lgl_db_lookup_category_from_name (const gchar *name);
92 lglCategory *lgl_db_lookup_category_from_id (const gchar *id);
94 gchar *lgl_db_lookup_category_id_from_name (const gchar *name);
96 gchar *lgl_db_lookup_category_name_from_id (const gchar *id);
98 gboolean lgl_db_is_category_id_known (const gchar *id);
104 GList *lgl_db_get_brand_list (const gchar *paper_id,
105 const gchar *category_id);
107 void lgl_db_free_brand_list (GList *brands);
113 lglDbRegStatus lgl_db_register_template (const lglTemplate *template);
115 gboolean lgl_db_does_template_exist (const gchar *brand,
118 gboolean lgl_db_does_template_name_exist (const gchar *name);
120 GList *lgl_db_get_template_name_list_unique (const gchar *brand,
121 const gchar *paper_id,
122 const gchar *category_id);
124 GList *lgl_db_get_template_name_list_all (const gchar *brand,
125 const gchar *paper_id,
126 const gchar *category_id);
128 void lgl_db_free_template_name_list (GList *names);
130 lglTemplate *lgl_db_lookup_template_from_name (const gchar *name);
134 * Debugging functions
136 void lgl_db_print_known_papers (void);
138 void lgl_db_print_known_categories (void);
140 void lgl_db_print_known_templates (void);
142 void lgl_db_print_aliases (const lglTemplate *template);