3af253dbe83663efc9211b80cbc60e7d22622058
1 /**
2 * Copyright (C) ARM Limited 2010-2012. All rights reserved.
3 *
4 * This program is free software; you can redistribute it and/or modify
5 * it under the terms of the GNU General Public License version 2 as
6 * published by the Free Software Foundation.
7 */
9 #ifndef __XMLOUT_H
10 #define __XMLOUT_H
12 class XMLOut {
13 int indent;
14 bool incomplete;
15 char temp_buffer[4096]; // arbitrarilly large buffer to hold variable arguments
16 char xml_string[64*1024]; // arbitrarilly large buffer to hold an xml file output by the daemon
18 void writeTabs();
19 void encodeAttributeData(const char* data);
20 void writeData(const char *format, ...);
22 public:
23 XMLOut();
24 ~XMLOut();
25 char* getXmlString() {return xml_string;}
26 void clearXmlString() {xml_string[0]=0;}
27 const XMLOut & xmlHeader(void);
28 const XMLOut & comment(const char* text, const bool newline);
29 const XMLOut & startElement(const char* tag);
30 const XMLOut & startElement(const char* tag, int index);
31 const XMLOut & endElement(const char* tag);
32 const XMLOut & attributeString(const char* name, const char* value);
33 const XMLOut & attributeInt(const char* name, int value);
34 const XMLOut & attributeUInt(const char* name, unsigned int value);
35 const XMLOut & attributeLong(const char* name, long value);
36 const XMLOut & attributeULong(const char* name, unsigned long value);
37 const XMLOut & attributeLongLong(const char* name, long long value);
38 const XMLOut & attributeULongLong(const char* name, unsigned long long value);
39 const XMLOut & attributeDouble(const char* name, double value);
40 const XMLOut & attributeBool(const char* name, bool value);
41 const XMLOut & attributeHex4(const char* name, int value);
42 const XMLOut & attributeHex8(const char* name, int value);
43 };
45 #endif // __XMLOUT_H