exip  Alpha 0.5.4
 All Data Structures Files Functions Variables Typedefs Enumerations Enumerator Macros Groups Pages
bin/headers/EXISerializer.h
Go to the documentation of this file.
1 /*==================================================================*\
2 | EXIP - Embeddable EXI Processor in C |
3 |--------------------------------------------------------------------|
4 | This work is licensed under BSD 3-Clause License |
5 | The full license terms and conditions are located in LICENSE.txt |
6 \===================================================================*/
7 
19 #ifndef EXISERIALIZER_H_
20 #define EXISERIALIZER_H_
21 
22 #include "procTypes.h"
23 
25 {
26  // For handling the meta-data (document structure)
29  errorCode (*startElement)(EXIStream* strm, QName qname, EXITypeClass* valueType);
31  errorCode (*attribute)(EXIStream* strm, QName qname, boolean isSchemaType, EXITypeClass* valueType);
32 
33  // For handling the data
34  errorCode (*intData)(EXIStream* strm, Integer int_val);
35  errorCode (*booleanData)(EXIStream* strm, boolean bool_val);
36  errorCode (*stringData)(EXIStream* strm, const String str_val);
37  errorCode (*floatData)(EXIStream* strm, Float float_val);
38  errorCode (*binaryData)(EXIStream* strm, const char* binary_val, Index nbytes);
40  errorCode (*decimalData)(EXIStream* strm, Decimal dec_val);
41  errorCode (*listData)(EXIStream* strm, unsigned int itemCount);
42  errorCode (*qnameData)(EXIStream* strm, QName qname); // xsi:type value only
43 
44  // Miscellaneous
45  errorCode (*processingInstruction)(EXIStream* strm); // TODO: define the parameters!
46  errorCode (*namespaceDeclaration)(EXIStream* strm, const String ns, const String prefix, boolean isLocalElementNS);
47 
48  // EXI specific
50  errorCode (*selfContained)(EXIStream* strm); // Used for indexing independent elements for random access
51 
52  // EXIP specific
53  void (*initHeader)(EXIStream* strm);
56  errorCode (*flushEXIData)(EXIStream* strm, char* outBuf, unsigned int bufSize, unsigned int* bytesFlush);
57 };
58 
60 
64 extern const EXISerializer serialize;
65 
66 /**** START: Serializer API declarations ****/
67 
68 // For handling the meta-data (document structure)
69 
77 
85 
96 errorCode startElement(EXIStream* strm, QName qname, EXITypeClass* valueType);
97 
105 
106 
107 
123 errorCode attribute(EXIStream* strm, QName qname, boolean isSchemaType, EXITypeClass* valueType);
124 
125 // For handling the data
126 
135 errorCode intData(EXIStream* strm, Integer int_val);
136 
145 errorCode booleanData(EXIStream* strm, boolean bool_val);
146 
154 errorCode stringData(EXIStream* strm, const String str_val);
155 
164 errorCode floatData(EXIStream* strm, Float float_val);
165 
175 errorCode binaryData(EXIStream* strm, const char* binary_val, Index nbytes);
176 
186 
195 errorCode decimalData(EXIStream* strm, Decimal dec_val);
196 
205 errorCode listData(EXIStream* strm, unsigned int itemCount);
206 
214 errorCode qnameData(EXIStream* strm, QName qname);
215 
216 // Miscellaneous
217 
226 
237 errorCode namespaceDeclaration(EXIStream* strm, const String ns, const String prefix, boolean isLocalElementNS);
238 
239 // EXI specific
240 
249 
250 // EXIP specific
251 
258 void initHeader(EXIStream* strm);
259 
268 errorCode initStream(EXIStream* strm, BinaryBuffer buffer, EXIPSchema *schema);
269 
277 
310 errorCode flushEXIData(EXIStream* strm, char* outBuf, unsigned int bufSize, unsigned int* bytesFlush);
311 
312 /**** END: Serializer API implementation ****/
313 
314 
315 /**** START: Fast, low level API for schema encoding only ****/
316 
328 
329 /**** END: Fast, low level API for schema encoding only ****/
330 
331 #endif /* EXISERIALIZER_H_ */