1 /*************************************************************************
2  *
3  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
4  *
5  * Copyright 2000, 2010 Oracle and/or its affiliates.
6  *
7  * OpenOffice.org - a multi-platform office productivity suite
8  *
9  * This file is part of OpenOffice.org.
10  *
11  * OpenOffice.org is free software: you can redistribute it and/or modify
12  * it under the terms of the GNU Lesser General Public License version 3
13  * only, as published by the Free Software Foundation.
14  *
15  * OpenOffice.org is distributed in the hope that it will be useful,
16  * but WITHOUT ANY WARRANTY; without even the implied warranty of
17  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
18  * GNU Lesser General Public License version 3 for more details
19  * (a copy is included in the LICENSE file that accompanied this code).
20  *
21  * You should have received a copy of the GNU Lesser General Public License
22  * version 3 along with OpenOffice.org.  If not, see
23  * <http://www.openoffice.org/license.html>
24  * for a copy of the LGPLv3 License.
25  *
26  ************************************************************************/
27 
28 #ifndef _FILTER_CONFIG_MACROS_HXX_
29 #define _FILTER_CONFIG_MACROS_HXX_
30 
31 //_______________________________________________
32 
33 #include <rtl/ustring.hxx>
34 
35 #ifdef _FILTER_CONFIG_FROM_ASCII_
36     #error "who already defined such macro :-("
37 #endif
38 
39 #ifdef _FILTER_CONFIG_TO_ASCII_
40     #error "who already defined such macro :-("
41 #endif
42 
43 /*
44 //#define _FILTER_CONFIG_FROM_ASCII_(ASCII_STRING)            \
45 //            ::rtl::OUString::createFromAscii(ASCII_STRING)
46 */
47 
48 #define _FILTER_CONFIG_FROM_ASCII_(ASCII_STRING)            \
49             ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM(ASCII_STRING))
50 
51 #define _FILTER_CONFIG_TO_ASCII_(UNICODE_STRING)            \
52             ::rtl::OUStringToOString(UNICODE_STRING, RTL_TEXTENCODING_UTF8).getStr()
53 
54 #define _FILTER_CONFIG_LOG_(TEXT)
55 #define _FILTER_CONFIG_LOG_1_(FORMAT, ARG1)
56 #define _FILTER_CONFIG_LOG_2_(FORMAT, ARG1, ARG2)
57 #define _FILTER_CONFIG_LOG_3_(FORMAT, ARG1, ARG2, ARG3)
58 
59 /*
60 #include <rtl/ustrbuf.hxx>
61 
62 #include <stdio.h>
63 
64 //_______________________________________________
65 
66     #ifdef _FILTER_CONFIG_LOG_
67         #error "who already defined such macro :-("
68     #endif
69 
70     #ifdef _FILTER_CONFIG_LOG_1_
71         #error "who already defined such macro :-("
72     #endif
73 
74     #ifdef _FILTER_CONFIG_LOG_2_
75         #error "who already defined such macro :-("
76     #endif
77 
78     #ifdef _FILTER_CONFIG_LOG_3_
79         #error "who already defined such macro :-("
80     #endif
81 
82     //-------------------------------------------
83     // @short  append given text to the log file
84     //
85     //    @param  TEXT [const char*]
86     //            contains the text, which should be logged
87     //
88     #define _FILTER_CONFIG_LOG_(TEXT)                           \
89                 {                                               \
90                     FILE* pFile = fopen("filtercache.log", "a");\
91                     fprintf(pFile, "%s", TEXT);                 \
92                     fclose(pFile);                              \
93                 }
94 
95     //-------------------------------------------
96     // @short  append given text to the log file
97     //            and supports using one optional argument.
98     //
99     //    @descr  The syntax of FORMAT and ARG1 follows the
100     //            mechanism of e.g. sprintf();
101     //
102     //    @param  FORMAT [const char*]
103     //            specify the format of the log message
104     //
105     //    @param  ARGn
106     //            points to any argument(s), which will be used
107     //            inside the FORMAT string to replace place holder(s).
108     //
109     #define _FILTER_CONFIG_LOG_1_(FORMAT, ARG1)                 \
110                 {                                               \
111                     FILE* pFile = fopen("filtercache.log", "a");\
112                     fprintf(pFile, FORMAT, ARG1);               \
113                     fclose(pFile);                              \
114                 }
115 
116     #define _FILTER_CONFIG_LOG_2_(FORMAT, ARG1, ARG2)           \
117                 {                                               \
118                     FILE* pFile = fopen("filtercache.log", "a");\
119                     fprintf(pFile, FORMAT, ARG1, ARG2);         \
120                     fclose(pFile);                              \
121                 }
122 
123     #define _FILTER_CONFIG_LOG_3_(FORMAT, ARG1, ARG2, ARG3)     \
124                 {                                               \
125                     FILE* pFile = fopen("filtercache.log", "a");\
126                     fprintf(pFile, FORMAT, ARG1, ARG2, ARG3);   \
127                     fclose(pFile);                              \
128                 }
129 
130 #endif // OSL_DEBUG_LEVEL < 2
131 */
132 #endif // _FILTER_CONFIG_MACROS_HXX_
133