# tstring.h

Go to the documentation of this file.

    00001 // Module:  Log4CPLUS
    00002 // File:    tstring.h
    00003 // Created: 4/2003
    00004 // Author:  Tad E. Smith
    00005 //
    00006 //
    00007 // Copyright (C) Tad E. Smith  All rights reserved.
    00008 //
    00009 // This software is published under the terms of the Apache Software
    00010 // License version 1.1, a copy of which has been included with this
    00011 // distribution in the LICENSE.APL file.
    00012 //
    00013
    00016 #ifndef LOG4CPLUS_TSTRING_HEADER_
    00017 #define LOG4CPLUS_TSTRING_HEADER_
    00018
    00019 #include <log4cplus/config.h>
    00020 #include <string>
    00021
    00022 #ifdef UNICODE
    00023 #  define LOG4CPLUS_TEXT(STRING) L##STRING
    00024 #else
    00025 #  define LOG4CPLUS_TEXT(STRING) STRING
    00026 #endif // UNICODE
    00027
    00028
    00029 #ifdef UNICODE
    00030 namespace log4cplus {
    00031     typedef wchar_t tchar;
    00032     typedef std::wstring tstring;
    00033
    00034     namespace helpers {
    00035         LOG4CPLUS_EXPORT std::string tostring(const std::wstring&);
    00036         LOG4CPLUS_EXPORT std::wstring towstring(const std::string&);
    00037     }
    00038
    00039 }
    00040
    00041 #define LOG4CPLUS_C_STR_TO_TSTRING(STRING) log4cplus::helpers::towstring(STRING)
    00042 #define LOG4CPLUS_STRING_TO_TSTRING(STRING) log4cplus::helpers::towstring(STRING)
    00043 #define LOG4CPLUS_TSTRING_TO_STRING(STRING) log4cplus::helpers::tostring(STRING)
    00044
    00045 #else
    00046 namespace log4cplus {
    00047     typedef char tchar;
    00048     typedef std::string tstring;
    00049 }
    00050
    00051 #define LOG4CPLUS_C_STR_TO_TSTRING(STRING) std::string(STRING)
    00052 #define LOG4CPLUS_STRING_TO_TSTRING(STRING) STRING
    00053 #define LOG4CPLUS_TSTRING_TO_STRING(STRING) STRING
    00054
    00055 #endif // UNICODE
    00056
    00057 #endif // LOG4CPLUS_TSTRING_HEADER_
    00058