Blame lasso/xml/sa_parameter.c

Packit 228f82
/* $Id$
Packit 228f82
 *
Packit 228f82
 * Lasso - A free implementation of the Liberty Alliance specifications.
Packit 228f82
 *
Packit 228f82
 * Copyright (C) 2004-2007 Entr'ouvert
Packit 228f82
 * http://lasso.entrouvert.org
Packit 228f82
 *
Packit 228f82
 * Authors: See AUTHORS file in top-level directory.
Packit 228f82
 *
Packit 228f82
 * This program is free software; you can redistribute it and/or modify
Packit 228f82
 * it under the terms of the GNU General Public License as published by
Packit 228f82
 * the Free Software Foundation; either version 2 of the License, or
Packit 228f82
 * (at your option) any later version.
Packit 228f82
 *
Packit 228f82
 * This program is distributed in the hope that it will be useful,
Packit 228f82
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
Packit 228f82
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
Packit 228f82
 * GNU General Public License for more details.
Packit 228f82
 *
Packit 228f82
 * You should have received a copy of the GNU General Public License
Packit 228f82
 * along with this program; if not, see <http://www.gnu.org/licenses/>.
Packit 228f82
 */
Packit 228f82
Packit 228f82
#include "private.h"
Packit 228f82
#include "sa_parameter.h"
Packit 228f82
#include "idwsf_strings.h"
Packit 228f82
Packit 228f82
/**
Packit 228f82
 * SECTION:sa_parameter
Packit 228f82
 * @short_description: <sa:Parameter>
Packit 228f82
 *
Packit 228f82
 * <figure><title>Schema fragment for sa:Parameter</title>
Packit 228f82
 * <programlisting>
Packit 228f82
 *
Packit 228f82
 *  <xs:element name="Parameter" minOccurs="0" maxOccurs="unbounded">
Packit 228f82
 *  <xs:complexType>
Packit 228f82
 *    <xs:simpleContent>
Packit 228f82
 *      <xs:extension base="xs:string">
Packit 228f82
 *        <xs:attribute name="name" type="xs:string" use="required"/>
Packit 228f82
 *      </xs:extension>
Packit 228f82
 *    </xs:simpleContent>
Packit 228f82
 *  </xs:complexType>
Packit 228f82
 *  </xs:element>
Packit 228f82
 * ]]></programlisting>
Packit 228f82
 * </figure>
Packit 228f82
 */
Packit 228f82
Packit 228f82
/*****************************************************************************/
Packit 228f82
/* private methods                                                           */
Packit 228f82
/*****************************************************************************/
Packit 228f82
Packit 228f82
static struct XmlSnippet schema_snippets[] = {
Packit 228f82
	{ "content", SNIPPET_TEXT_CHILD, G_STRUCT_OFFSET(LassoSaParameter, content), NULL, NULL, NULL},
Packit 228f82
	{ "name", SNIPPET_ATTRIBUTE, G_STRUCT_OFFSET(LassoSaParameter, name), NULL, NULL, NULL},
Packit 228f82
	{NULL, 0, 0, NULL, NULL, NULL}
Packit 228f82
};
Packit 228f82
Packit 228f82
/*****************************************************************************/
Packit 228f82
/* instance and class init functions                                         */
Packit 228f82
/*****************************************************************************/
Packit 228f82
Packit 228f82
Packit 228f82
static void
Packit 228f82
class_init(LassoSaParameterClass *klass)
Packit 228f82
{
Packit 228f82
	LassoNodeClass *nclass = LASSO_NODE_CLASS(klass);
Packit 228f82
Packit 228f82
	nclass->node_data = g_new0(LassoNodeClassData, 1);
Packit 228f82
	lasso_node_class_set_nodename(nclass, "Parameter");
Packit 228f82
	lasso_node_class_set_ns(nclass, LASSO_SA_HREF, LASSO_SA_PREFIX);
Packit 228f82
	lasso_node_class_add_snippets(nclass, schema_snippets);
Packit 228f82
}
Packit 228f82
Packit 228f82
GType
Packit 228f82
lasso_sa_parameter_get_type()
Packit 228f82
{
Packit 228f82
	static GType this_type = 0;
Packit 228f82
Packit 228f82
	if (!this_type) {
Packit 228f82
		static const GTypeInfo this_info = {
Packit 228f82
			sizeof (LassoSaParameterClass),
Packit 228f82
			NULL,
Packit 228f82
			NULL,
Packit 228f82
			(GClassInitFunc) class_init,
Packit 228f82
			NULL,
Packit 228f82
			NULL,
Packit 228f82
			sizeof(LassoSaParameter),
Packit 228f82
			0,
Packit 228f82
			NULL,
Packit 228f82
			NULL
Packit 228f82
		};
Packit 228f82
Packit 228f82
		this_type = g_type_register_static(LASSO_TYPE_NODE,
Packit 228f82
				"LassoSaParameter", &this_info, 0);
Packit 228f82
	}
Packit 228f82
	return this_type;
Packit 228f82
}
Packit 228f82
Packit 228f82
LassoSaParameter*
Packit 228f82
lasso_sa_parameter_new(const char *content, const char *name)
Packit 228f82
{
Packit 228f82
	LassoSaParameter *node;
Packit 228f82
Packit 228f82
	g_return_val_if_fail(content != NULL, NULL);
Packit 228f82
	g_return_val_if_fail(name != NULL, NULL);
Packit 228f82
Packit 228f82
	node = g_object_new(LASSO_TYPE_SA_PARAMETER, NULL);
Packit 228f82
	node->content = g_strdup(content);
Packit 228f82
	node->name = g_strdup(name);
Packit 228f82
Packit 228f82
	return node;
Packit 228f82
}