gplate/gplate-template.h
author Gary Kramlich <grim@reaperworld.com>
Sat Jul 03 23:24:33 2010 -0500 (22 months ago)
changeset 394 ad26d98e20e6
parent 332 50427237b04b
permissions -rw-r--r--
Changed the license from gplv2 to gplv3
Updated copyrights to be 2007-2010 rather than 2007-2008 (since just about everything has been touched recently
Ignored the top level tests/ directory for now since that is slowly being replaced
grim@0
     1
/*
grim@394
     2
 * Copyright (C) 2007-2010 Gary Kramlich <grim@reaperworld.com>
grim@0
     3
 *
grim@394
     4
 * This program is free software: you can redistribute it and/or modify
grim@394
     5
 * it under the terms of the GNU General Public License as published by
grim@394
     6
 * the Free Software Foundation, either version 3 of the License, or
grim@394
     7
 * (at your option) any later version.
grim@0
     8
 *
grim@394
     9
 * This program is distributed in the hope that it will be useful,
grim@394
    10
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
grim@394
    11
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
grim@394
    12
 * GNU General Public License for more details.
grim@394
    13
 *
grim@394
    14
 * You should have received a copy of the GNU General Public License
grim@394
    15
 * along with this program.  If not, see <http://www.gnu.org/licenses/>.
grim@0
    16
 */
grim@0
    17
#ifndef GPLATE_TEMPLATE_H
grim@0
    18
#define GPLATE_TEMPLATE_H
grim@0
    19
grim@0
    20
#include <glib.h>
grim@0
    21
#include <glib-object.h>
grim@0
    22
grim@0
    23
#define GPLATE_TYPE_TEMPLATE			(gplate_template_get_gtype())
grim@0
    24
#define GPLATE_TEMPLATE(obj)			(G_TYPE_CHECK_INSTANCE_CAST((obj), GPLATE_TYPE_TEMPLATE, GPlateTemplate))
grim@0
    25
#define GPLATE_TEMPLATE_CLASS(klass)	(G_TYPE_CHECK_CLASS_CAST((klass), GPLATE_TYPE_TEMPLATE, GPlateTemplateClass))
grim@0
    26
#define GPLATE_IS_TEMPLATE(obj)			(G_TYPE_CHECK_INSTANCE_TYPE((obj), GPLATE_TYPE_TEMPLATE))
grim@0
    27
#define GPLATE_IS_TEMPLATE_CLASS(klass)	(G_TYPE_CHECK_CLASS_TYPE((klass), GPLATE_TYPE_TEMPLATE))
grim@0
    28
#define GPLATE_TEMPLATE_GET_CLASS(obj)	(G_TYPE_INSTANCE_GET_CLASS((obj), GPLATE_TYPE_TEMPLATE, GPlateTemplateClass))
grim@0
    29
grim@0
    30
typedef struct _GPlateTemplate			GPlateTemplate;
grim@0
    31
typedef struct _GPlateTemplateClass		GPlateTemplateClass;
grim@0
    32
grim@197
    33
#include <gplate/gplate-tag.h>
grim@197
    34
grim@0
    35
struct _GPlateTemplate {
grim@0
    36
	GObject gparent;
grim@0
    37
grim@0
    38
	void (*_gplate_reserved1)(void);
grim@0
    39
	void (*_gplate_reserved2)(void);
grim@0
    40
	void (*_gplate_reserved3)(void);
grim@0
    41
	void (*_gplate_reserved4)(void);
grim@0
    42
};
grim@0
    43
grim@0
    44
struct _GPlateTemplateClass {
grim@0
    45
	GObjectClass parent;
grim@0
    46
grim@83
    47
	GList *(*tokenize)(GPlateTemplate *tplate, const gchar *tplate_string, GError **error);
grim@205
    48
	gchar *(*render)(GPlateTemplate *tplate, const gchar *tplate_string, GError **error);
grim@80
    49
grim@168
    50
	GPlateTag *(*first_tag)(GPlateTemplate *tplate);
grim@168
    51
	GPlateTag *(*last_tag)(GPlateTemplate *tplate);
grim@195
    52
	GPlateTag *(*current_tag)(GPlateTemplate *tplate);
grim@168
    53
	GPlateTag *(*next_tag)(GPlateTemplate *tplate);
grim@168
    54
	GPlateTag *(*previous_tag)(GPlateTemplate *tplate);
grim@195
    55
	GPlateTag *(*nth_tag)(GPlateTemplate *tplate, guint nth);
grim@195
    56
	GPlateTag *(*nth_previous_tag)(GPlateTemplate *tplate, guint nth);
grim@220
    57
	
grim@220
    58
	void (*insert_tags)(GPlateTemplate *tplate, GList *tags);
grim@168
    59
grim@0
    60
	void (*_gplate_reserved1)(void);
grim@0
    61
	void (*_gplate_reserved2)(void);
grim@0
    62
	void (*_gplate_reserved3)(void);
grim@0
    63
	void (*_gplate_reserved4)(void);
grim@0
    64
};
grim@0
    65
grim@0
    66
G_BEGIN_DECLS
grim@0
    67
grim@0
    68
GType gplate_template_get_gtype(void);
grim@7
    69
grim@7
    70
GPlateTemplate *gplate_template_new(void);
grim@0
    71
grim@159
    72
GList *gplate_template_tokenize(GPlateTemplate *tplate, const gchar *tplate_string, GError **error);
grim@159
    73
grim@80
    74
gchar *gplate_template_render(GPlateTemplate *tplate, const gchar *tplate_string, GError **error);
grim@80
    75
gchar *gplate_template_render_file(GPlateTemplate *tplate, const gchar *filename, GError **error);
grim@80
    76
grim@332
    77
gchar *gplate_template_render_until(GPlateTemplate *tplate, guint *ntags, ...);
grim@332
    78
grim@332
    79
void gplate_template_jump_to(GPlateTemplate *tplate, guint *ntags, ...);
grim@314
    80
grim@168
    81
GPlateTag *gplate_template_first_tag(GPlateTemplate *tplate);
grim@168
    82
GPlateTag *gplate_template_last_tag(GPlateTemplate *tplate);
grim@195
    83
GPlateTag *gplate_template_current_tag(GPlateTemplate *tplate);
grim@168
    84
GPlateTag *gplate_template_next_tag(GPlateTemplate *tplate);
grim@168
    85
GPlateTag *gplate_template_previous_tag(GPlateTemplate *tplate);
grim@195
    86
GPlateTag *gplate_template_nth_tag(GPlateTemplate *tplate, guint nth);
grim@195
    87
GPlateTag *gplate_template_nth_previous_tag(GPlateTemplate *tplate, guint nth);
grim@168
    88
grim@220
    89
void gplate_template_insert_tags(GPlateTemplate *tplate, GList *tags);
grim@220
    90
grim@264
    91
gchar *gplate_template_render_tag(GPlateTemplate *tplate, const GPlateTag *tag);
grim@264
    92
grim@273
    93
void gplate_template_set_working_directory(GPlateTemplate *tplate, const gchar *wd);
grim@273
    94
const gchar *gplate_template_get_working_directory(const GPlateTemplate *tplate);
grim@273
    95
grim@0
    96
G_END_DECLS
grim@0
    97
grim@0
    98
#endif /* GPLATE_TEMPLATE_H */