1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2 /*************************************************************************
4 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
6 * Copyright 2000, 2010 Oracle and/or its affiliates.
8 * OpenOffice.org - a multi-platform office productivity suite
10 * This file is part of OpenOffice.org.
12 * OpenOffice.org is free software: you can redistribute it and/or modify
13 * it under the terms of the GNU Lesser General Public License version 3
14 * only, as published by the Free Software Foundation.
16 * OpenOffice.org is distributed in the hope that it will be useful,
17 * but WITHOUT ANY WARRANTY; without even the implied warranty of
18 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
19 * GNU Lesser General Public License version 3 for more details
20 * (a copy is included in the LICENSE file that accompanied this code).
22 * You should have received a copy of the GNU Lesser General Public License
23 * version 3 along with OpenOffice.org. If not, see
24 * <http://www.openoffice.org/license.html>
25 * for a copy of the LGPLv3 License.
27 ************************************************************************/
29 #ifndef _CFSTRINGUTILITIES_HXX_
30 #define _CFSTRINGUTILITIES_HXX_
33 #include <Carbon/Carbon.h>
34 #include <Cocoa/Cocoa.h>
36 #include <rtl/ustring.hxx>
37 #include <sal/types.h>
38 #include <osl/diagnose.h>
43 PATHWITHOUTLASTCOMPONENT
46 rtl::OUString
CFStringToOUString(const CFStringRef sOrig
);
47 rtl::OUString
FSRefToOUString(FSRef fsRef
, InfoType info
= FULLPATH
);
48 rtl::OUString
CFURLRefToOUString(CFURLRef aUrlRef
, InfoType info
);
49 CFStringRef
CFStringCreateWithOUString(const rtl::OUString
& aString
);
52 #define PARAMFILLER "\n "
54 inline void DBG_PRINT_ENTRY() {
55 OSL_TRACE(">>> %s", __func__
);
58 inline void DBG_PRINT_ENTRY(const char * classname
, const char * methodname
) {
59 OSL_TRACE(">>> %s::%s", classname
, methodname
);
62 inline void DBG_PRINT_ENTRY(const char * classname
, const char * methodname
, const char* param1
, const char* value1
) {
63 OSL_TRACE(">>> %s::%s%s%s = %s", classname
, methodname
, PARAMFILLER
, param1
, value1
);
66 inline void DBG_PRINT_ENTRY(const char * classname
, const char * methodname
, const char* param1
, const rtl::OUString
& value1
) {
67 OSL_TRACE(">>> %s::%s%s%s = %s", classname
, methodname
, PARAMFILLER
, param1
, OUStringToOString(value1
, RTL_TEXTENCODING_UTF8
).getStr());
70 #if OSL_DEBUG_LEVEL > 1
71 inline void DBG_PRINT_ENTRY(const char * classname
, const char * methodname
, const char* param1
, const CFStringRef value1
)
73 OSL_TRACE(">>> %s::%s%s%s =", classname
, methodname
, PARAMFILLER
, param1
);
78 inline void DBG_PRINT_ENTRY(const char * classname
, const char * methodname
, const char* param1
, const CFStringRef
/* value1 */)
80 OSL_TRACE(">>> %s::%s%s%s =", classname
, methodname
, PARAMFILLER
, param1
);
84 #if OSL_DEBUG_LEVEL > 1
85 inline void DBG_PRINT_ENTRY(const char * classname
, const char * methodname
, const char* param1
, const NSString
* value1
)
87 OSL_TRACE(">>> %s::%s%s%s =", classname
, methodname
, PARAMFILLER
, param1
);
91 inline void DBG_PRINT_ENTRY(const char * classname
, const char * methodname
, const char* param1
, const NSString
* /* value1 */)
93 OSL_TRACE(">>> %s::%s%s%s =", classname
, methodname
, PARAMFILLER
, param1
);
97 inline void DBG_PRINT_ENTRY(const char * classname
, const char * methodname
, const char* param1
, const int value1
) {
98 OSL_TRACE(">>> %s::%s%s%s = %d", classname
, methodname
, PARAMFILLER
, param1
, value1
);
101 inline void DBG_PRINT_ENTRY(const char * classname
, const char * methodname
, const char* param1
, const char* value1
, const char* param2
, const int value2
) {
102 OSL_TRACE(">>> %s::%s%s%s = %s%s%s = %d", classname
, methodname
, PARAMFILLER
, param1
, value1
, PARAMFILLER
, param2
, value2
);
105 inline void DBG_PRINT_ENTRY(const char * classname
, const char * methodname
, const char* param1
, const char* value1
, const char* param2
, const char* value2
) {
106 OSL_TRACE(">>> %s::%s%s%s = %s%s%s = %s", classname
, methodname
, PARAMFILLER
, param1
, value1
, PARAMFILLER
, param2
, value2
);
109 inline void DBG_PRINT_ENTRY(const char * classname
, const char * methodname
, const char* param1
, const int value1
, const char* param2
, const int value2
) {
110 OSL_TRACE(">>> %s::%s%s%s = %d%s%s = %d", classname
, methodname
, PARAMFILLER
, param1
, value1
, PARAMFILLER
, param2
, value2
);
113 inline void DBG_PRINT_ENTRY(const char * classname
, const char * methodname
, const char* param1
, const int value1
, const char* param2
, const char* value2
) {
114 OSL_TRACE(">>> %s::%s%s%s = %d%s%s = %s", classname
, methodname
, PARAMFILLER
, param1
, value1
, PARAMFILLER
, param2
, value2
);
117 inline void DBG_PRINT_ENTRY(const char * classname
, const char * methodname
, const char* param1
, const int value1
, const char* param2
, const CFStringRef value2
)
119 OSL_TRACE(">>> %s::%s%s%s = %d%s%s =", classname
, methodname
, PARAMFILLER
, param1
, value1
, PARAMFILLER
, param2
, value2
);
120 #if OSL_DEBUG_LEVEL > 1
125 inline void DBG_PRINT_ENTRY(const char * classname
, const char * methodname
, const char* param1
, const int value1
, const char* param2
, const NSString
* value2
)
127 OSL_TRACE(">>> %s::%s%s%s = %d%s%s =", classname
, methodname
, PARAMFILLER
, param1
, value1
, PARAMFILLER
, param2
, value2
);
128 #if OSL_DEBUG_LEVEL > 1
134 inline void DBG_PRINT_ENTRY(const char * classname
, const char * methodname
, const char* param1
, const rtl::OUString
& value1
, const char* param2
, const rtl::OUString
& value2
) {
135 OSL_TRACE(">>> %s::%s%s%s = %s%s%s = %s", classname
, methodname
, PARAMFILLER
, param1
, OUStringToOString(value1
, RTL_TEXTENCODING_UTF8
).getStr(), PARAMFILLER
, param2
, OUStringToOString(value2
, RTL_TEXTENCODING_UTF8
).getStr());
138 inline void DBG_PRINT_ENTRY(const char * classname
, const char * methodname
, const char* param1
, const rtl::OUString
& value1
, const char* param2
, const int value2
) {
139 OSL_TRACE(">>> %s::%s%s%s = %s%s%s = %d", classname
, methodname
, PARAMFILLER
, param1
, OUStringToOString(value1
, RTL_TEXTENCODING_UTF8
).getStr(), PARAMFILLER
, param2
, value2
);
144 inline void DBG_PRINT_EXIT() {
145 OSL_TRACE("<<< %s", __func__
);
148 inline void DBG_PRINT_EXIT(const char * classname
, const char * methodname
) {
149 OSL_TRACE("<<< %s::%s", classname
, methodname
);
152 inline void DBG_PRINT_EXIT(const char * classname
, const char * methodname
, const char* retVal
) {
153 OSL_TRACE("<<< %s::%s%sreturnValue = %s", classname
, methodname
, PARAMFILLER
, retVal
);
156 inline void DBG_PRINT_EXIT(const char * classname
, const char * methodname
, int retVal
) {
157 OSL_TRACE("<<< %s::%s%sreturnValue = %d", classname
, methodname
, PARAMFILLER
, retVal
);
160 #if OSL_DEBUG_LEVEL > 1
161 inline void DBG_PRINT_EXIT(const char * classname
, const char * methodname
, const CFStringRef retVal
)
163 OSL_TRACE("<<< %s::%s%sreturnValue = ", classname
, methodname
, PARAMFILLER
);
167 inline void DBG_PRINT_EXIT(const char * classname
, const char * methodname
, const CFStringRef
/* retVal */)
169 OSL_TRACE("<<< %s::%s%sreturnValue = ", classname
, methodname
, PARAMFILLER
);
173 #if OSL_DEBUG_LEVEL > 1
174 inline void DBG_PRINT_EXIT(const char * classname
, const char * methodname
, const NSString
* retVal
)
176 OSL_TRACE("<<< %s::%s%sreturnValue = ", classname
, methodname
, PARAMFILLER
);
180 inline void DBG_PRINT_EXIT(const char * classname
, const char * methodname
, const NSString
* /* retVal */ )
182 OSL_TRACE("<<< %s::%s%sreturnValue = ", classname
, methodname
, PARAMFILLER
);
186 inline void DBG_PRINT_EXIT(const char * classname
, const char * methodname
, const rtl::OUString
& retVal
) {
187 OSL_TRACE("<<< %s::%s%sreturnValue = %s", classname
, methodname
, PARAMFILLER
, OUStringToOString(retVal
, RTL_TEXTENCODING_UTF8
).getStr());
190 #endif //_CFSTRINGUTILITIES_HXX_
192 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */