/* c/zx-xac-dec.c - WARNING: This file was auto generated by xsd2sg.pl. DO NOT EDIT!
 * $Id$ */
/* Code generation design Copyright (c) 2006 Sampo Kellomaki (sampo@iki.fi),
 * All Rights Reserved. NO WARRANTY. See file COPYING for terms and conditions
 * of use. Some aspects of code generation were driven by schema
 * descriptions that were used as input and may be subject to their own copyright.
 * Code generation uses a template, whose copyright statement follows. */

/** dec-templ.c  -  XML decoder template, used in code generation
 ** Copyright (c) 2010 Sampo Kellomaki (sampo@iki.fi), All Rights Reserved.
 ** Copyright (c) 2006-2007 Symlabs (symlabs@symlabs.com), All Rights Reserved.
 ** Author: Sampo Kellomaki (sampo@iki.fi)
 ** This is confidential unpublished proprietary source code of the author.
 ** NO WARRANTY, not even implied warranties. Contains trade secrets.
 ** Distribution prohibited unless authorized in writing.
 ** Licensed under Apache License 2.0, see file COPYING.
 ** Id: dec-templ.c,v 1.30 2008-10-04 23:42:14 sampo Exp $
 **
 ** 28.5.2006, created, Sampo Kellomaki (sampo@iki.fi)
 ** 8.8.2006,  reworked namespace handling --Sampo
 ** 12.8.2006, added special scanning of xmlns to avoid backtracking elem recognition --Sampo
 ** 23.9.2006, added collection of WO information --Sampo
 ** 21.6.2007, improved handling of undeclared namespace prefixes --Sampo
 ** 27.10.2010, CSE refactoring, re-engineered namespace handling --Sampo
 ** 21.11.2010, re-engineered to extract most code to zx_DEC_elem, leaving just switches --Sampo
 **
 ** N.B: This template is meant to be processed by pd/xsd2sg.pl. Beware
 ** of special markers that xsd2sg.pl expects to find and understand.
 **/

#include "errmac.h"
#include "zx.h"
#include "c/zx-const.h"
#include "c/zx-data.h"
#include "c/zx-xac-data.h"
#define TPF zx_
#include "zx_ext_pt.h"



int zx_DEC_ATTR_xac_Action(struct zx_ctx* c, struct zx_xac_Action_s* x)
{
  switch (x->gg.attr->g.tok) {

  default: return 0;
  }
}

int zx_DEC_ELEM_xac_Action(struct zx_ctx* c, struct zx_xac_Action_s* x)
{
  struct zx_elem_s* el = x->gg.kids;
  switch (el->g.tok) {
  case zx_xac_Attribute_ELEM:
    if (!x->Attribute)
      x->Attribute = (struct zx_xac_Attribute_s*)el;
    return 1;

  default: return 0;
  }
}




int zx_DEC_ATTR_xac_Attribute(struct zx_ctx* c, struct zx_xac_Attribute_s* x)
{
  switch (x->gg.attr->g.tok) {
    case zx_AttributeId_ATTR:  x->AttributeId = x->gg.attr; return 1;
    case zx_DataType_ATTR:  x->DataType = x->gg.attr; return 1;
    case zx_Issuer_ATTR:  x->Issuer = x->gg.attr; return 1;

  default: return 0;
  }
}

int zx_DEC_ELEM_xac_Attribute(struct zx_ctx* c, struct zx_xac_Attribute_s* x)
{
  struct zx_elem_s* el = x->gg.kids;
  switch (el->g.tok) {
  case zx_xac_AttributeValue_ELEM:
    if (!x->AttributeValue)
      x->AttributeValue = el;
    return 1;

  default: return 0;
  }
}




int zx_DEC_ATTR_xac_Environment(struct zx_ctx* c, struct zx_xac_Environment_s* x)
{
  switch (x->gg.attr->g.tok) {

  default: return 0;
  }
}

