Apache Log4cxx  Version 1.2.0
Loading...
Searching...
No Matches
log4cxx-qt/messagebuffer.h
Go to the documentation of this file.
1/*
2 * Licensed to the Apache Software Foundation (ASF) under one or more
3 * contributor license agreements. See the NOTICE file distributed with
4 * this work for additional information regarding copyright ownership.
5 * The ASF licenses this file to You under the Apache License, Version 2.0
6 * (the "License"); you may not use this file except in compliance with
7 * the License. You may obtain a copy of the License at
8 *
9 * http://www.apache.org/licenses/LICENSE-2.0
10 *
11 * Unless required by applicable law or agreed to in writing, software
12 * distributed under the License is distributed on an "AS IS" BASIS,
13 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14 * See the License for the specific language governing permissions and
15 * limitations under the License.
16 */
17
18#ifndef _LOG4CXX_QT_MESSAGE_BUFFER_H
19#define _LOG4CXX_QT_MESSAGE_BUFFER_H
21
22#if LOG4CXX_UNICHAR_API || LOG4CXX_LOGCHAR_IS_UNICHAR
23 inline LOG4CXX_NS::helpers::UniCharMessageBuffer&
24operator<<(LOG4CXX_NS::helpers::UniCharMessageBuffer& mb, const QString& msg)
25{
26 return mb << msg.utf16();
27}
28
29#if LOG4CXX_WCHAR_T_API
30 inline LOG4CXX_NS::helpers::WideMessageBuffer&
31operator<<(LOG4CXX_NS::helpers::WideMessageBuffer& mb, const QString& msg)
32{
33 return mb << msg.toStdWString();
34}
35
36 inline LOG4CXX_NS::helpers::WideMessageBuffer&
37operator<<(LOG4CXX_NS::helpers::MessageBuffer& mb, const QString& msg)
38{
39 return mb << msg.toStdWString();
40}
41#else // !LOG4CXX_WCHAR_T_API
42 inline LOG4CXX_NS::helpers::UniCharMessageBuffer&
43operator<<(LOG4CXX_NS::helpers::MessageBuffer& mb, const QString& msg)
44{
45 return mb << msg.utf16();
46}
47#endif // !LOG4CXX_WCHAR_T_API
48
49#else // !(LOG4CXX_UNICHAR_API || LOG4CXX_LOGCHAR_IS_UNICHAR)
50
51#if LOG4CXX_WCHAR_T_API
52 inline LOG4CXX_NS::helpers::WideMessageBuffer&
53operator<<(LOG4CXX_NS::helpers::WideMessageBuffer& mb, const QString& msg)
54{
55 return mb << msg.toStdWString();
56}
57
58 inline LOG4CXX_NS::helpers::WideMessageBuffer&
59operator<<(LOG4CXX_NS::helpers::MessageBuffer& mb, const QString& msg)
60{
61 return mb << msg.toStdWString();
62}
63#else // !LOG4CXX_WCHAR_T_API
64 inline LOG4CXX_NS::helpers::CharMessageBuffer&
65operator<<(LOG4CXX_NS::helpers::CharMessageBuffer& mb, const QString& msg)
66{
67 LOG4CXX_DECODE_QSTRING(tmp, msg);
68 return mb << tmp;
69}
70#endif // !LOG4CXX_WCHAR_T_API
71
72#endif // !(LOG4CXX_UNICHAR_API || LOG4CXX_LOGCHAR_IS_UNICHAR)
73
74#endif // _LOG4CXX_QT_MESSAGE_BUFFER_H
log4cxx::helpers::UniCharMessageBuffer & operator<<(log4cxx::helpers::UniCharMessageBuffer &mb, const QString &msg)
Definition: log4cxx-qt/messagebuffer.h:24