LibreOffice Module writerfilter (master) 1
TagLogger.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 * This file incorporates work covered by the following license notice:
10 *
11 * Licensed to the Apache Software Foundation (ASF) under one or more
12 * contributor license agreements. See the NOTICE file distributed
13 * with this work for additional information regarding copyright
14 * ownership. The ASF licenses this file to you under the Apache
15 * License, Version 2.0 (the "License"); you may not use this file
16 * except in compliance with the License. You may obtain a copy of
17 * the License at http://www.apache.org/licenses/LICENSE-2.0 .
18 */
19
20#pragma once
21
22#include <rtl/ustring.hxx>
23#include <tools/ref.hxx>
24#include <com/sun/star/beans/XPropertySet.hpp>
25#include <string>
26#include <string_view>
27#include <type_traits>
28#include <libxml/xmlwriter.h>
29
30namespace writerfilter
31{
32
34 {
35 private:
37 const char* m_pName;
38
39 public:
40 explicit TagLogger();
41 ~TagLogger();
42
43 static TagLogger& getInstance();
44
45#ifdef DBG_UTIL
46 void setFileName(const std::string & filename);
47 void startDocument();
48 void endDocument();
49
50 void element(const std::string & name);
51 void unoPropertySet(const css::uno::Reference<css::beans::XPropertySet>& rPropSet);
52 void startElement(const std::string & name);
53#endif
54 void attribute(const std::string & name, const std::string & value);
55#ifdef DBG_UTIL
56 void attribute(const std::string & name, std::u16string_view value);
57 void attribute(const std::string & name, sal_uInt32 value);
58 template<typename T> std::enable_if_t<std::is_integral_v<T>, void>
59 attribute(const std::string & name, T value)
60 { return attribute(name, static_cast<sal_uInt32>(value)); }
61 void attribute(const std::string & name, float value);
62 void attribute(const std::string & name, const css::uno::Any& aAny);
63 void chars(const std::string & chars);
64 void chars(std::u16string_view chars);
65 void endElement();
66#endif
67 };
68}
69
70/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
void attribute(const std::string &name, const css::uno::Any &aAny)
const char * m_pName
Definition: TagLogger.hxx:37
static TagLogger & getInstance()
Definition: TagLogger.cxx:95
void startElement(const std::string &name)
Definition: TagLogger.cxx:140
void chars(const std::string &chars)
Definition: TagLogger.cxx:215
std::enable_if_t< std::is_integral_v< T >, void > attribute(const std::string &name, T value)
Definition: TagLogger.hxx:59
xmlTextWriterPtr m_pWriter
Definition: TagLogger.hxx:36
void attribute(const std::string &name, const std::string &value)
Definition: TagLogger.cxx:150
void element(const std::string &name)
Definition: TagLogger.cxx:102
void unoPropertySet(const css::uno::Reference< css::beans::XPropertySet > &rPropSet)
Definition: TagLogger.cxx:108
void setFileName(const std::string &filename)
Definition: TagLogger.cxx:42
Any value
struct _xmlTextWriter * xmlTextWriterPtr
const char * name