LibreOffice Module svtools (master) 1
HtmlWriter.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
11#pragma once
12
13#include <rtl/string.hxx>
14#include <string_view>
15#include <vector>
16#include <svtools/svtdllapi.h>
17
18class SvStream;
19
21{
22private:
23 std::vector<OString> maElementStack;
24
26
31 OString maNamespace;
32
33public:
34 HtmlWriter(SvStream& rStream, std::string_view rNamespace = std::string_view());
36
37 void prettyPrint(bool b);
38
39 void start(const OString& aElement);
40
41 bool end(const OString& aElement);
42 void end();
43
44 void flushStack();
45
46 static void writeAttribute(SvStream& rStream, std::string_view aAttribute, sal_Int32 aValue);
47 static void writeAttribute(SvStream& rStream, std::string_view aAttribute,
48 std::string_view aValue);
49
50 void attribute(std::string_view aAttribute, const char* aValue);
51 void attribute(std::string_view aAttribute, sal_Int32 aValue);
52 void attribute(std::string_view aAttribute, std::string_view aValue);
53 void attribute(std::string_view aAttribute, std::u16string_view aValue);
54 // boolean attribute e.g. <img ismap>
55 void attribute(std::string_view aAttribute);
56
57 void single(const OString& aContent);
58 void endAttribute();
59
61 void characters(std::string_view rChars);
62};
63
64/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
OString maNamespace
XML namespace, in case of XHTML.
Definition: HtmlWriter.hxx:31
bool mbElementOpen
Definition: HtmlWriter.hxx:27
bool mbPrettyPrint
Definition: HtmlWriter.hxx:29
bool mbCharactersWritten
Definition: HtmlWriter.hxx:28
std::vector< OString > maElementStack
Definition: HtmlWriter.hxx:23
SvStream & mrStream
Definition: HtmlWriter.hxx:25
end
sal_Int32 attribute
#define SVT_DLLPUBLIC
Definition: svtdllapi.h:27