2 * Copyright (C) 2007-2010 Gary Kramlich <grim@reaperworld.com>
4 * This program is free software: you can redistribute it and/or modify
5 * it under the terms of the GNU General Public License as published by
6 * the Free Software Foundation, either version 3 of the License, or
7 * (at your option) any later version.
9 * This program is distributed in the hope that it will be useful,
10 * but WITHOUT ANY WARRANTY; without even the implied warranty of
11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 * GNU General Public License for more details.
14 * You should have received a copy of the GNU General Public License
15 * along with this program. If not, see <http://www.gnu.org/licenses/>.
17 #ifndef GPLATE_TEMPLATE_H
18 #define GPLATE_TEMPLATE_H
21 #include <glib-object.h>
23 #define GPLATE_TYPE_TEMPLATE (gplate_template_get_gtype())
24 #define GPLATE_TEMPLATE(obj) (G_TYPE_CHECK_INSTANCE_CAST((obj), GPLATE_TYPE_TEMPLATE, GPlateTemplate))
25 #define GPLATE_TEMPLATE_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST((klass), GPLATE_TYPE_TEMPLATE, GPlateTemplateClass))
26 #define GPLATE_IS_TEMPLATE(obj) (G_TYPE_CHECK_INSTANCE_TYPE((obj), GPLATE_TYPE_TEMPLATE))
27 #define GPLATE_IS_TEMPLATE_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE((klass), GPLATE_TYPE_TEMPLATE))
28 #define GPLATE_TEMPLATE_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS((obj), GPLATE_TYPE_TEMPLATE, GPlateTemplateClass))
30 typedef struct _GPlateTemplate GPlateTemplate;
31 typedef struct _GPlateTemplateClass GPlateTemplateClass;
33 #include <gplate/gplate-tag.h>
35 struct _GPlateTemplate {
38 void (*_gplate_reserved1)(void);
39 void (*_gplate_reserved2)(void);
40 void (*_gplate_reserved3)(void);
41 void (*_gplate_reserved4)(void);
44 struct _GPlateTemplateClass {
47 GList *(*tokenize)(GPlateTemplate *tplate, const gchar *tplate_string, GError **error);
48 gchar *(*render)(GPlateTemplate *tplate, const gchar *tplate_string, GError **error);
50 GPlateTag *(*first_tag)(GPlateTemplate *tplate);
51 GPlateTag *(*last_tag)(GPlateTemplate *tplate);
52 GPlateTag *(*current_tag)(GPlateTemplate *tplate);
53 GPlateTag *(*next_tag)(GPlateTemplate *tplate);
54 GPlateTag *(*previous_tag)(GPlateTemplate *tplate);
55 GPlateTag *(*nth_tag)(GPlateTemplate *tplate, guint nth);
56 GPlateTag *(*nth_previous_tag)(GPlateTemplate *tplate, guint nth);
58 void (*insert_tags)(GPlateTemplate *tplate, GList *tags);
60 void (*_gplate_reserved1)(void);
61 void (*_gplate_reserved2)(void);
62 void (*_gplate_reserved3)(void);
63 void (*_gplate_reserved4)(void);
68 GType gplate_template_get_gtype(void);
70 GPlateTemplate *gplate_template_new(void);
72 GList *gplate_template_tokenize(GPlateTemplate *tplate, const gchar *tplate_string, GError **error);
74 gchar *gplate_template_render(GPlateTemplate *tplate, const gchar *tplate_string, GError **error);
75 gchar *gplate_template_render_file(GPlateTemplate *tplate, const gchar *filename, GError **error);
77 gchar *gplate_template_render_until(GPlateTemplate *tplate, guint *ntags, ...);
79 void gplate_template_jump_to(GPlateTemplate *tplate, guint *ntags, ...);
81 GPlateTag *gplate_template_first_tag(GPlateTemplate *tplate);
82 GPlateTag *gplate_template_last_tag(GPlateTemplate *tplate);
83 GPlateTag *gplate_template_current_tag(GPlateTemplate *tplate);
84 GPlateTag *gplate_template_next_tag(GPlateTemplate *tplate);
85 GPlateTag *gplate_template_previous_tag(GPlateTemplate *tplate);
86 GPlateTag *gplate_template_nth_tag(GPlateTemplate *tplate, guint nth);
87 GPlateTag *gplate_template_nth_previous_tag(GPlateTemplate *tplate, guint nth);
89 void gplate_template_insert_tags(GPlateTemplate *tplate, GList *tags);
91 gchar *gplate_template_render_tag(GPlateTemplate *tplate, const GPlateTag *tag);
93 void gplate_template_set_working_directory(GPlateTemplate *tplate, const gchar *wd);
94 const gchar *gplate_template_get_working_directory(const GPlateTemplate *tplate);
98 #endif /* GPLATE_TEMPLATE_H */