gplate/gplate-collection.h
author Gary Kramlich <grim@reaperworld.com>
Sat Jul 03 23:24:33 2010 -0500 (22 months ago)
changeset 394 ad26d98e20e6
parent 291 310b912b92c7
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@11
     1
/*
grim@394
     2
 * Copyright (C) 2007-2010 Gary Kramlich <grim@reaperworld.com>
grim@11
     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@11
     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@11
    16
 */
grim@11
    17
#ifndef GPLATE_COLLECTION_H
grim@11
    18
#define GPLATE_COLLECTION_H
grim@11
    19
grim@11
    20
#include <glib.h>
grim@11
    21
#include <glib-object.h>
grim@11
    22
grim@11
    23
#include <gplate/gplate-variable.h>
grim@11
    24
grim@244
    25
#include <gplate/gplate-iterator.h>
grim@244
    26
grim@11
    27
#define GPLATE_TYPE_COLLECTION				(gplate_collection_get_gtype())
grim@11
    28
#define GPLATE_COLLECTION(obj)				(G_TYPE_CHECK_INSTANCE_CAST((obj), GPLATE_TYPE_COLLECTION, GPlateCollection))
grim@11
    29
#define GPLATE_IS_COLLECTION(obj)			(G_TYPE_CHECK_INSTANCE_TYPE((obj), GPLATE_TYPE_COLLECTION))
grim@11
    30
#define GPLATE_COLLECTION_GET_IFACE(obj)	(G_TYPE_INSTANCE_GET_INTERFACE((obj), GPLATE_TYPE_COLLECTION, GPlateCollectionIface))
grim@11
    31
grim@11
    32
typedef struct _GPlateCollection			GPlateCollection;
grim@11
    33
typedef struct _GPlateCollectionIface		GPlateCollectionIface;
grim@11
    34
grim@11
    35
struct _GPlateCollectionIface {
grim@11
    36
	GTypeInterface gparent;
grim@11
    37
grim@11
    38
	GPlateVariable *(*find_variable)(const GPlateCollection *collection, const gchar *name);
grim@291
    39
	gboolean (*add_variable_with_name)(GPlateCollection *collection, const gchar *name, GPlateVariable *variable);
grim@275
    40
rekkanoryo@260
    41
	gboolean (*remove_variable)(GPlateCollection *collection, GPlateVariable *variable);
grim@275
    42
	gboolean (*remove_all)(GPlateCollection *collection);
grim@11
    43
grim@248
    44
	GPlateIterator *(*get_iterator)(GPlateCollection *collection);
grim@244
    45
grim@11
    46
	void (*_gplate_reserved1)(void);
grim@11
    47
	void (*_gplate_reserved2)(void);
grim@11
    48
	void (*_gplate_reserved3)(void);
grim@11
    49
	void (*_gplate_reserved4)(void);
grim@11
    50
};
grim@11
    51
grim@11
    52
G_BEGIN_DECLS
grim@11
    53
grim@51
    54
#define gplate_collection_add(collection, type, name, value) { \
grim@51
    55
	GPlateVariable *var = NULL; \
grim@51
    56
	\
grim@104
    57
	var = gplate_variable_new_from_##type((name), (value)); \
grim@51
    58
	gplate_collection_add_variable(GPLATE_COLLECTION(collection), (var));\
grim@51
    59
}
grim@51
    60
grim@51
    61
#define gplate_collection_add_string(collection, name, value) \
grim@51
    62
	gplate_collection_add((collection), string, (name), (value));
grim@51
    63
grim@51
    64
#define gplate_collection_add_boolean(collection, name, value) \
grim@51
    65
	gplate_collection_add((collection), boolean, (name), (value));
grim@51
    66
grim@51
    67
#define gplate_collection_add_integer(collection, name, value) \
grim@51
    68
	gplate_collection_add((collection), integer, (name), (value));
grim@51
    69
grim@51
    70
#define gplate_collection_add_float(collection, name, value) \
grim@51
    71
	gplate_collection_add((collection), float, (name), (value));
grim@51
    72
grim@51
    73
#define gplate_collection_add_double(collection, name, value) \
grim@51
    74
	gplate_collection_add((collection), double, (name), (value));
grim@51
    75
grim@11
    76
GType gplate_collection_get_gtype(void);
grim@11
    77
grim@11
    78
GPlateVariable *gplate_collection_find_variable(const GPlateCollection *collection, const gchar *name);
grim@289
    79
const gchar *gplate_collection_lookup(const GPlateCollection *collection, const gchar *name);
grim@11
    80
gboolean gplate_collection_add_variable(GPlateCollection *collection, GPlateVariable *variable);
grim@291
    81
gboolean gplate_collection_add_variable_with_name(GPlateCollection *collection, const gchar *name, GPlateVariable *variable);
grim@275
    82
rekkanoryo@260
    83
gboolean gplate_collection_remove_variable(GPlateCollection *collection, GPlateVariable *variable);
grim@275
    84
gboolean gplate_collection_remove_all(GPlateCollection *collection);
grim@11
    85
grim@248
    86
GPlateIterator *gplate_collection_get_iterator(GPlateCollection *collection);
grim@244
    87
grim@11
    88
G_END_DECLS
grim@11
    89
grim@11
    90
#endif /* GPLATE_COLLECTION_H */