log4cplus
2.0.6
include
log4cplus
tstring.h
Go to the documentation of this file.
1
// -*- C++ -*-
2
// Module: Log4CPLUS
3
// File: tstring.h
4
// Created: 4/2003
5
// Author: Tad E. Smith
6
//
7
//
8
// Copyright 2003-2017 Tad E. Smith
9
//
10
// Licensed under the Apache License, Version 2.0 (the "License");
11
// you may not use this file except in compliance with the License.
12
// You may obtain a copy of the License at
13
//
14
// http://www.apache.org/licenses/LICENSE-2.0
15
//
16
// Unless required by applicable law or agreed to in writing, software
17
// distributed under the License is distributed on an "AS IS" BASIS,
18
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
19
// See the License for the specific language governing permissions and
20
// limitations under the License.
21
24
#ifndef LOG4CPLUS_TSTRING_HEADER_
25
#define LOG4CPLUS_TSTRING_HEADER_
26
27
#include <
log4cplus/config.hxx
>
28
29
#if defined (LOG4CPLUS_HAVE_PRAGMA_ONCE)
30
#pragma once
31
#endif
32
33
#include <string>
34
#include <
log4cplus/tchar.h
>
35
36
namespace
log4cplus
37
{
38
39
typedef
std::basic_string<tchar>
tstring
;
40
41
42
namespace
helpers
43
{
44
45
inline
46
std::string
47
tostring
(
char
const
* str)
48
{
49
return
std::string (str);
50
}
51
52
inline
53
std::string
54
tostring
(std::string
const
& str)
55
{
56
return
str;
57
}
58
59
inline
60
std::string
const
&
61
tostring
(std::string & str)
62
{
63
return
str;
64
}
65
66
inline
67
std::string
68
tostring
(std::string && str)
69
{
70
return
std::move (str);
71
}
72
73
74
inline
75
std::wstring
76
towstring
(
wchar_t
const
* str)
77
{
78
return
std::wstring (str);
79
}
80
81
inline
82
std::wstring
83
towstring
(std::wstring
const
& str)
84
{
85
return
str;
86
}
87
88
inline
89
std::wstring
const
&
90
towstring
(std::wstring & str)
91
{
92
return
str;
93
}
94
95
inline
96
std::wstring
97
towstring
(std::wstring && str)
98
{
99
return
std::move (str);
100
}
101
102
103
LOG4CPLUS_EXPORT
std::string
tostring
(
const
std::wstring&);
104
LOG4CPLUS_EXPORT
std::string
tostring
(
wchar_t
const
*);
105
106
LOG4CPLUS_EXPORT
std::wstring
towstring
(
const
std::string&);
107
LOG4CPLUS_EXPORT
std::wstring
towstring
(
char
const
*);
108
109
}
// namespace helpers
110
111
#ifdef UNICODE
112
113
#define LOG4CPLUS_C_STR_TO_TSTRING(STRING) log4cplus::helpers::towstring(STRING)
114
#define LOG4CPLUS_STRING_TO_TSTRING(STRING) log4cplus::helpers::towstring(STRING)
115
#define LOG4CPLUS_TSTRING_TO_STRING(STRING) log4cplus::helpers::tostring(STRING)
116
117
#else // UNICODE
118
119
#define LOG4CPLUS_C_STR_TO_TSTRING(STRING) (std::string(STRING))
120
#define LOG4CPLUS_STRING_TO_TSTRING(STRING) STRING
121
#define LOG4CPLUS_TSTRING_TO_STRING(STRING) STRING
122
123
#endif // UNICODE
124
125
}
// namespace log4cplus
126
127
128
#endif // LOG4CPLUS_TSTRING_HEADER_
log4cplus
Definition:
appender.h:46
log4cplus::tstring
std::basic_string< tchar > tstring
Definition:
tstring.h:39
tchar.h
log4cplus::helpers::towstring
std::wstring towstring(wchar_t const *str)
Definition:
tstring.h:76
config.hxx
log4cplus::helpers::tostring
std::string tostring(char const *str)
Definition:
tstring.h:47
LOG4CPLUS_EXPORT
#define LOG4CPLUS_EXPORT
Definition:
win32.h:141
Generated on Fri Jun 18 2021 08:46:20 for log4cplus by
1.8.17