You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

137 lines
3.8 KiB

7 years ago
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
  1. /******************************************************************
  2. * $Id: obj.h,v 1.3 2004/10/15 13:35:39 snowdrop Exp $
  3. *
  4. * CSOAP Project: A SOAP client/server library in C
  5. * Copyright (C) 2003 Ferhat Ayaz
  6. *
  7. * This library is free software; you can redistribute it and/or
  8. * modify it under the terms of the GNU Library General Public
  9. * License as published by the Free Software Foundation; either
  10. * version 2 of the License, or (at your option) any later version.
  11. *
  12. * This library is distributed in the hope that it will be useful,
  13. * but WITHOUT ANY WARRANTY; without even the implied warranty of
  14. * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
  15. * Library General Public License for more details.
  16. *
  17. * You should have received a copy of the GNU Library General Public
  18. * License along with this library; if not, write to the
  19. * Free Software Foundation, Inc., 59 Temple Place - Suite 330,
  20. * Boston, MA 02111-1307, USA.
  21. *
  22. * Email: ayaz@jprogrammer.net
  23. ******************************************************************/
  24. #ifndef XSD2C_OBJ_H
  25. #define XSD2C_OBJ_H
  26. #include "Enumeration.h"
  27. typedef struct FIELD* HFIELD;
  28. typedef struct COMPLEXTYPE* HCOMPLEXTYPE;
  29. typedef struct RESTRICTION* HRESTRICTION;
  30. typedef int (*CT_ENUM)(HCOMPLEXTYPE);
  31. struct FIELD
  32. {
  33. char *name;
  34. char *type;
  35. int flag;
  36. int minOccurs;
  37. int maxOccurs;
  38. char *attrName;
  39. HFIELD next;
  40. HCOMPLEXTYPE parentObj;
  41. };
  42. struct COMPLEXTYPE
  43. {
  44. char *type;
  45. char *base_type;
  46. HFIELD head;
  47. HFIELD tail;
  48. HCOMPLEXTYPE next;
  49. int isSimpleContent;
  50. HRESTRICTION restriction;
  51. char targetNS[150];
  52. char fullName[250];
  53. };
  54. #define RES_MODE_EMPTY 0
  55. #define RES_MODE_MINMAX 1
  56. #define RES_MODE_ENUMERATION 2
  57. struct RESTRICTION
  58. {
  59. int mode;
  60. char *type;
  61. /* Defines a list of acceptable values*/
  62. struct Enumeration *enumeration;
  63. /* Specifies the maximum number of decimal places allowed.
  64. Must be equal to or greater than zero */
  65. int fractionDigits;
  66. /* Specifies the exact number of characters or list items allowed.
  67. Must be equal to or greater than zero*/
  68. int length;
  69. /* Specifies the upper bounds for numeric
  70. values (the value must be less than this value) */
  71. int maxExclusive;
  72. int maxExclusiveSet;
  73. /* Specifies the upper bounds for numeric values
  74. (the value must be less than or equal to this value) */
  75. int maxInclusive;
  76. int maxInclusiveSet;
  77. /* Specifies the lower bounds for numeric values
  78. (the value must be greater than this value) */
  79. int minExclusive;
  80. int minExclusiveSet;
  81. /* Specifies the lower bounds for numeric values
  82. (the value must be greater than or equal to this value) */
  83. int minInclusive;
  84. int minInclusiveSet;
  85. /* Specifies the maximum number of characters or list items allowed.
  86. Must be equal to or greater than zero */
  87. int maxLength;
  88. /* Specifies the minimum number of characters or list items allowed.
  89. Must be equal to or greater than zero */
  90. int minLength;
  91. /* Defines the exact sequence of
  92. characters that are acceptable */
  93. char pattern[150];
  94. /* Specifies the exact number of digits allowed.
  95. Must be greater than zero */
  96. int totalDigits;
  97. /* Specifies how white space (line feeds, tabs,
  98. spaces, and carriage returns) is handled */
  99. char whiteSpace[50];
  100. };
  101. void objInitModule();
  102. void objFreeModule();
  103. HCOMPLEXTYPE objCreateComplexType(const char* typename);
  104. void objSetBaseType(HCOMPLEXTYPE obj, const char* typename);
  105. HFIELD objAddElement(HCOMPLEXTYPE obj, const char* name, const char* type, int flag, int mino, int maxo);
  106. HFIELD objAddAttribute(HCOMPLEXTYPE obj, const char* name, const char* type, int flag);
  107. HCOMPLEXTYPE objRegistryGetComplexType(const char* typename);
  108. void objRegistryEnumComplexType(CT_ENUM callback);
  109. HRESTRICTION resCreate(const char* type);
  110. #endif