1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
3 * This file is part of the LibreOffice project.
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/.
9 * This file incorporates work covered by the following license notice:
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 .
19 #ifndef INCLUDED_SW_INC_DBGOUTSW_HXX
20 #define INCLUDED_SW_INC_DBGOUTSW_HXX
24 #include <rtl/ustring.hxx>
25 #include <rtl/ustrbuf.hxx>
28 #include <unordered_map>
47 class SwTextFormatColl
;
50 extern bool bDbgOutStdErr
;
51 extern bool bDbgOutPrintAttrSet
;
53 const char* dbg_out(const void* pVoid
);
54 const char* dbg_out(const OUString
& aStr
);
55 const char* dbg_out(const SwRect
& rRect
);
56 const char* dbg_out(const SwFrameFormat
& rFrameFormat
);
57 SW_DLLPUBLIC
const char* dbg_out(const SwNode
& rNode
);
58 SW_DLLPUBLIC
const char* dbg_out(const SwNode
* pNode
);
59 const char* dbg_out(const SwContentNode
* pNode
);
60 const char* dbg_out(const SwTextNode
* pNode
);
61 const char* dbg_out(const SwTextAttr
& rAttr
);
62 const char* dbg_out(const SwpHints
& rHints
);
63 const char* dbg_out(const SfxPoolItem
& rItem
);
64 const char* dbg_out(const SfxPoolItem
* pItem
);
65 const char* dbg_out(const SfxItemSet
& rSet
);
66 const char* dbg_out(const SwPosition
& rPos
);
67 const char* dbg_out(const SwPaM
& rPam
);
68 const char* dbg_out(const SwNodeNum
& rNum
);
69 const char* dbg_out(const SwUndo
& rUndo
);
70 const char* dbg_out(SwOutlineNodes
const& rNodes
);
71 const char* dbg_out(const SwNumRule
& rRule
);
72 const char* dbg_out(const SwTextFormatColl
& rFormat
);
73 const char* dbg_out(const SwFrameFormats
& rFrameFormats
);
74 const char* dbg_out(const SwNumRuleTable
& rTable
);
75 const char* dbg_out(const SwNodeRange
& rRange
);
77 template <typename tKey
, typename tMember
, typename fHashFunction
>
78 OUString
lcl_dbg_out(const std::unordered_map
<tKey
, tMember
, fHashFunction
>& rMap
)
80 OUStringBuffer
aResult("[");
82 typename
std::unordered_map
<tKey
, tMember
, fHashFunction
>::const_iterator aIt
;
84 for (aIt
= rMap
.begin(); aIt
!= rMap
.end(); ++aIt
)
86 if (aIt
!= rMap
.begin())
89 aResult
+= aIt
->first
;
92 sprintf(sBuffer
, "(%p)", aIt
->second
);
93 aResult
.appendAscii(sBuffer
);
98 return aResult
.makeStringAndClear();
101 template <typename tKey
, typename tMember
, typename fHashFunction
>
102 const char* dbg_out(const std::unordered_map
<tKey
, tMember
, fHashFunction
>& rMap
)
104 return dbg_out(lcl_dbg_out(rMap
));
106 const char* dbg_out(const SwFormToken
& rToken
);
107 const char* dbg_out(const SwFormTokens
& rTokens
);
109 #endif // INCLUDED_SW_INC_DBGOUTSW_HXX
111 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */