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 27 #include "Enumeration.h" 28 29 typedef struct FIELD* HFIELD; 30 typedef struct COMPLEXTYPE* HCOMPLEXTYPE; 31 typedef struct RESTRICTION* HRESTRICTION; 32 typedef int (*CT_ENUM)(HCOMPLEXTYPE); 33 34 struct FIELD 35 { 36 char *name; 37 char *type; 38 int flag; 39 int minOccurs; 40 int maxOccurs; 41 char *attrName; 42 HFIELD next; 43 HCOMPLEXTYPE parentObj; 44 }; 45 46 struct COMPLEXTYPE 47 { 48 char *type; 49 char *base_type; 50 HFIELD head; 51 HFIELD tail; 52 HCOMPLEXTYPE next; 53 int isSimpleContent; 54 HRESTRICTION restriction; 55 char targetNS[150]; 56 char fullName[250]; 57 }; 58 59 #define RES_MODE_EMPTY 0 60 #define RES_MODE_MINMAX 1 61 #define RES_MODE_ENUMERATION 2 62 63 struct RESTRICTION 64 { 65 int mode; 66 67 char *type; 68 69 /* Defines a list of acceptable values*/ 70 struct Enumeration *enumeration; 71 72 /* Specifies the maximum number of decimal places allowed. 73 Must be equal to or greater than zero */ 74 int fractionDigits; 75 76 /* Specifies the exact number of characters or list items allowed. 77 Must be equal to or greater than zero*/ 78 int length; 79 80 /* Specifies the upper bounds for numeric 81 values (the value must be less than this value) */ 82 int maxExclusive; 83 int maxExclusiveSet; 84 85 /* Specifies the upper bounds for numeric values 86 (the value must be less than or equal to this value) */ 87 int maxInclusive; 88 int maxInclusiveSet; 89 90 /* Specifies the lower bounds for numeric values 91 (the value must be greater than this value) */ 92 int minExclusive; 93 int minExclusiveSet; 94 95 /* Specifies the lower bounds for numeric values 96 (the value must be greater than or equal to this value) */ 97 int minInclusive; 98 int minInclusiveSet; 99 100 /* Specifies the maximum number of characters or list items allowed. 101 Must be equal to or greater than zero */ 102 int maxLength; 103 104 105 /* Specifies the minimum number of characters or list items allowed. 106 Must be equal to or greater than zero */ 107 int minLength; 108 109 /* Defines the exact sequence of 110 characters that are acceptable */ 111 char pattern[150]; 112 113 /* Specifies the exact number of digits allowed. 114 Must be greater than zero */ 115 int totalDigits; 116 117 /* Specifies how white space (line feeds, tabs, 118 spaces, and carriage returns) is handled */ 119 char whiteSpace[50]; 120 }; 121 122 void objInitModule(); 123 void objFreeModule(); 124 125 HCOMPLEXTYPE objCreateComplexType(const char* typename); 126 void objSetBaseType(HCOMPLEXTYPE obj, const char* typename); 127 HFIELD objAddElement(HCOMPLEXTYPE obj, const char* name, const char* type, int flag, int mino, int maxo); 128 HFIELD objAddAttribute(HCOMPLEXTYPE obj, const char* name, const char* type, int flag); 129 130 HCOMPLEXTYPE objRegistryGetComplexType(const char* typename); 131 void objRegistryEnumComplexType(CT_ENUM callback); 132 133 134 135 HRESTRICTION resCreate(const char* type); 136 137 #endif 138