10a48773fSEric van Gyzen /* Interface to some helper routines used to accumulate and check 20a48773fSEric van Gyzen structured content. 30a48773fSEric van Gyzen __ __ _ 40a48773fSEric van Gyzen ___\ \/ /_ __ __ _| |_ 50a48773fSEric van Gyzen / _ \\ /| '_ \ / _` | __| 60a48773fSEric van Gyzen | __// \| |_) | (_| | |_ 70a48773fSEric van Gyzen \___/_/\_\ .__/ \__,_|\__| 80a48773fSEric van Gyzen |_| XML parser 90a48773fSEric van Gyzen 10*cc68614dSXin LI Copyright (c) 2017 Rhodri James <rhodri@wildebeest.org.uk> 110a48773fSEric van Gyzen Licensed under the MIT license: 120a48773fSEric van Gyzen 130a48773fSEric van Gyzen Permission is hereby granted, free of charge, to any person obtaining 140a48773fSEric van Gyzen a copy of this software and associated documentation files (the 150a48773fSEric van Gyzen "Software"), to deal in the Software without restriction, including 160a48773fSEric van Gyzen without limitation the rights to use, copy, modify, merge, publish, 170a48773fSEric van Gyzen distribute, sublicense, and/or sell copies of the Software, and to permit 180a48773fSEric van Gyzen persons to whom the Software is furnished to do so, subject to the 190a48773fSEric van Gyzen following conditions: 200a48773fSEric van Gyzen 210a48773fSEric van Gyzen The above copyright notice and this permission notice shall be included 220a48773fSEric van Gyzen in all copies or substantial portions of the Software. 230a48773fSEric van Gyzen 240a48773fSEric van Gyzen THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, 250a48773fSEric van Gyzen EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF 260a48773fSEric van Gyzen MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN 270a48773fSEric van Gyzen NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, 280a48773fSEric van Gyzen DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR 290a48773fSEric van Gyzen OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE 300a48773fSEric van Gyzen USE OR OTHER DEALINGS IN THE SOFTWARE. 310a48773fSEric van Gyzen */ 320a48773fSEric van Gyzen 330a48773fSEric van Gyzen #ifdef __cplusplus 340a48773fSEric van Gyzen extern "C" { 350a48773fSEric van Gyzen #endif 360a48773fSEric van Gyzen 370a48773fSEric van Gyzen #ifndef XML_STRUCTDATA_H 380a48773fSEric van Gyzen # define XML_STRUCTDATA_H 1 390a48773fSEric van Gyzen 400a48773fSEric van Gyzen # include "expat.h" 410a48773fSEric van Gyzen 420a48773fSEric van Gyzen typedef struct { 430a48773fSEric van Gyzen const XML_Char *str; 440a48773fSEric van Gyzen int data0; 450a48773fSEric van Gyzen int data1; 460a48773fSEric van Gyzen int data2; 470a48773fSEric van Gyzen } StructDataEntry; 480a48773fSEric van Gyzen 490a48773fSEric van Gyzen typedef struct { 500a48773fSEric van Gyzen int count; /* Number of entries used */ 510a48773fSEric van Gyzen int max_count; /* Number of StructDataEntry items in `entries` */ 520a48773fSEric van Gyzen StructDataEntry *entries; 530a48773fSEric van Gyzen } StructData; 540a48773fSEric van Gyzen 550a48773fSEric van Gyzen void StructData_Init(StructData *storage); 560a48773fSEric van Gyzen 576b2c1e49SXin LI void StructData_AddItem(StructData *storage, const XML_Char *s, int data0, 586b2c1e49SXin LI int data1, int data2); 590a48773fSEric van Gyzen 606b2c1e49SXin LI void StructData_CheckItems(StructData *storage, const StructDataEntry *expected, 610a48773fSEric van Gyzen int count); 620a48773fSEric van Gyzen 630a48773fSEric van Gyzen void StructData_Dispose(StructData *storage); 640a48773fSEric van Gyzen 650a48773fSEric van Gyzen #endif /* XML_STRUCTDATA_H */ 660a48773fSEric van Gyzen 670a48773fSEric van Gyzen #ifdef __cplusplus 680a48773fSEric van Gyzen } 690a48773fSEric van Gyzen #endif 70