1 // Module:  Log4CPLUS
 2 // File:    tstring.h
 3 // Created: 4/2003
 4 // Author:  Tad E. Smith
 5 //
 6 //
 7 // Copyright (C) Tad E. Smith  All rights reserved.
 8 //
 9 // This software is published under the terms of the Apache Software
10 // License version 1.1, a copy of which has been included with this
11 // distribution in the LICENSE.APL file.
12 //
13 
14 /** @file */
15 
16 #ifndef LOG4CPLUS_TSTRING_HEADER_
17 #define LOG4CPLUS_TSTRING_HEADER_
18 
19 #include <log4cplus/config.h>
20 #include <string>
21 
22 #ifdef UNICODE
23 #  define LOG4CPLUS_TEXT(STRING) L##STRING
24 #else
25 #  define LOG4CPLUS_TEXT(STRING) STRING
26 #endif // UNICODE
27 
28 
29 #ifdef UNICODE
30 namespace log4cplus {
31     typedef wchar_t tchar;
32     typedef std::wstring tstring;
33 
34     namespace helpers {
35         LOG4CPLUS_EXPORT std::string tostring(const std::wstring&);
36         LOG4CPLUS_EXPORT std::wstring towstring(const std::string&);
37     }
38 
39 }
40 
41 #define LOG4CPLUS_C_STR_TO_TSTRING(STRING) log4cplus::helpers::towstring(STRING)
42 #define LOG4CPLUS_STRING_TO_TSTRING(STRING) log4cplus::helpers::towstring(STRING)
43 #define LOG4CPLUS_TSTRING_TO_STRING(STRING) log4cplus::helpers::tostring(STRING)
44 
45 #else
46 namespace log4cplus {
47     typedef char tchar;
48     typedef std::string tstring;
49 }
50 
51 #define LOG4CPLUS_C_STR_TO_TSTRING(STRING) std::string(STRING)
52 #define LOG4CPLUS_STRING_TO_TSTRING(STRING) STRING
53 #define LOG4CPLUS_TSTRING_TO_STRING(STRING) STRING
54 
55 #endif // UNICODE
56 
57 #endif // LOG4CPLUS_TSTRING_HEADER_


syntax highlighted by Code2HTML, v. 0.9.1