int zx_DEC_ELEM_xac_Environment(struct zx_ctx* c, struct zx_xac_Environment_s* x)
{
  struct zx_elem_s* el = x->gg.kids;
  switch (el->g.tok) {
  case zx_xac_Attribute_ELEM:
    if (!x->Attribute)
      x->Attribute = (struct zx_xac_Attribute_s*)el;
    return 1;

  default: return 0;
  }
}




int zx_DEC_ATTR_xac_MissingAttributeDetail(struct zx_ctx* c, struct zx_xac_MissingAttributeDetail_s* x)
{
  switch (x->gg.attr->g.tok) {
    case zx_AttributeId_ATTR:  x->AttributeId = x->gg.attr; return 1;
    case zx_DataType_ATTR:  x->DataType = x->gg.attr; return 1;
    case zx_Issuer_ATTR:  x->Issuer = x->gg.attr; return 1;

  default: return 0;
  }
}

int zx_DEC_ELEM_xac_MissingAttributeDetail(struct zx_ctx* c, struct zx_xac_MissingAttributeDetail_s* x)
{
  struct zx_elem_s* el = x->gg.kids;
  switch (el->g.tok) {
  case zx_xac_AttributeValue_ELEM:
    if (!x->AttributeValue)
      x->AttributeValue = el;
    return 1;

  default: return 0;
  }
}




int zx_DEC_ATTR_xac_Request(struct zx_ctx* c, struct zx_xac_Request_s* x)
{
  switch (x->gg.attr->g.tok) {

  default: return 0;
  }
}

int zx_DEC_ELEM_xac_Request(struct zx_ctx* c, struct zx_xac_Request_s* x)
{
  struct zx_elem_s* el = x->gg.kids;
  switch (el->g.tok) {
  case zx_xac_Subject_ELEM:
    if (!x->Subject)
      x->Subject = (struct zx_xac_Subject_s*)el;
    return 1;
  case zx_xac_Resource_ELEM:
    if (!x->Resource)
      x->Resource = (struct zx_xac_Resource_s*)el;
    return 1;
  case zx_xac_Action_ELEM:
    if (!x->Action)
      x->Action = (struct zx_xac_Action_s*)el;
    return 1;
  case zx_xac_Environment_ELEM:
    if (!x->Environment)
      x->Environment = (struct zx_xac_Environment_s*)el;
    return 1;

  default: return 0;
  }
}




int zx_DEC_ATTR_xac_Resource(struct zx_ctx* c, struct zx_xac_Resource_s* x)
{
  switch (x->gg.attr->g.tok) {

  default: return 0;
  }
}

int zx_DEC_ELEM_xac_Resource(struct zx_ctx* c, struct zx_xac_Resource_s* x)
{
  struct zx_elem_s* el = x->gg.kids;
  switch (el->g.tok) {
  case zx_xac_ResourceContent_ELEM:
    if (!x->ResourceContent)
      x->ResourceContent = (struct zx_xac_ResourceContent_s*)el;
    return 1;
  case zx_xac_Attribute_ELEM:
    if (!x->Attribute)
      x->Attribute = (struct zx_xac_Attribute_s*)el;
    return 1;

  default: return 0;
  }
}




int zx_DEC_ATTR_xac_ResourceContent(struct zx_ctx* c, struct zx_xac_ResourceContent_s* x)
{
  switch (x->gg.attr->g.tok) {

  default: return 0;
  }
}

int zx_DEC_ELEM_xac_ResourceContent(struct zx_ctx* c, struct zx_xac_ResourceContent_s* x)
{
  struct zx_elem_s* el = x->gg.kids;
  switch (el->g.tok) {

  default: return 0;
  }
}




int zx_DEC_ATTR_xac_Response(struct zx_ctx* c, struct zx_xac_Response_s* x)
{
  switch (x->gg.attr->g.tok) {

  default: return 0;
  }
}

int zx_DEC_ELEM_xac_Response(struct zx_ctx* c, struct zx_xac_Response_s* x)
{
  struct zx_elem_s* el = x->gg.kids;
  switch (el->g.tok) {
  case zx_xac_Result_ELEM:
    if (!x->Result)
      x->Result = (struct zx_xac_Result_s*)el;
    return 1;

  default: return 0;
  }
}




