forked from NTDLS/NSWFL
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathNSWFL_XMLWriter.H
81 lines (63 loc) · 2.85 KB
/
NSWFL_XMLWriter.H
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
// Copyright © NetworkDLS 2023, All rights reserved
//
// THIS CODE AND INFORMATION IS PROVIDED "AS IS" WITHOUT WARRANTY OF
// ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING BUT NOT LIMITED TO
// THE IMPLIED WARRANTIES OF MERCHANTABILITY AND/OR FITNESS FOR A
// PARTICULAR PURPOSE.
///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
#ifndef _NSWFL_XMLWriter_H_
#define _NSWFL_XMLWriter_H_
///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
namespace NSWFL {
namespace XML {
///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
class XMLWriter {
public:
void *pUserData; //Use it for whatever you want!
typedef struct _tag_XMLWriter_State {
String::StringBuilder *pBuilder;
char sName[255];
} XMLWriterState, *LPXMLWriterState;
XMLWriter(const char *sChildName);
XMLWriter(void);
~XMLWriter(void);
bool Initialize(void);
bool Initialize(const char *sChildName);
bool ChangeName(const char *sChildName);
int GetName(char *sOutName, int iMaxOut);
void Destroy(void);
String::StringBuilder *GetBuilder(void);
XMLReader *ToReader(XMLReader *lpXMLReader);
bool Add(const char *sAttributeName, const char *sValue);
bool Add(const char *sAttributeName, const char *sValue, const int iValueSz);
bool Add(const char *sAttributeName, const unsigned int iValue);
bool Add(const char *sAttributeName, const DWORD dwValue);
bool Add(const char *sAttributeName, const signed int iValue);
bool Add(const char *sAttributeName, const double dValue);
bool Add(const char *sAttributeName, const double dValue, const int iDecimalPlaces);
bool Add(const char *sAttributeName, const __int64 i64Value);
bool Add(const char *sAttributeName, const unsigned __int64 i64Value);
bool AddBool(const char *sAttributeName, const bool bValue);
bool Add(const char *sAttributeName, XMLWriter *XML);
bool Add(const char *sAttributeName, XMLReader *XML);
bool Add(XMLReader *XML);
bool Add(XMLWriter *XML);
int Length(void);
int Text(char *sOutXML, int iMaxOutSz);
void Text(String::StringBuilder *textOut);
char *Text(void);
char *Text(int *iOutSz);
void FreePointer(void *pPointer);
#ifdef _XML_USE_COMPRESSION
char *Compress(int *iOutLength);
char *Compress(int *iOutLength, int iCompressionLevel);
#endif
bool ToFile(const char *sFileName);
protected:
XMLWriterState State;
};
///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
} //namespace::XML
} //namespace::NSWFL
#endif