Update ooo320-m1
[ooovba.git] / fpicker / source / aqua / CFStringUtilities.hxx
blob1f5bf373206399a438fe9a59593dc10f084a3c42
1 /*************************************************************************
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
4 *
5 * Copyright 2008 by Sun Microsystems, Inc.
7 * OpenOffice.org - a multi-platform office productivity suite
9 * $RCSfile: CFStringUtilities.hxx,v $
10 * $Revision: 1.4 $
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 ************************************************************************/
31 #ifndef _CFSTRINGUTILITIES_HXX_
32 #define _CFSTRINGUTILITIES_HXX_
34 #include <premac.h>
35 #include <Carbon/Carbon.h>
36 #include <Cocoa/Cocoa.h>
37 #include <postmac.h>
38 #include <rtl/ustring.hxx>
39 #include <sal/types.h>
40 #include <osl/diagnose.h>
42 enum InfoType {
43 FULLPATH,
44 FILENAME,
45 PATHWITHOUTLASTCOMPONENT
48 rtl::OUString CFStringToOUString(const CFStringRef sOrig);
49 rtl::OUString FSRefToOUString(FSRef fsRef, InfoType info = FULLPATH);
50 rtl::OUString CFURLRefToOUString(CFURLRef aUrlRef, InfoType info);
51 CFStringRef CFStringCreateWithOUString(const rtl::OUString& aString);
53 //debug utils
54 #define PARAMFILLER "\n "
56 inline void DBG_PRINT_ENTRY() {
57 OSL_TRACE(">>> %s", __func__);
60 inline void DBG_PRINT_ENTRY(const char * classname, const char * methodname) {
61 OSL_TRACE(">>> %s::%s", classname, methodname);
64 inline void DBG_PRINT_ENTRY(const char * classname, const char * methodname, const char* param1, const char* value1) {
65 OSL_TRACE(">>> %s::%s%s%s = %s", classname, methodname, PARAMFILLER, param1, value1);
68 inline void DBG_PRINT_ENTRY(const char * classname, const char * methodname, const char* param1, const rtl::OUString& value1) {
69 OSL_TRACE(">>> %s::%s%s%s = %s", classname, methodname, PARAMFILLER, param1, OUStringToOString(value1, RTL_TEXTENCODING_UTF8).getStr());
72 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);
74 #if OSL_DEBUG_LEVEL > 1
75 CFShow(value1);
76 #endif
79 inline void DBG_PRINT_ENTRY(const char * classname, const char * methodname, const char* param1, const NSString* value1) {
80 OSL_TRACE(">>> %s::%s%s%s =", classname, methodname, PARAMFILLER, param1);
81 #if OSL_DEBUG_LEVEL > 1
82 NSLog(value1);
83 #endif
86 inline void DBG_PRINT_ENTRY(const char * classname, const char * methodname, const char* param1, const int value1) {
87 OSL_TRACE(">>> %s::%s%s%s = %d", classname, methodname, PARAMFILLER, param1, value1);
90 inline void DBG_PRINT_ENTRY(const char * classname, const char * methodname, const char* param1, const char* value1, const char* param2, const int value2) {
91 OSL_TRACE(">>> %s::%s%s%s = %s%s%s = %d", classname, methodname, PARAMFILLER, param1, value1, PARAMFILLER, param2, value2);
94 inline void DBG_PRINT_ENTRY(const char * classname, const char * methodname, const char* param1, const char* value1, const char* param2, const char* value2) {
95 OSL_TRACE(">>> %s::%s%s%s = %s%s%s = %s", classname, methodname, PARAMFILLER, param1, value1, PARAMFILLER, param2, value2);
98 inline void DBG_PRINT_ENTRY(const char * classname, const char * methodname, const char* param1, const int value1, const char* param2, const int value2) {
99 OSL_TRACE(">>> %s::%s%s%s = %d%s%s = %d", classname, methodname, PARAMFILLER, param1, value1, PARAMFILLER, param2, value2);
102 inline void DBG_PRINT_ENTRY(const char * classname, const char * methodname, const char* param1, const int value1, const char* param2, const char* value2) {
103 OSL_TRACE(">>> %s::%s%s%s = %d%s%s = %s", classname, methodname, PARAMFILLER, param1, value1, PARAMFILLER, param2, value2);
106 inline void DBG_PRINT_ENTRY(const char * classname, const char * methodname, const char* param1, const int value1, const char* param2, const CFStringRef value2) {
107 OSL_TRACE(">>> %s::%s%s%s = %d%s%s =", classname, methodname, PARAMFILLER, param1, value1, PARAMFILLER, param2, value2);
108 #if OSL_DEBUG_LEVEL > 1
109 CFShow(value2);
110 #endif
113 inline void DBG_PRINT_ENTRY(const char * classname, const char * methodname, const char* param1, const int value1, const char* param2, const NSString* value2) {
114 OSL_TRACE(">>> %s::%s%s%s = %d%s%s =", classname, methodname, PARAMFILLER, param1, value1, PARAMFILLER, param2, value2);
115 #if OSL_DEBUG_LEVEL > 1
116 NSLog(value2);
117 #endif
120 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) {
121 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());
124 inline void DBG_PRINT_ENTRY(const char * classname, const char * methodname, const char* param1, const rtl::OUString& value1, const char* param2, const int value2) {
125 OSL_TRACE(">>> %s::%s%s%s = %s%s%s = %d", classname, methodname, PARAMFILLER, param1, OUStringToOString(value1, RTL_TEXTENCODING_UTF8).getStr(), PARAMFILLER, param2, value2);
128 //exit method debugs
130 inline void DBG_PRINT_EXIT() {
131 OSL_TRACE("<<< %s", __func__);
134 inline void DBG_PRINT_EXIT(const char * classname, const char * methodname) {
135 OSL_TRACE("<<< %s::%s", classname, methodname);
138 inline void DBG_PRINT_EXIT(const char * classname, const char * methodname, const char* retVal) {
139 OSL_TRACE("<<< %s::%s%sreturnValue = %s", classname, methodname, PARAMFILLER, retVal);
142 inline void DBG_PRINT_EXIT(const char * classname, const char * methodname, int retVal) {
143 OSL_TRACE("<<< %s::%s%sreturnValue = %d", classname, methodname, PARAMFILLER, retVal);
146 inline void DBG_PRINT_EXIT(const char * classname, const char * methodname, const CFStringRef retVal) {
147 OSL_TRACE("<<< %s::%s%sreturnValue = ", classname, methodname, PARAMFILLER);
148 #if OSL_DEBUG_LEVEL > 1
149 CFShow(retVal);
150 #endif
153 inline void DBG_PRINT_EXIT(const char * classname, const char * methodname, const NSString* retVal) {
154 OSL_TRACE("<<< %s::%s%sreturnValue = ", classname, methodname, PARAMFILLER);
155 #if OSL_DEBUG_LEVEL > 1
156 NSLog(retVal);
157 #endif
160 inline void DBG_PRINT_EXIT(const char * classname, const char * methodname, const rtl::OUString& retVal) {
161 OSL_TRACE("<<< %s::%s%sreturnValue = %s", classname, methodname, PARAMFILLER, OUStringToOString(retVal, RTL_TEXTENCODING_UTF8).getStr());
164 #endif //_CFSTRINGUTILITIES_HXX_