int zx_DEC_ATTR_xac_Result(struct zx_ctx* c, struct zx_xac_Result_s* x)
{
  switch (x->gg.attr->g.tok) {
    case zx_ResourceId_ATTR:  x->ResourceId = x->gg.attr; return 1;

  default: return 0;
  }
}

int zx_DEC_ELEM_xac_Result(struct zx_ctx* c, struct zx_xac_Result_s* x)
{
  struct zx_elem_s* el = x->gg.kids;
  switch (el->g.tok) {
  case zx_xac_Decision_ELEM:
    if (!x->Decision)
      x->Decision = el;
    return 1;
  case zx_xac_Status_ELEM:
    if (!x->Status)
      x->Status = (struct zx_xac_Status_s*)el;
    return 1;
  case zx_xa_Obligations_ELEM:
    if (!x->Obligations)
      x->Obligations = (struct zx_xa_Obligations_s*)el;
    return 1;

  default: return 0;
  }
}




int zx_DEC_ATTR_xac_Status(struct zx_ctx* c, struct zx_xac_Status_s* x)
{
  switch (x->gg.attr->g.tok) {

  default: return 0;
  }
}

int zx_DEC_ELEM_xac_Status(struct zx_ctx* c, struct zx_xac_Status_s* x)
{
  struct zx_elem_s* el = x->gg.kids;
  switch (el->g.tok) {
  case zx_xac_StatusCode_ELEM:
    if (!x->StatusCode)
      x->StatusCode = (struct zx_xac_StatusCode_s*)el;
    return 1;
  case zx_xac_StatusMessage_ELEM:
    if (!x->StatusMessage)
      x->StatusMessage = el;
    return 1;
  case zx_xac_StatusDetail_ELEM:
    if (!x->StatusDetail)
      x->StatusDetail = (struct zx_xac_StatusDetail_s*)el;
    return 1;

  default: return 0;
  }
}




int zx_DEC_ATTR_xac_StatusCode(struct zx_ctx* c, struct zx_xac_StatusCode_s* x)
{
  switch (x->gg.attr->g.tok) {
    case zx_Value_ATTR:  x->Value = x->gg.attr; return 1;

  default: return 0;
  }
}

int zx_DEC_ELEM_xac_StatusCode(struct zx_ctx* c, struct zx_xac_StatusCode_s* x)
{
  struct zx_elem_s* el = x->gg.kids;
  switch (el->g.tok) {
  case zx_xac_StatusCode_ELEM:
    if (!x->StatusCode)
      x->StatusCode = (struct zx_xac_StatusCode_s*)el;
    return 1;

  default: return 0;
  }
}




int zx_DEC_ATTR_xac_StatusDetail(struct zx_ctx* c, struct zx_xac_StatusDetail_s* x)
{
  switch (x->gg.attr->g.tok) {

  default: return 0;
  }
}

int zx_DEC_ELEM_xac_StatusDetail(struct zx_ctx* c, struct zx_xac_StatusDetail_s* x)
{
  struct zx_elem_s* el = x->gg.kids;
  switch (el->g.tok) {

  default: return 0;
  }
}




int zx_DEC_ATTR_xac_Subject(struct zx_ctx* c, struct zx_xac_Subject_s* x)
{
  switch (x->gg.attr->g.tok) {
    case zx_SubjectCategory_ATTR:  x->SubjectCategory = x->gg.attr; return 1;

  default: return 0;
  }
}

int zx_DEC_ELEM_xac_Subject(struct zx_ctx* c, struct zx_xac_Subject_s* x)
{
  struct zx_elem_s* el = x->gg.kids;
  switch (el->g.tok) {
  case zx_xac_Attribute_ELEM:
    if (!x->Attribute)
      x->Attribute = (struct zx_xac_Attribute_s*)el;
    return 1;

  default: return 0;
  }
}


/* EOF -- c/zx-xac-dec.c */
