appHandQNames.c 7.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223
  1. /*
  2. * Copyright (C) 2007-2012 Siemens AG
  3. *
  4. * This program is free software: you can redistribute it and/or modify
  5. * it under the terms of the GNU Lesser General Public License as published
  6. * by the Free Software Foundation, either version 3 of the License, or
  7. * (at your option) any later version.
  8. *
  9. * This program is distributed in the hope that it will be useful,
  10. * but WITHOUT ANY WARRANTY; without even the implied warranty of
  11. * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  12. * GNU Lesser General Public License for more details.
  13. * GNU Lesser General Public License for more details.
  14. *
  15. * You should have received a copy of the GNU Lesser General Public License
  16. * along with this program. If not, see <http://www.gnu.org/licenses/>.
  17. */
  18. /*******************************************************************
  19. *
  20. * @author Daniel.Peintner.EXT@siemens.com
  21. * @version 0.7
  22. * @contact Joerg.Heuer@siemens.com
  23. *
  24. * <p>Code generated by EXIdizer.com</p>
  25. ********************************************************************/
  26. #ifndef EXI_appHand_QNAMES_C
  27. #define EXI_appHand_QNAMES_C
  28. #include "EXITypes.h"
  29. #include "ErrorCodes.h"
  30. #include "appHandQNameDefines.h"
  31. /* qname is a composition of namespaceURI(ID) and localPart(ID) */
  32. static exi_eqname_t qnames[EXI_appHandMAX_NUMBER_OF_QNAMES] = {
  33. /* qnameID == 0: AppProtocol */
  34. {0, 0},
  35. /* qnameID == 1: Priority */
  36. {0, 1},
  37. /* qnameID == 2: ProtocolNamespace */
  38. {0, 2},
  39. /* qnameID == 3: ResponseCode */
  40. {0, 3},
  41. /* qnameID == 4: SchemaID */
  42. {0, 4},
  43. /* qnameID == 5: VersionNumberMajor */
  44. {0, 5},
  45. /* qnameID == 6: VersionNumberMinor */
  46. {0, 6},
  47. /* qnameID == 7: {http://www.w3.org/XML/1998/namespace}base */
  48. {1, 0},
  49. /* qnameID == 8: {http://www.w3.org/XML/1998/namespace}id */
  50. {1, 1},
  51. /* qnameID == 9: {http://www.w3.org/XML/1998/namespace}lang */
  52. {1, 2},
  53. /* qnameID == 10: {http://www.w3.org/XML/1998/namespace}space */
  54. {1, 3},
  55. /* qnameID == 11: {http://www.w3.org/2001/XMLSchema-instance}nil */
  56. {2, 0},
  57. /* qnameID == 12: {http://www.w3.org/2001/XMLSchema-instance}type */
  58. {2, 1},
  59. /* qnameID == 13: {http://www.w3.org/2001/XMLSchema}ENTITIES */
  60. {3, 0},
  61. /* qnameID == 14: {http://www.w3.org/2001/XMLSchema}ENTITY */
  62. {3, 1},
  63. /* qnameID == 15: {http://www.w3.org/2001/XMLSchema}ID */
  64. {3, 2},
  65. /* qnameID == 16: {http://www.w3.org/2001/XMLSchema}IDREF */
  66. {3, 3},
  67. /* qnameID == 17: {http://www.w3.org/2001/XMLSchema}IDREFS */
  68. {3, 4},
  69. /* qnameID == 18: {http://www.w3.org/2001/XMLSchema}NCName */
  70. {3, 5},
  71. /* qnameID == 19: {http://www.w3.org/2001/XMLSchema}NMTOKEN */
  72. {3, 6},
  73. /* qnameID == 20: {http://www.w3.org/2001/XMLSchema}NMTOKENS */
  74. {3, 7},
  75. /* qnameID == 21: {http://www.w3.org/2001/XMLSchema}NOTATION */
  76. {3, 8},
  77. /* qnameID == 22: {http://www.w3.org/2001/XMLSchema}Name */
  78. {3, 9},
  79. /* qnameID == 23: {http://www.w3.org/2001/XMLSchema}QName */
  80. {3, 10},
  81. /* qnameID == 24: {http://www.w3.org/2001/XMLSchema}anySimpleType */
  82. {3, 11},
  83. /* qnameID == 25: {http://www.w3.org/2001/XMLSchema}anyType */
  84. {3, 12},
  85. /* qnameID == 26: {http://www.w3.org/2001/XMLSchema}anyURI */
  86. {3, 13},
  87. /* qnameID == 27: {http://www.w3.org/2001/XMLSchema}base64Binary */
  88. {3, 14},
  89. /* qnameID == 28: {http://www.w3.org/2001/XMLSchema}boolean */
  90. {3, 15},
  91. /* qnameID == 29: {http://www.w3.org/2001/XMLSchema}byte */
  92. {3, 16},
  93. /* qnameID == 30: {http://www.w3.org/2001/XMLSchema}date */
  94. {3, 17},
  95. /* qnameID == 31: {http://www.w3.org/2001/XMLSchema}dateTime */
  96. {3, 18},
  97. /* qnameID == 32: {http://www.w3.org/2001/XMLSchema}decimal */
  98. {3, 19},
  99. /* qnameID == 33: {http://www.w3.org/2001/XMLSchema}double */
  100. {3, 20},
  101. /* qnameID == 34: {http://www.w3.org/2001/XMLSchema}duration */
  102. {3, 21},
  103. /* qnameID == 35: {http://www.w3.org/2001/XMLSchema}float */
  104. {3, 22},
  105. /* qnameID == 36: {http://www.w3.org/2001/XMLSchema}gDay */
  106. {3, 23},
  107. /* qnameID == 37: {http://www.w3.org/2001/XMLSchema}gMonth */
  108. {3, 24},
  109. /* qnameID == 38: {http://www.w3.org/2001/XMLSchema}gMonthDay */
  110. {3, 25},
  111. /* qnameID == 39: {http://www.w3.org/2001/XMLSchema}gYear */
  112. {3, 26},
  113. /* qnameID == 40: {http://www.w3.org/2001/XMLSchema}gYearMonth */
  114. {3, 27},
  115. /* qnameID == 41: {http://www.w3.org/2001/XMLSchema}hexBinary */
  116. {3, 28},
  117. /* qnameID == 42: {http://www.w3.org/2001/XMLSchema}int */
  118. {3, 29},
  119. /* qnameID == 43: {http://www.w3.org/2001/XMLSchema}integer */
  120. {3, 30},
  121. /* qnameID == 44: {http://www.w3.org/2001/XMLSchema}language */
  122. {3, 31},
  123. /* qnameID == 45: {http://www.w3.org/2001/XMLSchema}long */
  124. {3, 32},
  125. /* qnameID == 46: {http://www.w3.org/2001/XMLSchema}negativeInteger */
  126. {3, 33},
  127. /* qnameID == 47: {http://www.w3.org/2001/XMLSchema}nonNegativeInteger */
  128. {3, 34},
  129. /* qnameID == 48: {http://www.w3.org/2001/XMLSchema}nonPositiveInteger */
  130. {3, 35},
  131. /* qnameID == 49: {http://www.w3.org/2001/XMLSchema}normalizedString */
  132. {3, 36},
  133. /* qnameID == 50: {http://www.w3.org/2001/XMLSchema}positiveInteger */
  134. {3, 37},
  135. /* qnameID == 51: {http://www.w3.org/2001/XMLSchema}short */
  136. {3, 38},
  137. /* qnameID == 52: {http://www.w3.org/2001/XMLSchema}string */
  138. {3, 39},
  139. /* qnameID == 53: {http://www.w3.org/2001/XMLSchema}time */
  140. {3, 40},
  141. /* qnameID == 54: {http://www.w3.org/2001/XMLSchema}token */
  142. {3, 41},
  143. /* qnameID == 55: {http://www.w3.org/2001/XMLSchema}unsignedByte */
  144. {3, 42},
  145. /* qnameID == 56: {http://www.w3.org/2001/XMLSchema}unsignedInt */
  146. {3, 43},
  147. /* qnameID == 57: {http://www.w3.org/2001/XMLSchema}unsignedLong */
  148. {3, 44},
  149. /* qnameID == 58: {http://www.w3.org/2001/XMLSchema}unsignedShort */
  150. {3, 45},
  151. /* qnameID == 59: {urn:iso:15118:2:2010:AppProtocol}AppProtocolType */
  152. {4, 0},
  153. /* qnameID == 60: {urn:iso:15118:2:2010:AppProtocol}idType */
  154. {4, 1},
  155. /* qnameID == 61: {urn:iso:15118:2:2010:AppProtocol}priorityType */
  156. {4, 2},
  157. /* qnameID == 62: {urn:iso:15118:2:2010:AppProtocol}protocolNameType */
  158. {4, 3},
  159. /* qnameID == 63: {urn:iso:15118:2:2010:AppProtocol}protocolNamespaceType */
  160. {4, 4},
  161. /* qnameID == 64: {urn:iso:15118:2:2010:AppProtocol}responseCodeType */
  162. {4, 5},
  163. /* qnameID == 65: {urn:iso:15118:2:2010:AppProtocol}supportedAppProtocolReq */
  164. {4, 6},
  165. /* qnameID == 66: {urn:iso:15118:2:2010:AppProtocol}supportedAppProtocolRes */
  166. {4, 7}
  167. };
  168. int exiappHandGetEQName(exi_state_t* state, uint16_t qnameID, uint16_t* namespaceURI, uint16_t* localPart) {
  169. int errn = 0;
  170. /* EXI_appHandNUMBER_OF_QNAMES */
  171. if (qnameID < state->nextQNameID) {
  172. *namespaceURI = qnames[qnameID].namespaceURI;
  173. *localPart = qnames[qnameID].localPart;
  174. } else {
  175. errn = EXI_ERROR_OUT_OF_BOUNDS;
  176. }
  177. return errn;
  178. }
  179. int exiappHandGetQNameID(exi_state_t* state, uint16_t namespaceURI, uint16_t localPart, uint16_t* qnameID) {
  180. uint16_t i;
  181. /* TODO Do something more efficient than just walk over the entire list */
  182. /* EXI_appHandNUMBER_OF_QNAMES */
  183. for(i=0; i<state->nextQNameID; i++) {
  184. if(qnames[i].localPart == localPart && qnames[i].namespaceURI == namespaceURI) {
  185. *qnameID = i;
  186. return 0;
  187. }
  188. }
  189. return EXI_ERROR_OUT_OF_BOUNDS;
  190. }
  191. int exiappHandAddEQName(exi_state_t* state, uint16_t* qnameID, uint16_t namespaceURI, uint16_t localPart) {
  192. int errn = 0;
  193. if(state->nextQNameID < (EXI_appHandMAX_NUMBER_OF_QNAMES -1)) {
  194. /* store IDs */
  195. qnames[state->nextQNameID].namespaceURI = namespaceURI;
  196. qnames[state->nextQNameID].localPart = localPart;
  197. /* increment counter */
  198. *qnameID = state->nextQNameID++;
  199. } else {
  200. errn = EXI_ERROR_OUT_OF_BOUNDS;
  201. }
  202. return errn;
  203. }
  204. #endif