LibreOffice Module sw (master)  1
dbgoutsw.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 #ifndef INCLUDED_SW_INC_DBGOUTSW_HXX
20 #define INCLUDED_SW_INC_DBGOUTSW_HXX
21 
22 #ifdef DBG_UTIL
23 
24 #include <rtl/ustring.hxx>
25 #include <rtl/ustrbuf.hxx>
26 #include "tox.hxx"
27 #include <cstdio>
28 #include <string_view>
29 #include <unordered_map>
30 
31 class SwContentNode;
32 class SwNode;
33 class SwTextAttr;
34 class SwTextNode;
35 class SwpHints;
36 class SfxPoolItem;
37 class SfxItemSet;
38 struct SwPosition;
39 class SwPaM;
40 class SwNodeNum;
41 class SwUndo;
42 class SwRect;
43 class SwFrameFormat;
44 class SwFrameFormats;
45 class SwNumRuleTable;
46 class SwNumRule;
47 class SwOutlineNodes;
48 class SwTextFormatColl;
49 class SwNodeRange;
50 
51 extern bool bDbgOutStdErr;
52 extern bool bDbgOutPrintAttrSet;
53 
54 const char* dbg_out(const void* pVoid);
55 const char* dbg_out(std::u16string_view aStr);
56 const char* dbg_out(const SwRect& rRect);
57 const char* dbg_out(const SwFrameFormat& rFrameFormat);
58 SW_DLLPUBLIC const char* dbg_out(const SwNode& rNode);
59 SW_DLLPUBLIC const char* dbg_out(const SwNode* pNode);
60 const char* dbg_out(const SwContentNode* pNode);
61 const char* dbg_out(const SwTextNode* pNode);
62 const char* dbg_out(const SwTextAttr& rAttr);
63 const char* dbg_out(const SwpHints& rHints);
64 const char* dbg_out(const SfxPoolItem& rItem);
65 const char* dbg_out(const SfxPoolItem* pItem);
66 const char* dbg_out(const SfxItemSet& rSet);
67 const char* dbg_out(const SwPosition& rPos);
68 const char* dbg_out(const SwPaM& rPam);
69 const char* dbg_out(const SwNodeNum& rNum);
70 const char* dbg_out(const SwUndo& rUndo);
71 const char* dbg_out(SwOutlineNodes const& rNodes);
72 const char* dbg_out(const SwNumRule& rRule);
73 const char* dbg_out(const SwTextFormatColl& rFormat);
74 const char* dbg_out(const SwFrameFormats& rFrameFormats);
75 const char* dbg_out(const SwNumRuleTable& rTable);
76 const char* dbg_out(const SwNodeRange& rRange);
77 
78 template <typename tKey, typename tMember, typename fHashFunction>
79 OUString lcl_dbg_out(const std::unordered_map<tKey, tMember, fHashFunction>& rMap)
80 {
81  OUStringBuffer aResult("[");
82 
83  typename std::unordered_map<tKey, tMember, fHashFunction>::const_iterator aIt;
84 
85  for (aIt = rMap.begin(); aIt != rMap.end(); ++aIt)
86  {
87  if (aIt != rMap.begin())
88  aResult.append(", ");
89 
90  aResult += aIt->first;
91 
92  char sBuffer[256];
93  sprintf(sBuffer, "(%p)", aIt->second);
94  aResult.appendAscii(sBuffer);
95  }
96 
97  aResult.append("]");
98 
99  return aResult.makeStringAndClear();
100 }
101 
102 template <typename tKey, typename tMember, typename fHashFunction>
103 const char* dbg_out(const std::unordered_map<tKey, tMember, fHashFunction>& rMap)
104 {
105  return dbg_out(lcl_dbg_out(rMap));
106 }
107 const char* dbg_out(const SwFormToken& rToken);
108 const char* dbg_out(const SwFormTokens& rTokens);
109 #endif // DBG_UTIL
110 #endif // INCLUDED_SW_INC_DBGOUTSW_HXX
111 
112 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
std::vector< SwFormToken > SwFormTokens
Vector of tokens.
Definition: tox.hxx:291
Represents the style of a paragraph.
Definition: fmtcol.hxx:56
Marks a position in the document model.
Definition: pam.hxx:35
Of course Writer needs its own rectangles.
Definition: swrect.hxx:35
A wrapper around SfxPoolItem to store the start position of (usually) a text portion, with an optional end.
Definition: txatbase.hxx:41
Specific frame formats (frames, DrawObjects).
bool bDbgOutPrintAttrSet
Definition: dbgoutsw.cxx:51
PaM is Point and Mark: a selection of the document model.
Definition: pam.hxx:136
Style of a layout element.
Definition: frmfmt.hxx:58
#define SW_DLLPUBLIC
Definition: swdllapi.h:28
OUString lcl_dbg_out(const std::unordered_map< tKey, tMember, fHashFunction > &rMap)
Definition: dbgoutsw.hxx:79
SwTextNode is a paragraph in the document model.
Definition: ndtxt.hxx:79
An SwTextAttr container, stores all directly formatted text portions for a text node.
Definition: ndhints.hxx:67
const char * dbg_out(const void *pVoid)
Definition: dbgoutsw.cxx:74
bool bDbgOutStdErr
Definition: dbgoutsw.cxx:50
Base class of the Writer document model elements.
Definition: node.hxx:80