00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024
00025
00026
00027
00028
00029
00030
00031
00032
00033
00034
00035
00036
00037
00038
00039
00040
00047 #ifndef STLSOFT_INCL_STLSOFT_STRING_HPP_STRING_TRAITS
00048 #define STLSOFT_INCL_STLSOFT_STRING_HPP_STRING_TRAITS
00049
00050 #ifndef STLSOFT_DOCUMENTATION_SKIP_SECTION
00051 # define STLSOFT_VER_STLSOFT_STRING_HPP_STRING_TRAITS_MAJOR 4
00052 # define STLSOFT_VER_STLSOFT_STRING_HPP_STRING_TRAITS_MINOR 0
00053 # define STLSOFT_VER_STLSOFT_STRING_HPP_STRING_TRAITS_REVISION 4
00054 # define STLSOFT_VER_STLSOFT_STRING_HPP_STRING_TRAITS_EDIT 78
00055 #endif
00056
00057
00058
00059
00060
00061
00062
00063
00064
00065
00066
00067
00068
00069
00070 #ifndef STLSOFT_INCL_STLSOFT_H_STLSOFT
00071 # include <stlsoft/stlsoft.h>
00072 #endif
00073 #ifndef STLSOFT_INCL_STLSOFT_STRING_HPP_CHAR_TRAITS
00074 # include <stlsoft/string/char_traits.hpp>
00075 #endif
00076 #ifndef STLSOFT_INCL_STLSOFT_STRING_HPP_STRING_TRAITS_FWD
00077 # include <stlsoft/string/string_traits_fwd.hpp>
00078 #endif
00079 #ifndef _STLSOFT_STRING_TRAITS_NO_STD_STRING
00080 # include <string>
00081 #endif
00082
00083 #ifdef STLSOFT_UNITTEST
00084 # include <string>
00085 # include <stlsoft/meta/base_type_traits.hpp>
00086 #endif
00087
00088
00089
00090
00091
00092 #ifndef _STLSOFT_NO_NAMESPACE
00093 namespace stlsoft
00094 {
00095 #endif
00096
00097
00098
00099
00100
00101 #ifndef STLSOFT_DOCUMENTATION_SKIP_SECTION
00102
00103
00104 STLSOFT_TEMPLATE_SPECIALISATION
00105 struct string_traits<ss_char_a_t *>
00106 {
00107 typedef ss_char_a_t value_type;
00108 typedef ss_char_a_t char_type;
00109 typedef ss_size_t size_type;
00110 typedef char_type const const_char_type;
00111 typedef value_type const* string_type;
00112 typedef value_type* pointer;
00113 typedef value_type const* const_pointer;
00114 enum { is_pointer = true };
00115 enum { is_pointer_to_const = false };
00116 enum { char_type_size = int(sizeof(char_type)) };
00117
00118 static string_type empty_string()
00119 {
00120
00121
00122
00123 static char_type s_empty[1];
00124
00125 STLSOFT_ASSERT(s_empty[0] == '\0');
00126
00127 return s_empty;
00128 }
00129 };
00130
00131 STLSOFT_TEMPLATE_SPECIALISATION
00132 struct string_traits<ss_char_a_t const*>
00133 {
00134 typedef ss_char_a_t value_type;
00135 typedef ss_char_a_t char_type;
00136 typedef ss_size_t size_type;
00137 typedef char_type const const_char_type;
00138 typedef value_type const* string_type;
00139 typedef value_type* pointer;
00140 typedef value_type const* const_pointer;
00141 enum { is_pointer = true };
00142 enum { is_pointer_to_const = false };
00143 enum { char_type_size = int(sizeof(char_type)) };
00144
00145 static string_type empty_string()
00146 {
00147
00148
00149
00150 static char_type s_empty[1];
00151
00152 STLSOFT_ASSERT(s_empty[0] == '\0');
00153
00154 return s_empty;
00155 }
00156 };
00157
00158
00159 # if 0
00160 # ifdef STLSOFT_CF_STATIC_ARRAY_SIZE_DETERMINATION_SUPPORT
00161 # if 1
00162
00163 template <ss_size_t N>
00164 struct string_traits<ss_char_a_t const (&)[N]>
00165 : public string_traits<ss_char_a_t const*>
00166 {};
00167
00168 template <ss_size_t N>
00169 struct string_traits<ss_char_a_t (&)[N]>
00170 : public string_traits<ss_char_a_t *>
00171 {};
00172
00173 STLSOFT_TEMPLATE_SPECIALISATION
00174 struct string_traits<ss_char_a_t const []>
00175 : public string_traits<ss_char_a_t const*>
00176 {};
00177
00178 STLSOFT_TEMPLATE_SPECIALISATION
00179 struct string_traits<ss_char_a_t []>
00180 : public string_traits<ss_char_a_t *>
00181 {};
00182
00183 # else
00184
00185 template <ss_typename_param_k C, ss_size_t N>
00186 struct string_traits<C (&)[N]>
00187 : public string_traits<C *>
00188 {
00189 typedef ss_char_a_t value_type;
00190 typedef ss_char_a_t char_type;
00191 typedef ss_size_t size_type;
00192 typedef char_type const const_char_type;
00193 typedef value_type const* string_type;
00194 typedef value_type* pointer;
00195 typedef value_type const* const_pointer;
00196 };
00197
00198 template <ss_typename_param_k C, ss_size_t N>
00199 struct string_traits<C const (&)[N]>
00200 : public string_traits<C const*>
00201 {
00202 typedef ss_char_a_t value_type;
00203 typedef ss_char_a_t char_type;
00204 typedef ss_size_t size_type;
00205 typedef char_type const const_char_type;
00206 typedef value_type const* string_type;
00207 typedef value_type* pointer;
00208 typedef value_type const* const_pointer;
00209 };
00210
00211 # endif
00212 # endif
00213 # endif
00214
00215
00216
00217 STLSOFT_TEMPLATE_SPECIALISATION
00218 struct string_traits<ss_char_w_t *>
00219 {
00220 typedef ss_char_w_t value_type;
00221 typedef ss_char_w_t char_type;
00222 typedef ss_size_t size_type;
00223 typedef char_type const const_char_type;
00224 typedef value_type const* string_type;
00225 typedef value_type* pointer;
00226 typedef value_type const* const_pointer;
00227 enum { is_pointer = true };
00228 enum { is_pointer_to_const = false };
00229 enum { char_type_size = int(sizeof(char_type)) };
00230
00231 static string_type empty_string()
00232 {
00233
00234
00235
00236 static char_type s_empty[1];
00237
00238 STLSOFT_ASSERT(s_empty[0] == '\0');
00239
00240 return s_empty;
00241 }
00242 };
00243
00244 STLSOFT_TEMPLATE_SPECIALISATION
00245 struct string_traits<ss_char_w_t const*>
00246 {
00247 typedef ss_char_w_t value_type;
00248 typedef ss_char_w_t char_type;
00249 typedef ss_size_t size_type;
00250 typedef char_type const const_char_type;
00251 typedef value_type const* string_type;
00252 typedef value_type* pointer;
00253 typedef value_type const* const_pointer;
00254 enum { is_pointer = true };
00255 enum { is_pointer_to_const = false };
00256 enum { char_type_size = int(sizeof(char_type)) };
00257
00258 static string_type empty_string()
00259 {
00260
00261
00262
00263 static char_type s_empty[1];
00264
00265 STLSOFT_ASSERT(s_empty[0] == '\0');
00266
00267 return s_empty;
00268 }
00269 };
00270
00271
00272 # ifndef _STLSOFT_STRING_TRAITS_NO_STD_STRING
00273 # ifdef STLSOFT_CF_TEMPLATE_PARTIAL_SPECIALISATION_SUPPORT
00274 template <ss_typename_param_k C>
00275 struct string_traits<stlsoft_ns_qual_std(basic_string)<C> >
00276 {
00277
00278
00279 typedef stlsoft_ns_qual_std(basic_string)<C> string_type_;
00280 typedef ss_typename_type_k string_type_::value_type char_type;
00281 typedef ss_typename_type_k string_type_::size_type size_type;
00282 typedef char_type const const_char_type;
00283 typedef string_type_ string_type;
00284 typedef string_type_ value_type;
00285 typedef ss_typename_type_k string_type::pointer pointer;
00286 typedef ss_typename_type_k string_type::const_pointer const_pointer;
00287 typedef ss_typename_type_k string_type::iterator iterator;
00288 typedef ss_typename_type_k string_type::const_iterator const_iterator;
00289 typedef ss_typename_type_k string_type::reverse_iterator reverse_iterator;
00290 typedef ss_typename_type_k string_type::const_reverse_iterator const_reverse_iterator;
00291 enum { is_pointer = false };
00292 enum { is_pointer_to_const = false };
00293 enum { char_type_size = sizeof(char_type) };
00294
00295 static string_type empty_string()
00296 {
00297 return string_type();
00298 }
00299 static string_type construct(string_type const& src, size_type pos, size_type len)
00300 {
00301 return string_type(src, pos, len);
00302 }
00303 # ifdef STLSOFT_CF_MEMBER_TEMPLATE_FUNCTION_SUPPORT
00304 template <ss_typename_param_k I>
00305 static string_type &assign_inplace(string_type& str, I first, I last)
00306 # else
00307 static string_type &assign_inplace(string_type& str, const_iterator first, const_iterator last)
00308 # endif
00309 {
00310
00311 return (str = string_type(first, last), str);
00312 }
00313 };
00314 # else
00315 # if defined(STLSOFT_CF_std_NAMESPACE)
00316 STLSOFT_TEMPLATE_SPECIALISATION
00317 struct string_traits<stlsoft_ns_qual_std(basic_string)<ss_char_a_t> >
00318 {
00319 typedef stlsoft_ns_qual_std(basic_string)<ss_char_a_t> value_type;
00320 typedef value_type::value_type char_type;
00321 typedef value_type::size_type size_type;
00322 typedef char_type const const_char_type;
00323 typedef value_type string_type;
00324 typedef string_type::pointer pointer;
00325 typedef string_type::const_pointer const_pointer;
00326 typedef string_type::iterator iterator;
00327 typedef string_type::const_iterator const_iterator;
00328 typedef string_type::reverse_iterator reverse_iterator;
00329 typedef string_type::const_reverse_iterator const_reverse_iterator;
00330 enum { is_pointer = false };
00331 enum { is_pointer_to_const = false };
00332 enum { char_type_size = sizeof(char_type) };
00333
00334 static string_type empty_string()
00335 {
00336 return string_type();
00337 }
00338 static string_type construct(string_type const& src, size_type pos, size_type len)
00339 {
00340 return string_type(src, pos, len);
00341 }
00342 # ifdef STLSOFT_CF_MEMBER_TEMPLATE_FUNCTION_SUPPORT
00343 template <ss_typename_param_k I>
00344 static string_type &assign_inplace(string_type& str, I first, I last)
00345 # else
00346 static string_type &assign_inplace(string_type& str, const_iterator first, const_iterator last)
00347 # endif
00348 {
00349
00350 return (str = string_type(first, last), str);
00351 }
00352 };
00353
00354 STLSOFT_TEMPLATE_SPECIALISATION
00355 struct string_traits<stlsoft_ns_qual_std(basic_string)<ss_char_w_t> >
00356 {
00357 typedef stlsoft_ns_qual_std(basic_string)<ss_char_w_t> value_type;
00358 typedef value_type::value_type char_type;
00359 typedef value_type::size_type size_type;
00360 typedef char_type const const_char_type;
00361 typedef value_type string_type;
00362 typedef string_type::pointer pointer;
00363 typedef string_type::const_pointer const_pointer;
00364 typedef string_type::iterator iterator;
00365 typedef string_type::const_iterator const_iterator;
00366 typedef string_type::reverse_iterator reverse_iterator;
00367 typedef string_type::const_reverse_iterator const_reverse_iterator;
00368 enum { is_pointer = false };
00369 enum { is_pointer_to_const = false };
00370 enum { char_type_size = sizeof(char_type) };
00371
00372 static string_type empty_string()
00373 {
00374 return string_type();
00375 }
00376 static string_type construct(string_type const& src, size_type pos, size_type len)
00377 {
00378 return string_type(src, pos, len);
00379 }
00380 # ifdef STLSOFT_CF_MEMBER_TEMPLATE_FUNCTION_SUPPORT
00381 template <ss_typename_param_k I>
00382 static string_type &assign_inplace(string_type& str, I first, I last)
00383 # else
00384 static string_type &assign_inplace(string_type& str, const_iterator first, const_iterator last)
00385 # endif
00386 {
00387
00388 return (str = string_type(first, last), str);
00389 }
00390 };
00391 # endif
00392 # endif
00393 # endif
00394
00395 #endif
00396
00398
00399
00400 #ifdef STLSOFT_UNITTEST
00401 # include "./unittest/string_traits_unittest_.h"
00402 #endif
00403
00404
00405
00406 #ifndef _STLSOFT_NO_NAMESPACE
00407 }
00408 #endif
00409
00410
00411
00412 #endif
00413
00414