grim/gplate
Clone
Summary
Browse
Changes
Graph
fixed the name space issues for the for function test
2010-07-04, Gary Kramlich
9b903d04907a
fixed the name space issues for the for function test
/*
* Copyright (C) 2007-2010 Gary Kramlich <grim@reaperworld.com>
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
#ifdef HAVE_CONFIG_H
#
include
<config.h>
#endif
/* HAVE_CONFIG_H */
#include
<gplate/gplate-function.h>
/******************************************************************************
* GPlateFunction API
*****************************************************************************/
GType
gplate_function_get_gtype
(
void
)
{
static
GType
type
=
0
;
if
(
type
==
0
)
{
static
const
GTypeInfo
info
=
{
sizeof
(
GPlateFunctionClass
),
NULL
,
NULL
,
NULL
,
NULL
,
NULL
,
sizeof
(
GPlateFunction
),
0
,
NULL
,
};
type
=
g_type_register_static
(
G_TYPE_OBJECT
,
"GPlateFunction"
,
&
info
,
G_TYPE_FLAG_ABSTRACT
);
}
return
type
;
}
/**
* gplate_function_evaluate:
* @function: The #GPlateFunction.
* @tplate: The #GPlateTemplate that @function is being evaluated for.
* @contents: The contents for the function to use.
*
* Evaluates @contents using @function for @tplate.
*
* Return Value: The evaluated output.
*/
gchar
*
gplate_function_evaluate
(
GPlateFunction
*
function
,
GPlateTemplate
*
tplate
,
const
gchar
*
contents
)
{
GPlateFunctionClass
*
klass
=
NULL
;
g_return_val_if_fail
(
GPLATE_IS_FUNCTION
(
function
),
NULL
);
klass
=
GPLATE_FUNCTION_GET_CLASS
(
function
);
if
(
klass
&&
klass
->
evaluate
)
return
klass
->
evaluate
(
function
,
tplate
,
contents
);
return
NULL
;
}