19b8e2351Sbluhm /* Interface to some helper routines used to accumulate and check 29b8e2351Sbluhm structured content. 39b8e2351Sbluhm __ __ _ 49b8e2351Sbluhm ___\ \/ /_ __ __ _| |_ 59b8e2351Sbluhm / _ \\ /| '_ \ / _` | __| 69b8e2351Sbluhm | __// \| |_) | (_| | |_ 79b8e2351Sbluhm \___/_/\_\ .__/ \__,_|\__| 89b8e2351Sbluhm |_| XML parser 99b8e2351Sbluhm 10*08819b41Sbluhm Copyright (c) 2017 Rhodri James <rhodri@wildebeest.org.uk> 119b8e2351Sbluhm Licensed under the MIT license: 129b8e2351Sbluhm 139b8e2351Sbluhm Permission is hereby granted, free of charge, to any person obtaining 149b8e2351Sbluhm a copy of this software and associated documentation files (the 159b8e2351Sbluhm "Software"), to deal in the Software without restriction, including 169b8e2351Sbluhm without limitation the rights to use, copy, modify, merge, publish, 179b8e2351Sbluhm distribute, sublicense, and/or sell copies of the Software, and to permit 189b8e2351Sbluhm persons to whom the Software is furnished to do so, subject to the 199b8e2351Sbluhm following conditions: 209b8e2351Sbluhm 219b8e2351Sbluhm The above copyright notice and this permission notice shall be included 229b8e2351Sbluhm in all copies or substantial portions of the Software. 239b8e2351Sbluhm 249b8e2351Sbluhm THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, 259b8e2351Sbluhm EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF 269b8e2351Sbluhm MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN 279b8e2351Sbluhm NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, 289b8e2351Sbluhm DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR 299b8e2351Sbluhm OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE 309b8e2351Sbluhm USE OR OTHER DEALINGS IN THE SOFTWARE. 319b8e2351Sbluhm */ 329b8e2351Sbluhm 339b8e2351Sbluhm #ifdef __cplusplus 349b8e2351Sbluhm extern "C" { 359b8e2351Sbluhm #endif 369b8e2351Sbluhm 379b8e2351Sbluhm #ifndef XML_STRUCTDATA_H 389b8e2351Sbluhm # define XML_STRUCTDATA_H 1 399b8e2351Sbluhm 409b8e2351Sbluhm # include "expat.h" 419b8e2351Sbluhm 429b8e2351Sbluhm typedef struct { 439b8e2351Sbluhm const XML_Char *str; 449b8e2351Sbluhm int data0; 459b8e2351Sbluhm int data1; 469b8e2351Sbluhm int data2; 479b8e2351Sbluhm } StructDataEntry; 489b8e2351Sbluhm 499b8e2351Sbluhm typedef struct { 509b8e2351Sbluhm int count; /* Number of entries used */ 519b8e2351Sbluhm int max_count; /* Number of StructDataEntry items in `entries` */ 529b8e2351Sbluhm StructDataEntry *entries; 539b8e2351Sbluhm } StructData; 549b8e2351Sbluhm 559b8e2351Sbluhm void StructData_Init(StructData *storage); 569b8e2351Sbluhm 5728ce3119Sbluhm void StructData_AddItem(StructData *storage, const XML_Char *s, int data0, 5828ce3119Sbluhm int data1, int data2); 599b8e2351Sbluhm 6028ce3119Sbluhm void StructData_CheckItems(StructData *storage, const StructDataEntry *expected, 619b8e2351Sbluhm int count); 629b8e2351Sbluhm 639b8e2351Sbluhm void StructData_Dispose(StructData *storage); 649b8e2351Sbluhm 659b8e2351Sbluhm #endif /* XML_STRUCTDATA_H */ 669b8e2351Sbluhm 679b8e2351Sbluhm #ifdef __cplusplus 689b8e2351Sbluhm } 699b8e2351Sbluhm #endif 70