LibreOffice Module tools (master) 1
XmlWriter.hxx
Go to the documentation of this file.
1/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2/*
3 * This file is part of the LibreOffice project.
4 *
5 * This Source Code Form is subject to the terms of the Mozilla Public
6 * License, v. 2.0. If a copy of the MPL was not distributed with this
7 * file, You can obtain one at http://mozilla.org/MPL/2.0/.
8 */
9
10#ifndef INCLUDED_TOOLS_XMLWRITER_HXX
11#define INCLUDED_TOOLS_XMLWRITER_HXX
12
13#include <tools/toolsdllapi.h>
14#include <rtl/string.hxx>
15#include <memory>
16#include <string_view>
17#include <vector>
18
19class SvStream;
20
21namespace tools
22{
23struct XmlWriterImpl;
24
35{
36private:
37 std::unique_ptr<XmlWriterImpl> mpImpl;
38
39public:
40 XmlWriter(SvStream* pStream);
41
42 ~XmlWriter();
43
44 bool startDocument(sal_Int32 nIndent = 2, bool bWriteXmlHeader = true);
45 void endDocument();
46
47 void startElement(const char* sName);
48 void startElement(const OString& sName);
49 void startElement(const OString& sPrefix, const OString& sName, const OString& sNamespaceUri);
50 void endElement();
51
52 void attribute(const char* sTagName, const OString& aValue);
53 void attribute(const OString& sTagName, const OString& aValue);
54 void attribute(const char* sTagName, std::u16string_view aValue);
55 void attribute(const char* sTagName, sal_Int32 aNumber);
56 void attributeDouble(const char* sTagName, double aNumber);
57 void attributeBase64(const char* sTagName, std::vector<sal_uInt8> const& rValueInBytes);
58 void attributeBase64(const char* sTagName, std::vector<char> const& rValueInBytes);
59
60 void content(const OString& sValue);
61 void content(std::u16string_view sValue);
62
63 void element(const char* sName);
64};
65
66} // end tools namespace
67
68#endif // INCLUDED_TOOLS_XMLWRITER_HXX
69
70/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
XmlWriter writes a XML to a SvStream.
Definition: XmlWriter.hxx:35
std::unique_ptr< XmlWriterImpl > mpImpl
Definition: XmlWriter.hxx:37
OUString sPrefix
Note: this class is a true marvel of engineering: because the author could not decide whether it's be...
sal_Int32 attribute
#define TOOLS_DLLPUBLIC
Definition: toolsdllapi.h:28