summaryrefslogtreecommitdiffstats
path: root/xbmc/utils/XBMCTinyXML.h
diff options
context:
space:
mode:
authormanuel <manuel@mausz.at>2020-10-19 00:52:24 +0200
committermanuel <manuel@mausz.at>2020-10-19 00:52:24 +0200
commitbe933ef2241d79558f91796cc5b3a161f72ebf9c (patch)
treefe3ab2f130e20c99001f2d7a81d610c78c96a3f4 /xbmc/utils/XBMCTinyXML.h
parent5f8335c1e49ce108ef3481863833c98efa00411b (diff)
downloadkodi-pvr-build-be933ef2241d79558f91796cc5b3a161f72ebf9c.tar.gz
kodi-pvr-build-be933ef2241d79558f91796cc5b3a161f72ebf9c.tar.bz2
kodi-pvr-build-be933ef2241d79558f91796cc5b3a161f72ebf9c.zip
sync with upstream
Diffstat (limited to 'xbmc/utils/XBMCTinyXML.h')
-rw-r--r--xbmc/utils/XBMCTinyXML.h59
1 files changed, 59 insertions, 0 deletions
diff --git a/xbmc/utils/XBMCTinyXML.h b/xbmc/utils/XBMCTinyXML.h
new file mode 100644
index 0000000..2f4e188
--- /dev/null
+++ b/xbmc/utils/XBMCTinyXML.h
@@ -0,0 +1,59 @@
1/*
2 * Copyright (C) 2005-2018 Team Kodi
3 * This file is part of Kodi - https://kodi.tv
4 *
5 * SPDX-License-Identifier: GPL-2.0-or-later
6 * See LICENSES/README.md for more information.
7 */
8
9#pragma once
10
11#ifndef TARGET_WINDOWS
12//compile fix for TinyXml < 2.6.0
13#define DOCUMENT TINYXML_DOCUMENT
14#define ELEMENT TINYXML_ELEMENT
15#define COMMENT TINYXML_COMMENT
16#define UNKNOWN TINYXML_UNKNOWN
17#define TEXT TINYXML_TEXT
18#define DECLARATION TINYXML_DECLARATION
19#define TYPECOUNT TINYXML_TYPECOUNT
20#endif
21
22#include <tinyxml.h>
23#include <string>
24
25#undef DOCUMENT
26#undef ELEMENT
27#undef COMMENT
28#undef UNKNOWN
29//#undef TEXT
30#undef DECLARATION
31#undef TYPECOUNT
32
33class CXBMCTinyXML : public TiXmlDocument
34{
35public:
36 CXBMCTinyXML();
37 explicit CXBMCTinyXML(const char*);
38 explicit CXBMCTinyXML(const std::string& documentName);
39 CXBMCTinyXML(const std::string& documentName, const std::string& documentCharset);
40 bool LoadFile(TiXmlEncoding encoding = TIXML_DEFAULT_ENCODING);
41 bool LoadFile(const char*, TiXmlEncoding encoding = TIXML_DEFAULT_ENCODING);
42 bool LoadFile(const std::string& _filename, TiXmlEncoding encoding = TIXML_DEFAULT_ENCODING);
43 bool LoadFile(const std::string& _filename, const std::string& documentCharset);
44 bool LoadFile(FILE*, TiXmlEncoding encoding = TIXML_DEFAULT_ENCODING);
45 bool SaveFile(const char*) const;
46 bool SaveFile(const std::string& filename) const;
47 bool Parse(const std::string& data, TiXmlEncoding encoding = TIXML_DEFAULT_ENCODING);
48 bool Parse(const std::string& data, const std::string& dataCharset);
49 inline std::string GetSuggestedCharset(void) const { return m_SuggestedCharset; }
50 inline std::string GetUsedCharset(void) const { return m_UsedCharset; }
51 static bool Test();
52protected:
53 using TiXmlDocument::Parse;
54 bool TryParse(const std::string& data, const std::string& tryDataCharset);
55 bool InternalParse(const std::string& rawdata, TiXmlEncoding encoding = TIXML_DEFAULT_ENCODING);
56
57 std::string m_SuggestedCharset;
58 std::string m_UsedCharset;
59};