]>
Commit | Line | Data |
---|---|---|
7c673cae FG |
1 | /* |
2 | * Copyright Andrey Semashev 2007 - 2015. | |
3 | * Distributed under the Boost Software License, Version 1.0. | |
4 | * (See accompanying file LICENSE_1_0.txt or copy at | |
5 | * http://www.boost.org/LICENSE_1_0.txt) | |
6 | */ | |
7 | /*! | |
8 | * \file embedded_string_type.hpp | |
9 | * \author Andrey Semashev | |
10 | * \date 16.08.2009 | |
11 | * | |
12 | * This header is the Boost.Log library implementation, see the library documentation | |
13 | * at http://www.boost.org/doc/libs/release/libs/log/doc/html/index.html. | |
14 | */ | |
15 | ||
16 | #ifndef BOOST_LOG_DETAIL_EMBEDDED_STRING_TYPE_HPP_INCLUDED_ | |
17 | #define BOOST_LOG_DETAIL_EMBEDDED_STRING_TYPE_HPP_INCLUDED_ | |
18 | ||
19 | #include <string> | |
20 | #include <boost/type_traits/remove_cv.hpp> | |
21 | #include <boost/log/detail/config.hpp> | |
22 | #include <boost/log/detail/header.hpp> | |
23 | ||
24 | #ifdef BOOST_HAS_PRAGMA_ONCE | |
25 | #pragma once | |
26 | #endif | |
27 | ||
28 | namespace boost { | |
29 | ||
30 | BOOST_LOG_OPEN_NAMESPACE | |
31 | ||
32 | namespace aux { | |
33 | ||
34 | template< typename T, typename ArgT > | |
35 | struct make_embedded_string_type_impl | |
36 | { | |
37 | typedef ArgT type; | |
38 | }; | |
39 | ||
40 | template< typename ArgT > | |
41 | struct make_embedded_string_type_impl< char, ArgT > | |
42 | { | |
43 | typedef std::basic_string< char > type; | |
44 | }; | |
45 | ||
46 | template< typename ArgT > | |
47 | struct make_embedded_string_type_impl< const char, ArgT > | |
48 | { | |
49 | typedef std::basic_string< char > type; | |
50 | }; | |
51 | ||
52 | template< typename ArgT > | |
53 | struct make_embedded_string_type_impl< wchar_t, ArgT > | |
54 | { | |
55 | typedef std::basic_string< wchar_t > type; | |
56 | }; | |
57 | ||
58 | template< typename ArgT > | |
59 | struct make_embedded_string_type_impl< const wchar_t, ArgT > | |
60 | { | |
61 | typedef std::basic_string< wchar_t > type; | |
62 | }; | |
63 | ||
64 | #if !defined(BOOST_NO_CXX11_CHAR16_T) | |
65 | template< typename ArgT > | |
66 | struct make_embedded_string_type_impl< char16_t, ArgT > | |
67 | { | |
68 | typedef std::basic_string< char16_t > type; | |
69 | }; | |
70 | ||
71 | template< typename ArgT > | |
72 | struct make_embedded_string_type_impl< const char16_t, ArgT > | |
73 | { | |
74 | typedef std::basic_string< char16_t > type; | |
75 | }; | |
76 | #endif | |
77 | ||
78 | #if !defined(BOOST_NO_CXX11_CHAR32_T) | |
79 | template< typename ArgT > | |
80 | struct make_embedded_string_type_impl< char32_t, ArgT > | |
81 | { | |
82 | typedef std::basic_string< char32_t > type; | |
83 | }; | |
84 | ||
85 | template< typename ArgT > | |
86 | struct make_embedded_string_type_impl< const char32_t, ArgT > | |
87 | { | |
88 | typedef std::basic_string< char32_t > type; | |
89 | }; | |
90 | #endif | |
91 | ||
92 | //! An auxiliary type translator to store strings by value in function objects and attribute values | |
93 | template< typename ArgT > | |
94 | struct make_embedded_string_type : | |
95 | public remove_cv< ArgT > | |
96 | { | |
97 | }; | |
98 | ||
99 | template< typename ArgT > | |
100 | struct make_embedded_string_type< ArgT* > : | |
101 | public make_embedded_string_type_impl< ArgT, ArgT* > | |
102 | { | |
103 | }; | |
104 | ||
105 | template< typename ArgT, unsigned int CountV > | |
106 | struct make_embedded_string_type< ArgT[CountV] > : | |
107 | public make_embedded_string_type_impl< ArgT, ArgT[CountV] > | |
108 | { | |
109 | }; | |
110 | ||
111 | template< typename ArgT, unsigned int CountV > | |
112 | struct make_embedded_string_type< ArgT(&)[CountV] > : | |
113 | public make_embedded_string_type_impl< ArgT, ArgT(&)[CountV] > | |
114 | { | |
115 | }; | |
116 | ||
117 | } // namespace aux | |
118 | ||
119 | BOOST_LOG_CLOSE_NAMESPACE // namespace log | |
120 | ||
121 | } // namespace boost | |
122 | ||
123 | #include <boost/log/detail/footer.hpp> | |
124 | ||
125 | #endif // BOOST_LOG_DETAIL_EMBEDDED_STRING_TYPE_HPP_INCLUDED_ |