Lines Matching refs:writer
46 static deBool writeEscaped (qpXmlWriter* writer, const char* str) in writeEscaped() argument
113 fprintf(writer->outputFile, "%s", buf); in writeEscaped()
118 if (writer->flushAfterWrite) in writeEscaped()
119 fflush(writer->outputFile); in writeEscaped()
126 qpXmlWriter* writer = (qpXmlWriter*)deCalloc(sizeof(qpXmlWriter)); in qpXmlWriter_createFileWriter() local
127 if (!writer) in qpXmlWriter_createFileWriter()
132 writer->outputFile = outputFile; in qpXmlWriter_createFileWriter()
133 writer->flushAfterWrite = flushAfterWrite; in qpXmlWriter_createFileWriter()
135 return writer; in qpXmlWriter_createFileWriter()
138 void qpXmlWriter_destroy (qpXmlWriter* writer) in qpXmlWriter_destroy() argument
140 DE_ASSERT(writer); in qpXmlWriter_destroy()
142 deFree(writer); in qpXmlWriter_destroy()
145 static deBool closePending (qpXmlWriter* writer) in closePending() argument
147 if (writer->xmlPrevIsStartElement) in closePending()
149 fprintf(writer->outputFile, ">\n"); in closePending()
150 writer->xmlPrevIsStartElement = DE_FALSE; in closePending()
156 void qpXmlWriter_flush (qpXmlWriter* writer) in qpXmlWriter_flush() argument
158 closePending(writer); in qpXmlWriter_flush()
161 deBool qpXmlWriter_startDocument (qpXmlWriter* writer) in qpXmlWriter_startDocument() argument
163 DE_ASSERT(writer && !writer->xmlIsWriting); in qpXmlWriter_startDocument()
164 writer->xmlIsWriting = DE_TRUE; in qpXmlWriter_startDocument()
165 writer->xmlElementDepth = 0; in qpXmlWriter_startDocument()
166 writer->xmlPrevIsStartElement = DE_FALSE; in qpXmlWriter_startDocument()
167 fprintf(writer->outputFile, "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n"); in qpXmlWriter_startDocument()
178 deBool qpXmlWriter_endDocument (qpXmlWriter* writer) in qpXmlWriter_endDocument() argument
180 DE_ASSERT(writer); in qpXmlWriter_endDocument()
181 DE_ASSERT(writer->xmlIsWriting); in qpXmlWriter_endDocument()
182 DE_ASSERT(writer->xmlElementDepth == 0); in qpXmlWriter_endDocument()
183 closePending(writer); in qpXmlWriter_endDocument()
184 writer->xmlIsWriting = DE_FALSE; in qpXmlWriter_endDocument()
188 deBool qpXmlWriter_writeString (qpXmlWriter* writer, const char* str) in qpXmlWriter_writeString() argument
190 if (writer->xmlPrevIsStartElement) in qpXmlWriter_writeString()
192 fprintf(writer->outputFile, ">"); in qpXmlWriter_writeString()
193 writer->xmlPrevIsStartElement = DE_FALSE; in qpXmlWriter_writeString()
196 return writeEscaped(writer, str); in qpXmlWriter_writeString()
199 deBool qpXmlWriter_startElement(qpXmlWriter* writer, const char* elementName, int numAttribs, const… in qpXmlWriter_startElement() argument
203 closePending(writer); in qpXmlWriter_startElement()
205 fprintf(writer->outputFile, "%s<%s", getIndentStr(writer->xmlElementDepth), elementName); in qpXmlWriter_startElement()
210 fprintf(writer->outputFile, " %s=\"", attrib->name); in qpXmlWriter_startElement()
214 writeEscaped(writer, attrib->stringValue); in qpXmlWriter_startElement()
221 writeEscaped(writer, buf); in qpXmlWriter_startElement()
226 writeEscaped(writer, attrib->boolValue ? "True" : "False"); in qpXmlWriter_startElement()
232 fprintf(writer->outputFile, "\""); in qpXmlWriter_startElement()
235 writer->xmlElementDepth++; in qpXmlWriter_startElement()
236 writer->xmlPrevIsStartElement = DE_TRUE; in qpXmlWriter_startElement()
240 deBool qpXmlWriter_endElement (qpXmlWriter* writer, const char* elementName) in qpXmlWriter_endElement() argument
242 DE_ASSERT(writer && writer->xmlElementDepth > 0); in qpXmlWriter_endElement()
243 writer->xmlElementDepth--; in qpXmlWriter_endElement()
245 if (writer->xmlPrevIsStartElement) /* leave flag as-is */ in qpXmlWriter_endElement()
247 fprintf(writer->outputFile, " />\n"); in qpXmlWriter_endElement()
248 writer->xmlPrevIsStartElement = DE_FALSE; in qpXmlWriter_endElement()
251 fprintf(writer->outputFile, "</%s>\n", /*getIndentStr(writer->xmlElementDepth),*/ elementName); in qpXmlWriter_endElement()
256 deBool qpXmlWriter_writeBase64 (qpXmlWriter* writer, const deUint8* data, size_t numBytes) in qpXmlWriter_writeBase64() argument
270 const char* indentStr = getIndentStr(writer->xmlElementDepth); in qpXmlWriter_writeBase64()
272 DE_ASSERT(writer && data && (numBytes > 0)); in qpXmlWriter_writeBase64()
275 closePending(writer); in qpXmlWriter_writeBase64()
300 fprintf(writer->outputFile, "%s", indentStr); in qpXmlWriter_writeBase64()
305 fprintf(writer->outputFile, "%s", &d[0]); in qpXmlWriter_writeBase64()
311 fprintf(writer->outputFile, "\n"); in qpXmlWriter_writeBase64()
319 fprintf(writer->outputFile, "\n"); in qpXmlWriter_writeBase64()
327 deBool qpXmlWriter_writeStringElement (qpXmlWriter* writer, const char* elementName, const char* el… in qpXmlWriter_writeStringElement() argument
329 if (!qpXmlWriter_startElement(writer, elementName, 0, DE_NULL) || in qpXmlWriter_writeStringElement()
330 (elementContent && !qpXmlWriter_writeString(writer, elementContent)) || in qpXmlWriter_writeStringElement()
331 !qpXmlWriter_endElement(writer, elementName)) in qpXmlWriter_writeStringElement()