Bump for 4.0-11
[LibreOffice.git] / fpicker / source / aqua / CFStringUtilities.hxx
blob7ca583425fcebfcc4d8f29cc6c418ad6a8011803
1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2 /*
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 .
20 #ifndef _CFSTRINGUTILITIES_HXX_
21 #define _CFSTRINGUTILITIES_HXX_
23 #include <premac.h>
24 #include <Carbon/Carbon.h>
25 #include <Cocoa/Cocoa.h>
26 #include <postmac.h>
27 #include <rtl/ustring.hxx>
28 #include <sal/types.h>
29 #include <osl/diagnose.h>
31 enum InfoType {
32 FULLPATH,
33 FILENAME,
34 PATHWITHOUTLASTCOMPONENT
37 rtl::OUString CFStringToOUString(const CFStringRef sOrig);
38 rtl::OUString FSRefToOUString(FSRef fsRef, InfoType info = FULLPATH);
39 rtl::OUString CFURLRefToOUString(CFURLRef aUrlRef, InfoType info);
40 CFStringRef CFStringCreateWithOUString(const rtl::OUString& aString);
42 //debug utils
43 #define PARAMFILLER "\n "
45 inline void DBG_PRINT_ENTRY() {
46 OSL_TRACE(">>> %s", __func__);
49 inline void DBG_PRINT_ENTRY(const char * classname, const char * methodname) {
50 OSL_TRACE(">>> %s::%s", classname, methodname);
53 inline void DBG_PRINT_ENTRY(const char * classname, const char * methodname, const char* param1, const char* value1) {
54 OSL_TRACE(">>> %s::%s%s%s = %s", classname, methodname, PARAMFILLER, param1, value1);
57 inline void DBG_PRINT_ENTRY(const char * classname, const char * methodname, const char* param1, const rtl::OUString& value1) {
58 OSL_TRACE(">>> %s::%s%s%s = %s", classname, methodname, PARAMFILLER, param1, OUStringToOString(value1, RTL_TEXTENCODING_UTF8).getStr());
61 #if OSL_DEBUG_LEVEL > 1
62 inline void DBG_PRINT_ENTRY(const char * classname, const char * methodname, const char* param1, const CFStringRef value1)
64 OSL_TRACE(">>> %s::%s%s%s =", classname, methodname, PARAMFILLER, param1);
65 CFShow(value1);
68 #else
69 inline void DBG_PRINT_ENTRY(const char * classname, const char * methodname, const char* param1, const CFStringRef /* value1 */)
71 OSL_TRACE(">>> %s::%s%s%s =", classname, methodname, PARAMFILLER, param1);
73 #endif
75 #if OSL_DEBUG_LEVEL > 1
76 inline void DBG_PRINT_ENTRY(const char * classname, const char * methodname, const char* param1, const NSString* value1)
78 OSL_TRACE(">>> %s::%s%s%s =", classname, methodname, PARAMFILLER, param1);
79 NSLog(value1);
81 #else
82 inline void DBG_PRINT_ENTRY(const char * classname, const char * methodname, const char* param1, const NSString* /* value1 */)
84 OSL_TRACE(">>> %s::%s%s%s =", classname, methodname, PARAMFILLER, param1);
86 #endif
88 inline void DBG_PRINT_ENTRY(const char * classname, const char * methodname, const char* param1, const int value1) {
89 OSL_TRACE(">>> %s::%s%s%s = %d", classname, methodname, PARAMFILLER, param1, value1);
92 inline void DBG_PRINT_ENTRY(const char * classname, const char * methodname, const char* param1, const char* value1, const char* param2, const int value2) {
93 OSL_TRACE(">>> %s::%s%s%s = %s%s%s = %d", classname, methodname, PARAMFILLER, param1, value1, PARAMFILLER, param2, value2);
96 inline void DBG_PRINT_ENTRY(const char * classname, const char * methodname, const char* param1, const char* value1, const char* param2, const char* value2) {
97 OSL_TRACE(">>> %s::%s%s%s = %s%s%s = %s", classname, methodname, PARAMFILLER, param1, value1, PARAMFILLER, param2, value2);
100 inline void DBG_PRINT_ENTRY(const char * classname, const char * methodname, const char* param1, const int value1, const char* param2, const int value2) {
101 OSL_TRACE(">>> %s::%s%s%s = %d%s%s = %d", classname, methodname, PARAMFILLER, param1, value1, PARAMFILLER, param2, value2);
104 inline void DBG_PRINT_ENTRY(const char * classname, const char * methodname, const char* param1, const int value1, const char* param2, const char* value2) {
105 OSL_TRACE(">>> %s::%s%s%s = %d%s%s = %s", classname, methodname, PARAMFILLER, param1, value1, PARAMFILLER, param2, value2);
108 inline void DBG_PRINT_ENTRY(const char * classname, const char * methodname, const char* param1, const int value1, const char* param2, const CFStringRef value2)
110 OSL_TRACE(">>> %s::%s%s%s = %d%s%s =", classname, methodname, PARAMFILLER, param1, value1, PARAMFILLER, param2, value2);
111 #if OSL_DEBUG_LEVEL > 1
112 CFShow(value2);
113 #endif
116 inline void DBG_PRINT_ENTRY(const char * classname, const char * methodname, const char* param1, const int value1, const char* param2, const NSString* value2)
118 OSL_TRACE(">>> %s::%s%s%s = %d%s%s =", classname, methodname, PARAMFILLER, param1, value1, PARAMFILLER, param2, value2);
119 #if OSL_DEBUG_LEVEL > 1
120 NSLog(value2);
121 #endif
125 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) {
126 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());
129 inline void DBG_PRINT_ENTRY(const char * classname, const char * methodname, const char* param1, const rtl::OUString& value1, const char* param2, const int value2) {
130 OSL_TRACE(">>> %s::%s%s%s = %s%s%s = %d", classname, methodname, PARAMFILLER, param1, OUStringToOString(value1, RTL_TEXTENCODING_UTF8).getStr(), PARAMFILLER, param2, value2);
133 //exit method debugs
135 inline void DBG_PRINT_EXIT() {
136 OSL_TRACE("<<< %s", __func__);
139 inline void DBG_PRINT_EXIT(const char * classname, const char * methodname) {
140 OSL_TRACE("<<< %s::%s", classname, methodname);
143 inline void DBG_PRINT_EXIT(const char * classname, const char * methodname, const char* retVal) {
144 OSL_TRACE("<<< %s::%s%sreturnValue = %s", classname, methodname, PARAMFILLER, retVal);
147 inline void DBG_PRINT_EXIT(const char * classname, const char * methodname, int retVal) {
148 OSL_TRACE("<<< %s::%s%sreturnValue = %d", classname, methodname, PARAMFILLER, retVal);
151 #if OSL_DEBUG_LEVEL > 1
152 inline void DBG_PRINT_EXIT(const char * classname, const char * methodname, const CFStringRef retVal)
154 OSL_TRACE("<<< %s::%s%sreturnValue = ", classname, methodname, PARAMFILLER);
155 CFShow(retVal);
157 #else
158 inline void DBG_PRINT_EXIT(const char * classname, const char * methodname, const CFStringRef /* retVal */)
160 OSL_TRACE("<<< %s::%s%sreturnValue = ", classname, methodname, PARAMFILLER);
162 #endif
164 #if OSL_DEBUG_LEVEL > 1
165 inline void DBG_PRINT_EXIT(const char * classname, const char * methodname, const NSString* retVal)
167 OSL_TRACE("<<< %s::%s%sreturnValue = ", classname, methodname, PARAMFILLER);
168 NSLog(retVal);
170 #else
171 inline void DBG_PRINT_EXIT(const char * classname, const char * methodname, const NSString* /* retVal */ )
173 OSL_TRACE("<<< %s::%s%sreturnValue = ", classname, methodname, PARAMFILLER);
175 #endif
177 inline void DBG_PRINT_EXIT(const char * classname, const char * methodname, const rtl::OUString& retVal) {
178 OSL_TRACE("<<< %s::%s%sreturnValue = %s", classname, methodname, PARAMFILLER, OUStringToOString(retVal, RTL_TEXTENCODING_UTF8).getStr());
181 #endif //_CFSTRINGUTILITIES_HXX_
183 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */