diff options
Diffstat (limited to 'lasso/xml/lib_idp_list.c')
-rw-r--r-- | lasso/xml/lib_idp_list.c | 48 |
1 files changed, 11 insertions, 37 deletions
diff --git a/lasso/xml/lib_idp_list.c b/lasso/xml/lib_idp_list.c index 747906f7..3ab00174 100644 --- a/lasso/xml/lib_idp_list.c +++ b/lasso/xml/lib_idp_list.c @@ -43,40 +43,11 @@ /* private methods */ /*****************************************************************************/ -#define snippets() \ - LassoLibIDPList *list = LASSO_LIB_IDP_LIST(node); \ - struct XmlSnippet snippets[] = { \ - { "IDPEntries", SNIPPET_NODE, (void**)&(list->IDPEntries) }, \ - { "GetComplete", SNIPPET_CONTENT, (void**)&(list->GetComplete) }, \ - { NULL, 0, NULL} \ - }; - -static LassoNodeClass *parent_class = NULL; - -static xmlNode* -get_xmlNode(LassoNode *node) -{ - xmlNode *xmlnode; - snippets(); - - xmlnode = xmlNewNode(NULL, "IDPList"); - xmlSetNs(xmlnode, xmlNewNs(xmlnode, LASSO_LIB_HREF, LASSO_LIB_PREFIX)); - build_xml_with_snippets(xmlnode, snippets); - - return xmlnode; -} - -static int -init_from_xml(LassoNode *node, xmlNode *xmlnode) -{ - snippets(); - - if (parent_class->init_from_xml(node, xmlnode)) - return -1; - init_xml_with_snippets(xmlnode, snippets); - return 0; -} - +static struct XmlSnippet schema_snippets[] = { + { "IDPEntries", SNIPPET_NODE, G_STRUCT_OFFSET(LassoLibIDPList, IDPEntries) }, + { "GetComplete", SNIPPET_CONTENT, G_STRUCT_OFFSET(LassoLibIDPList, GetComplete) }, + { NULL, 0, 0} +}; /*****************************************************************************/ /* instance and class init functions */ @@ -92,9 +63,12 @@ instance_init(LassoLibIDPList *node) static void class_init(LassoLibIDPListClass *klass) { - parent_class = g_type_class_peek_parent(klass); - LASSO_NODE_CLASS(klass)->get_xmlNode = get_xmlNode; - LASSO_NODE_CLASS(klass)->init_from_xml = init_from_xml; + LassoNodeClass *nclass = LASSO_NODE_CLASS(klass); + + nclass->node_data = g_new0(LassoNodeClassData, 1); + lasso_node_class_set_nodename(nclass, "IDPList"); + lasso_node_class_set_ns(nclass, LASSO_LIB_HREF, LASSO_LIB_PREFIX); + lasso_node_class_add_snippets(nclass, schema_snippets); } GType |