1 /************************************************************** 2 * 3 * Licensed to the Apache Software Foundation (ASF) under one 4 * or more contributor license agreements. See the NOTICE file 5 * distributed with this work for additional information 6 * regarding copyright ownership. The ASF licenses this file 7 * to you under the Apache License, Version 2.0 (the 8 * "License"); you may not use this file except in compliance 9 * with the License. You may obtain a copy of the License at 10 * 11 * http://www.apache.org/licenses/LICENSE-2.0 12 * 13 * Unless required by applicable law or agreed to in writing, 14 * software distributed under the License is distributed on an 15 * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY 16 * KIND, either express or implied. See the License for the 17 * specific language governing permissions and limitations 18 * under the License. 19 * 20 *************************************************************/ 21 22 23 24 #ifndef _FILTER_CONFIG_MACROS_HXX_ 25 #define _FILTER_CONFIG_MACROS_HXX_ 26 27 //_______________________________________________ 28 29 #include <rtl/ustring.hxx> 30 31 #ifdef _FILTER_CONFIG_FROM_ASCII_ 32 #error "who already defined such macro :-(" 33 #endif 34 35 #ifdef _FILTER_CONFIG_TO_ASCII_ 36 #error "who already defined such macro :-(" 37 #endif 38 39 /* 40 //#define _FILTER_CONFIG_FROM_ASCII_(ASCII_STRING) \ 41 // ::rtl::OUString::createFromAscii(ASCII_STRING) 42 */ 43 44 #define _FILTER_CONFIG_FROM_ASCII_(ASCII_STRING) \ 45 ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM(ASCII_STRING)) 46 47 #define _FILTER_CONFIG_TO_ASCII_(UNICODE_STRING) \ 48 ::rtl::OUStringToOString(UNICODE_STRING, RTL_TEXTENCODING_UTF8).getStr() 49 50 #define _FILTER_CONFIG_LOG_(TEXT) 51 #define _FILTER_CONFIG_LOG_1_(FORMAT, ARG1) 52 #define _FILTER_CONFIG_LOG_2_(FORMAT, ARG1, ARG2) 53 #define _FILTER_CONFIG_LOG_3_(FORMAT, ARG1, ARG2, ARG3) 54 55 /* 56 #include <rtl/ustrbuf.hxx> 57 58 #include <stdio.h> 59 60 //_______________________________________________ 61 62 #ifdef _FILTER_CONFIG_LOG_ 63 #error "who already defined such macro :-(" 64 #endif 65 66 #ifdef _FILTER_CONFIG_LOG_1_ 67 #error "who already defined such macro :-(" 68 #endif 69 70 #ifdef _FILTER_CONFIG_LOG_2_ 71 #error "who already defined such macro :-(" 72 #endif 73 74 #ifdef _FILTER_CONFIG_LOG_3_ 75 #error "who already defined such macro :-(" 76 #endif 77 78 //------------------------------------------- 79 // @short append given text to the log file 80 // 81 // @param TEXT [const char*] 82 // contains the text, which should be logged 83 // 84 #define _FILTER_CONFIG_LOG_(TEXT) \ 85 { \ 86 FILE* pFile = fopen("filtercache.log", "a");\ 87 fprintf(pFile, "%s", TEXT); \ 88 fclose(pFile); \ 89 } 90 91 //------------------------------------------- 92 // @short append given text to the log file 93 // and supports using one optional argument. 94 // 95 // @descr The syntax of FORMAT and ARG1 follows the 96 // mechanism of e.g. sprintf(); 97 // 98 // @param FORMAT [const char*] 99 // specify the format of the log message 100 // 101 // @param ARGn 102 // points to any argument(s), which will be used 103 // inside the FORMAT string to replace place holder(s). 104 // 105 #define _FILTER_CONFIG_LOG_1_(FORMAT, ARG1) \ 106 { \ 107 FILE* pFile = fopen("filtercache.log", "a");\ 108 fprintf(pFile, FORMAT, ARG1); \ 109 fclose(pFile); \ 110 } 111 112 #define _FILTER_CONFIG_LOG_2_(FORMAT, ARG1, ARG2) \ 113 { \ 114 FILE* pFile = fopen("filtercache.log", "a");\ 115 fprintf(pFile, FORMAT, ARG1, ARG2); \ 116 fclose(pFile); \ 117 } 118 119 #define _FILTER_CONFIG_LOG_3_(FORMAT, ARG1, ARG2, ARG3) \ 120 { \ 121 FILE* pFile = fopen("filtercache.log", "a");\ 122 fprintf(pFile, FORMAT, ARG1, ARG2, ARG3); \ 123 fclose(pFile); \ 124 } 125 126 #endif // OSL_DEBUG_LEVEL < 2 127 */ 128 #endif // _FILTER_CONFIG_MACROS_HXX_ 129