1 /*************************************************************************
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
5 * Copyright 2008 by Sun Microsystems, Inc.
7 * OpenOffice.org - a multi-platform office productivity suite
9 * $RCSfile: dbgoutsw.hxx,v $
12 * This file is part of OpenOffice.org.
14 * OpenOffice.org is free software: you can redistribute it and/or modify
15 * it under the terms of the GNU Lesser General Public License version 3
16 * only, as published by the Free Software Foundation.
18 * OpenOffice.org is distributed in the hope that it will be useful,
19 * but WITHOUT ANY WARRANTY; without even the implied warranty of
20 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
21 * GNU Lesser General Public License version 3 for more details
22 * (a copy is included in the LICENSE file that accompanied this code).
24 * You should have received a copy of the GNU Lesser General Public License
25 * version 3 along with OpenOffice.org. If not, see
26 * <http://www.openoffice.org/license.html>
27 * for a copy of the LGPLv3 License.
29 ************************************************************************/
30 #ifndef __DBGOUTSW_HXX
31 #define __DBGOUTSW_HXX
58 #define DBG_OUT_HERE printf("%s(%d):", __FILE__, __LINE__)
59 #define DBG_OUT_HERE_FN printf("%s(%d) %s:", __FILE__, __LINE__, __FUNCTION__)
60 #define DBG_OUT_HERE_LN printf("%s(%d)\n", __FILE__, __LINE__)
61 #define DBG_OUT_HERE_FN_LN printf("%s(%d) %s\n", __FILE__, __LINE__, __FUNCTION__)
62 #define DBG_OUT(x) printf("%s\n", dbg_out(x))
63 #define DBG_OUT_LN(x) printf("%s(%d): %s\n", __FILE__, __LINE__, dbg_out(x))
64 #define DBG_OUT_FN_LN(x) printf("%s: %s\n", __FUNCTION__, dbg_out(x))
66 extern bool bDbgOutStdErr
;
67 extern bool bDbgOutPrintAttrSet
;
69 SW_DLLPUBLIC
const char * dbg_out(const void * pVoid
);
70 SW_DLLPUBLIC
const char * dbg_out(const String
& aStr
);
71 SW_DLLPUBLIC
const char * dbg_out(const SwRect
& rRect
);
72 SW_DLLPUBLIC
const char * dbg_out(const SwFrmFmt
& rFrmFmt
);
73 SW_DLLPUBLIC
const char * dbg_out(const SwNode
& rNode
);
74 SW_DLLPUBLIC
const char * dbg_out(const SwTxtAttr
& rAttr
);
75 SW_DLLPUBLIC
const char * dbg_out(const SwpHints
&rHints
);
76 SW_DLLPUBLIC
const char * dbg_out(const SfxPoolItem
& rItem
);
77 SW_DLLPUBLIC
const char * dbg_out(const SfxPoolItem
* pItem
);
78 SW_DLLPUBLIC
const char * dbg_out(const SfxItemSet
& rSet
);
79 SW_DLLPUBLIC
const char * dbg_out(SwNodes
& rNodes
);
80 // const char * dbg_out(SwOutlineNodes & rNodes);
81 SW_DLLPUBLIC
const char * dbg_out(const SwPosition
& rPos
);
82 SW_DLLPUBLIC
const char * dbg_out(const SwPaM
& rPam
);
83 SW_DLLPUBLIC
const char * dbg_out(const SwNodeNum
& rNum
);
84 SW_DLLPUBLIC
const char * dbg_out(const SwUndo
& rUndo
);
85 SW_DLLPUBLIC
const char * dbg_out(const SwUndos
& rUndos
);
86 SW_DLLPUBLIC
const char * dbg_out(const SwRewriter
& rRewriter
);
87 SW_DLLPUBLIC
const char * dbg_out(const SwNumRule
& rRule
);
88 SW_DLLPUBLIC
const char * dbg_out(const SwTxtFmtColl
& rFmt
);
89 SW_DLLPUBLIC
const char * dbg_out(const SwFrmFmts
& rFrmFmts
);
90 SW_DLLPUBLIC
const char * dbg_out(const SwNumRuleTbl
& rTbl
);
92 template<typename tKey
, typename tMember
, typename fHashFunction
>
93 String
lcl_dbg_out(const std::hash_map
<tKey
, tMember
, fHashFunction
> & rMap
)
95 String
aResult("[", RTL_TEXTENCODING_ASCII_US
);
97 typename
std::hash_map
<tKey
, tMember
, fHashFunction
>::const_iterator aIt
;
99 for (aIt
= rMap
.begin(); aIt
!= rMap
.end(); aIt
++)
101 if (aIt
!= rMap
.begin())
102 aResult
+= String(", ", RTL_TEXTENCODING_ASCII_US
);
104 aResult
+= aIt
->first
;
107 sprintf(sBuffer
, "(%p)", aIt
->second
);
108 aResult
+= String(sBuffer
, RTL_TEXTENCODING_ASCII_US
);
111 aResult
+= String("]", RTL_TEXTENCODING_ASCII_US
);
116 template<typename tKey
, typename tMember
, typename fHashFunction
>
117 const char * dbg_out(const std::hash_map
<tKey
, tMember
, fHashFunction
> & rMap
)
119 return dbg_out(lcl_dbg_out(rMap
));
121 const char * dbg_out(const SwFormToken
& rToken
);
122 const char * dbg_out(const SwFormTokens
& rTokens
);
124 #endif // __DBGOUTSW_HXX