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