Apache log4cxx  Version 0.13.0
logstring.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_STRING_H
19 #define _LOG4CXX_STRING_H
20 
21 #if defined(_MSC_VER)
22  #pragma warning ( push )
23  #pragma warning ( disable: 4231 4251 4275 4786 )
24 #endif
25 
26 
27 #include <string>
28 #include <log4cxx/log4cxx.h>
29 
30 #if (LOG4CXX_LOGCHAR_IS_WCHAR + LOG4CXX_LOGCHAR_IS_UTF8 + LOG4CXX_LOGCHAR_IS_UNICHAR)>1
31  #error only one of LOG4CXX_LOGCHAR_IS_WCHAR, LOG4CXX_LOGCHAR_IS_UTF8 or LOG4CXX_LOGCHAR_IS_UNICHAR may be true
32 #endif
33 
34 #if LOG4CXX_CFSTRING_API
35 extern "C" {
36  typedef const struct __CFString* CFStringRef;
37 }
38 #endif
39 
40 namespace log4cxx
41 {
42 
43 #if LOG4CXX_LOGCHAR_IS_UNICHAR || LOG4CXX_UNICHAR_API || LOG4CXX_CFSTRING_API
44  typedef unsigned short UniChar;
45 #endif
46 
47 #if LOG4CXX_LOGCHAR_IS_WCHAR
48  typedef wchar_t logchar;
49  #define LOG4CXX_STR(str) L ## str
50 #endif
51 
52 #if LOG4CXX_LOGCHAR_IS_UTF8
53  typedef char logchar;
54  #if LOG4CXX_CHARSET_EBCDIC
55  #define LOG4CXX_STR(str) log4cxx::helpers::Transcoder::decode(str)
56  #else
57  #define LOG4CXX_STR(str) str
58  #endif
59 #endif
60 
61 #if LOG4CXX_LOGCHAR_IS_UNICHAR
62  typedef UniChar logchar;
63  #define LOG4CXX_STR(str) log4cxx::helpers::Transcoder::decode(str)
64 #endif
65 
66 typedef std::basic_string<logchar> LogString;
67 
68 
69 }
70 
71 
72 #if !defined(LOG4CXX_EOL)
73  #if defined(_WIN32)
74  #define LOG4CXX_EOL LOG4CXX_STR("\x0D\x0A")
75  #else
76  #define LOG4CXX_EOL LOG4CXX_STR("\x0A")
77  #endif
78 #endif
79 
80 
81 #if LOG4CXX_LOGCHAR_IS_UNICHAR || (LOG4CXX_LOGCHAR_IS_UTF8 || LOG4CXX_CHARSET_EBCDIC)
83 #endif
84 
85 #if defined(_MSC_VER)
86  #pragma warning (pop)
87 #endif
88 
89 #endif //_LOG4CXX_STRING_H
unsigned short UniChar
Definition: logstring.h:44
const struct __CFString * CFStringRef
Definition: logstring.h:36
Definition: appender.h:32
std::basic_string< logchar > LogString
Definition: logstring.h:66