1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
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 __FRAMEWORK_MACROS_DEBUG_PLUGIN_HXX_
21 #define __FRAMEWORK_MACROS_DEBUG_PLUGIN_HXX_
23 //*****************************************************************************************************************
24 // special macros to debug asynchronous methods of plugin frame
25 //*****************************************************************************************************************
27 #ifdef ENABLE_PLUGINDEBUG
29 #include <rtl/strbuf.hxx>
30 #include <rtl/string.hxx>
32 /*_____________________________________________________________________________________________________________
35 For follow macros we need a special log file. If user forget to specify anyone, we must do it for him!
36 _____________________________________________________________________________________________________________*/
38 #ifndef LOGFILE_PLUGIN
39 #define LOGFILE_PLUGIN \
43 /*_____________________________________________________________________________________________________________
44 LOG_URLSEND( SFRAMENAME, SSENDMODE, SINTERNALURL, SEXTERNALURL )
46 Our plugin forward special url's to plugin dll, browser and webserver.
47 We convert internal url's to an external notation.
48 With this macro you can log some parameter of this operation.
49 _____________________________________________________________________________________________________________*/
51 #define LOG_URLSEND( SFRAMENAME, SSENDMODE, SINTERNALURL, SEXTERNALURL ) \
52 /* Use new scope to declare local private variables! */ \
54 OStringBuffer sBuffer(1024); \
55 sBuffer.append( "PlugInFrame [ \"" ); \
56 sBuffer.append( SFRAMENAME ); \
57 sBuffer.append( "\" ] send " ); \
58 sBuffer.append( SSENDMODE ); \
59 sBuffer.append( "( internalURL=\"" ); \
60 sBuffer.append( U2B( SINTERNALURL ) ); \
61 sBuffer.append( "\", externalURL=\""); \
62 sBuffer.append( U2B( SEXTERNALURL ) ); \
63 sBuffer.append( "\" ) to browser.\n"); \
64 WRITE_LOGFILE( LOGFILE_PLUGIN, sBuffer.makeStringAndClear() ) \
67 /*_____________________________________________________________________________________________________________
68 LOG_URLRECEIVE( SFRAMENAME, SRECEIVEMODE, SEXTERNALURL, SINTERNALURL )
70 A plugin frame can get a url request in two different modes.
73 We convert external url's to an internal notation.
74 With this macro you can log some parameter of this operations.
75 _____________________________________________________________________________________________________________*/
77 #define LOG_URLRECEIVE( SFRAMENAME, SRECEIVEMODE, SEXTERNALURL, SINTERNALURL ) \
78 /* Use new scope to declare local private variables! */ \
80 OStringBuffer sBuffer(1024); \
81 sBuffer.append( "PlugInFrame [ \"" ); \
82 sBuffer.append( U2B( SFRAMENAME ) ); \
83 sBuffer.append( "\" ] receive " ); \
84 sBuffer.append( SRECEIVEMODE ); \
85 sBuffer.append( "( externalURL=\"" ); \
86 sBuffer.append( U2B( SEXTERNALURL ) ); \
87 sBuffer.append( "\", internalURL=\"" ); \
88 sBuffer.append( U2B( SINTERNALURL ) ); \
89 sBuffer.append( "\" ) from browser.\n" ); \
90 WRITE_LOGFILE( LOGFILE_PLUGIN, sBuffer.makeStringAndClear() ) \
93 /*_____________________________________________________________________________________________________________
94 LOG_PARAMETER_NEWURL( SFRAMENAME, SMIMETYPE, SURL, AANY )
96 Log information about parameter of a newURL() at a plugin frame.
97 _____________________________________________________________________________________________________________*/
99 #define LOG_PARAMETER_NEWURL( SFRAMENAME, SMIMETYPE, SURL, sFILTER, AANY ) \
100 /* Use new scope to declare local private variables! */ \
102 OStringBuffer sBuffer(1024); \
103 sBuffer.append( "PlugInFrame [ \"" ); \
104 sBuffer.append( U2B( SFRAMENAME ) ); \
105 sBuffer.append( "\" ] called with newURL( \"" ); \
106 sBuffer.append( U2B( SMIMETYPE ) ); \
107 sBuffer.append( "\", \"" ); \
108 sBuffer.append( U2B( SURL ) ); \
109 sBuffer.append( "\", \"" ); \
110 sBuffer.append( U2B( SFILTER ) ); \
111 sBuffer.append( "\", " ); \
112 if( AANY.hasValue() == sal_True ) \
114 sBuffer.append( "filled Any )" ); \
118 sBuffer.append( "empty Any )" ); \
120 sBuffer.append( "\n" ); \
121 WRITE_LOGFILE( LOGFILE_PLUGIN, sBuffer.makeStringAndClear() ) \
124 /*_____________________________________________________________________________________________________________
125 LOG_PARAMETER_NEWSTREAM( SFRAMENAME, SMIMETYPE, SURL, ASTREAM, AANY )
127 Log information about parameter of a newStream() at a plugin frame.
128 _____________________________________________________________________________________________________________*/
130 #define LOG_PARAMETER_NEWSTREAM( SFRAMENAME, SMIMETYPE, SURL, SFILTER, XSTREAM, AANY ) \
131 /* Use new scope to declare local private variables! */ \
133 OStringBuffer sBuffer(1024); \
134 sBuffer.append( "PlugInFrame [ \"" ); \
135 sBuffer.append( U2B( SFRAMENAME ) ); \
136 sBuffer.append( "\" ] called with newStream( \""); \
137 sBuffer.append( U2B( SMIMETYPE ) ); \
138 sBuffer.append( "\", \"" ); \
139 sBuffer.append( U2B( SURL ) ); \
140 sBuffer.append( "\", \"" ); \
141 sBuffer.append( U2B( SFILTER ) ); \
142 sBuffer.append( "\", " ); \
143 if( XSTREAM.is() == sal_True ) \
145 sal_Int32 nBytes = XSTREAM->available(); \
146 OString sInfo("Stream with "); \
147 sInfo += OString::valueOf( (sal_Int32)nBytes ); \
148 sInfo += " Bytes, "; \
149 sBuffer.append( sInfo ); \
153 sBuffer.append( "empty Stream, " ); \
155 if( AANY.hasValue() == sal_True ) \
157 sBuffer.append( "filled Any )" ); \
161 sBuffer.append( "empty Any )" ); \
163 sBuffer.append( "\n" ); \
164 WRITE_LOGFILE( LOGFILE_PLUGIN, sBuffer.makeStringAndClear() ) \
167 #else // #ifdef ENABLE_PLUGINDEBUG
169 /*_____________________________________________________________________________________________________________
170 If right testmode is'nt set - implements these macro empty!
171 _____________________________________________________________________________________________________________*/
173 #undef LOGFILE_PLUGIN
174 #define LOG_URLSEND( SFRAMENAME, SSENDMODE, SINTERNALURL, SEXTERNALURL )
175 #define LOG_URLRECEIVE( SFRAMENAME, SRECEIVEMODE, SEXTERNALURL, SINTERNALURL )
176 #define LOG_PARAMETER_NEWURL( SFRAMENAME, SMIMETYPE, SURL, SFILTER, AANY )
177 #define LOG_PARAMETER_NEWSTREAM( SFRAMENAME, SMIMETYPE, SURL, SFILTER, XSTREAM, AANY )
179 #endif // #ifdef ENABLE_PLUGINDEBUG
181 #endif // #ifndef __FRAMEWORK_MACROS_DEBUG_PLUGIN_HXX_
183 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */