diff options
| author | Frederic Peters <fpeters@entrouvert.com> | 2004-12-02 14:54:43 +0000 |
|---|---|---|
| committer | Frederic Peters <fpeters@entrouvert.com> | 2004-12-02 14:54:43 +0000 |
| commit | 05577f56728d3fbae3f484e37e1202d6676b38e2 (patch) | |
| tree | 4979b780ebce2fd4eb3a1691661b3ea89402e89e /lasso/xml/lib_status_response.c | |
| parent | 169b16b94fc7a581b182307a610b91b1d944d0ae (diff) | |
| download | lasso-05577f56728d3fbae3f484e37e1202d6676b38e2.tar.gz lasso-05577f56728d3fbae3f484e37e1202d6676b38e2.tar.xz lasso-05577f56728d3fbae3f484e37e1202d6676b38e2.zip | |
last(?) iteration on XmlSnippet; now attached to classes, get_xmlNode and
init_from_xml are no longer necessary in many cases. Previous XmlSnippet
renamed to XmlSnippetObsolete to keep compatibility (id-wsf classes have not
yet been converted).
Diffstat (limited to 'lasso/xml/lib_status_response.c')
| -rw-r--r-- | lasso/xml/lib_status_response.c | 51 |
1 files changed, 14 insertions, 37 deletions
diff --git a/lasso/xml/lib_status_response.c b/lasso/xml/lib_status_response.c index 272c895b..04c4be22 100644 --- a/lasso/xml/lib_status_response.c +++ b/lasso/xml/lib_status_response.c @@ -57,42 +57,15 @@ /* private methods */ /*****************************************************************************/ -#define snippets() \ - LassoLibStatusResponse *response = LASSO_LIB_STATUS_RESPONSE(node); \ - struct XmlSnippet snippets[] = { \ - { "ProviderID", SNIPPET_CONTENT, (void**)&(response->ProviderID) }, \ - { "Status", SNIPPET_NODE, (void**)&(response->Status) }, \ - { "RelayState", SNIPPET_CONTENT, (void**)&(response->RelayState) }, \ - { NULL, 0, NULL} \ - }; +static struct XmlSnippet schema_snippets[] = { + { "ProviderID", SNIPPET_CONTENT, G_STRUCT_OFFSET(LassoLibStatusResponse, ProviderID) }, + { "Status", SNIPPET_NODE, G_STRUCT_OFFSET(LassoLibStatusResponse, Status) }, + { "RelayState", SNIPPET_CONTENT, G_STRUCT_OFFSET(LassoLibStatusResponse, RelayState) }, + { NULL, 0, 0} +}; static LassoNodeClass *parent_class = NULL; -static xmlNode* -get_xmlNode(LassoNode *node) -{ - xmlNode *xmlnode; - snippets(); - - xmlnode = parent_class->get_xmlNode(node); - xmlNodeSetName(xmlnode, "StatusResponse"); - 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 gchar* build_query(LassoNode *node) { @@ -174,11 +147,15 @@ instance_init(LassoLibStatusResponse *node) static void class_init(LassoLibStatusResponseClass *klass) { + LassoNodeClass *nclass = LASSO_NODE_CLASS(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; - LASSO_NODE_CLASS(klass)->build_query = build_query; - LASSO_NODE_CLASS(klass)->init_from_query = init_from_query; + nclass->build_query = build_query; + nclass->init_from_query = init_from_query; + nclass->node_data = g_new0(LassoNodeClassData, 1); + lasso_node_class_set_nodename(nclass, "StatusResponse"); + lasso_node_class_set_ns(nclass, LASSO_LIB_HREF, LASSO_LIB_PREFIX); + lasso_node_class_add_snippets(nclass, schema_snippets); } GType |
