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
00041
00042
00043
00044
00052 #ifndef STLSOFT_INCL_STLSOFT_SHIMS_ACCESS_STRING_STD_HPP_BASIC_STRING
00053 #define STLSOFT_INCL_STLSOFT_SHIMS_ACCESS_STRING_STD_HPP_BASIC_STRING
00054
00055 #ifndef STLSOFT_DOCUMENTATION_SKIP_SECTION
00056 # define STLSOFT_VER_STLSOFT_SHIMS_ACCESS_STRING_STD_HPP_BASIC_STRING_MAJOR 4
00057 # define STLSOFT_VER_STLSOFT_SHIMS_ACCESS_STRING_STD_HPP_BASIC_STRING_MINOR 0
00058 # define STLSOFT_VER_STLSOFT_SHIMS_ACCESS_STRING_STD_HPP_BASIC_STRING_REVISION 3
00059 # define STLSOFT_VER_STLSOFT_SHIMS_ACCESS_STRING_STD_HPP_BASIC_STRING_EDIT 92
00060 #endif
00061
00062
00063
00064
00065
00066 #ifndef STLSOFT_INCL_STLSOFT_H_STLSOFT
00067 # include <stlsoft/stlsoft.h>
00068 #endif
00069 #ifndef STLSOFT_INCL_STLSOFT_SHIMS_ACCESS_STRING_H_FWD
00070 # include <stlsoft/shims/access/string/fwd.h>
00071 #endif
00072 #ifndef STLSOFT_INCL_STLSOFT_SHIMS_ACCESS_STRING_STD_H_C_STRING
00073 # include <stlsoft/shims/access/string/std/c_string.h>
00074 #endif
00075
00076 #ifdef STLSOFT_CF_STRING_ACCESS_USE_std_char_traits
00077 # undef STLSOFT_CF_STRING_ACCESS_USE_std_char_traits
00078 #endif
00079
00080
00081 #ifdef STLSOFT_COMPILER_IS_WATCOM
00082 # define STLSOFT_STRING_ACCESS_NO_STD_STRING
00083 #endif
00084
00085
00086
00087
00088
00089
00090
00091
00092
00093
00094
00095
00096
00097
00098
00099
00100
00101
00102 #ifdef _STLSOFT_STRING_ACCESS_NO_STD_STRING
00103 # define STLSOFT_STRING_ACCESS_NO_STD_STRING
00104 #endif
00105
00106 #if defined(STLSOFT_STRING_ACCESS_NO_STD_STRING)
00107 # undef STLSOFT_CF_STRING_ACCESS_USE_std_char_traits
00108 #elif defined(_STLSOFT_NO_NAMESPACE)
00109 # undef STLSOFT_CF_STRING_ACCESS_USE_std_char_traits
00110 #elif !defined(STLSOFT_CF_std_char_traits_AVAILABLE)
00111 # undef STLSOFT_CF_STRING_ACCESS_USE_std_char_traits
00112 #else
00113 # define STLSOFT_CF_STRING_ACCESS_USE_std_char_traits
00114 #endif
00115
00116
00117 #ifndef STLSOFT_STRING_ACCESS_NO_STD_STRING
00118 # include <string>
00119 #endif
00120
00121
00122
00123
00124 #if !defined(STLSOFT_CF_STRING_ACCESS_USE_std_char_traits)
00125 # ifndef STLSOFT_INCL_STLSOFT_STRING_HPP_CHAR_TRAITS
00126 # include <stlsoft/string/char_traits.hpp>
00127 # endif
00128 #endif
00129
00130 #if defined(STLSOFT_COMPILER_IS_GCC)
00131 # include <wchar.h>
00132 #endif
00133
00134 #ifdef STLSOFT_UNITTEST
00135 # include <stdio.h>
00136 #endif
00137
00138
00139
00140
00141
00142
00143
00144
00145
00146
00147
00148
00149
00150
00151
00152
00153
00154
00155
00156 #ifndef _STLSOFT_NO_NAMESPACE
00157 namespace stlsoft
00158 {
00159 #endif
00160
00161
00162
00163
00164
00165 #ifndef STLSOFT_DOCUMENTATION_SKIP_SECTION
00166
00167 #ifndef STLSOFT_STRING_ACCESS_NO_STD_STRING
00168 # if defined(STLSOFT_COMPILER_IS_GCC) && \
00169 ( __GNUC__ < 3 || \
00170 !defined(_GLIBCPP_USE_WCHAR_T)) // Thanks to Robert Kreger for suggesting this fix for GCC 3.3.3 on HP UX
00171 typedef stlsoft_ns_qual_std(basic_string)<ss_char_w_t> stlsoft_wstring_t_;
00172 # else
00173 typedef stlsoft_ns_qual_std(wstring) stlsoft_wstring_t_;
00174 # endif
00175 #endif
00176
00177 #endif
00178
00179
00180
00181
00182
00183
00184
00185
00186
00187 #ifndef STLSOFT_STRING_ACCESS_NO_STD_STRING
00188 # if defined(STLSOFT_COMPILER_IS_MSVC) && \
00189 _MSC_VER < 1100
00190
00191
00192
00193
00194 inline ss_char_a_t const* c_str_data_a(string const& s)
00195 {
00196 return s.data();
00197 }
00198
00199 inline ss_char_a_t const* c_str_data(string const& s)
00200 {
00201 return c_str_data_a(s);
00202 }
00203
00204 inline ss_char_w_t const* c_str_data_w(wstring const& s)
00205 {
00206 return s.data();
00207 }
00208
00209 inline ss_char_w_t const* c_str_data(wstring const& s)
00210 {
00211 return c_str_data_w(s);
00212 }
00213
00214 # else
00215
00216
00217
00226 inline ss_char_a_t const* c_str_data_a(stlsoft_ns_qual_std(string) const& s)
00227 {
00228 return s.data();
00229 }
00230
00231 # if !defined(STLSOFT_COMPILER_IS_GCC) || \
00232 !(__GNUC__ < 3)
00233
00241 inline ss_char_w_t const* c_str_data_w(stlsoft_wstring_t_ const& s)
00242 {
00243 return s.data();
00244 }
00245 # endif
00246
00256 template< ss_typename_param_k T
00257 , ss_typename_param_k A
00258 >
00259 inline ss_char_a_t const* c_str_data_a(stlsoft_ns_qual_std(basic_string)<ss_char_a_t, T, A> const& s)
00260 {
00261 return s.data();
00262 }
00263
00273 template< ss_typename_param_k T
00274 , ss_typename_param_k A
00275 >
00276 inline ss_char_w_t const* c_str_data_w(stlsoft_ns_qual_std(basic_string)<ss_char_w_t, T, A> const& s)
00277 {
00278 return s.data();
00279 }
00280
00288 template< ss_typename_param_k C
00289 , ss_typename_param_k T
00290 , ss_typename_param_k A
00291 >
00292 inline C const* c_str_data(stlsoft_ns_qual_std(basic_string)<C, T, A> const& s)
00293 {
00294 return s.data();
00295 }
00296 # endif
00297 #endif
00298
00299
00300 #if defined(_STLP_USE_NAMESPACES) && \
00301 defined(_STLP_USE_OWN_NAMESPACE) && \
00302 !defined(_STLP_REDEFINE_STD) && \
00303 ( !defined(_STLPORT_MAJOR) || \
00304 _STLPORT_MAJOR < 5)
00305
00306 inline ss_char_a_t const* c_str_data_a(stlport::string const& s)
00307 {
00308 return s.data();
00309 }
00310
00311 inline ss_char_w_t const* c_str_data_w(stlport::wstring const& s)
00312 {
00313 return s.data();
00314 }
00315
00316 template <ss_typename_param_k C>
00317 inline C const* c_str_data(stlport::basic_string<C> const& s)
00318 {
00319 return s.data();
00320 }
00321
00322 #endif
00323
00324 #if 0
00325
00332 template <ss_typename_param_k S>
00333 inline ss_char_a_t const* c_str_data_a(S const& s)
00334 {
00335 return stlsoft_ns_qual(c_str_data_a)(static_cast<ss_char_a_t const*>(stlsoft_ns_qual(c_str_ptr_a)(s))));
00336 }
00344 template <ss_typename_param_k S>
00345 inline ss_char_w_t const* c_str_data_w(S const& s)
00346 {
00347 return stlsoft_ns_qual(c_str_data_w)(static_cast<ss_char_w_t const*>(stlsoft_ns_qual(c_str_ptr_w)(s))));
00348 }
00349 #endif
00350
00351
00352
00353
00354
00355
00356
00357
00358
00359 #ifndef STLSOFT_STRING_ACCESS_NO_STD_STRING
00360 # if defined(STLSOFT_COMPILER_IS_MSVC) && \
00361 _MSC_VER < 1100
00362
00363 inline ss_size_t c_str_len_a(string const& s)
00364 {
00365 return s.length();
00366 }
00367
00368 inline ss_size_t c_str_len(string const& s)
00369 {
00370 return c_str_len_a(s);
00371 }
00372
00373 inline ss_size_t c_str_len_w(wstring const& s)
00374 {
00375 return s.length();
00376 }
00377
00378 inline ss_size_t c_str_len(wstring const& s)
00379 {
00380 return c_str_len_w(s);
00381 }
00382
00383 # else
00384
00392 inline ss_size_t c_str_len_a(stlsoft_ns_qual_std(string) const& s)
00393 {
00394 return s.length();
00395 }
00396
00397 # if !defined(STLSOFT_COMPILER_IS_GCC) || \
00398 !(__GNUC__ < 3)
00399
00406 inline ss_size_t c_str_len_w(stlsoft_wstring_t_ const& s)
00407 {
00408 return s.length();
00409 }
00410 # endif
00411
00420 template< ss_typename_param_k T
00421 , ss_typename_param_k A
00422 >
00423 inline ss_size_t c_str_len_a(stlsoft_ns_qual_std(basic_string)<ss_char_a_t, T, A> const& s)
00424 {
00425 return s.length();
00426 }
00427
00436 template< ss_typename_param_k T
00437 , ss_typename_param_k A
00438 >
00439 inline ss_size_t c_str_len_w(stlsoft_ns_qual_std(basic_string)<ss_char_w_t, T, A> const& s)
00440 {
00441 return s.length();
00442 }
00443
00451 template< ss_typename_param_k C
00452 , ss_typename_param_k T
00453 , ss_typename_param_k A
00454 >
00455 inline ss_size_t c_str_len(stlsoft_ns_qual_std(basic_string)<C, T, A> const& s)
00456 {
00457 return s.length();
00458 }
00459 # endif
00460 #endif
00461
00462
00463 #if defined(_STLP_USE_NAMESPACES) && \
00464 defined(_STLP_USE_OWN_NAMESPACE) && \
00465 !defined(_STLP_REDEFINE_STD) && \
00466 ( !defined(_STLPORT_MAJOR) || \
00467 _STLPORT_MAJOR < 5)
00468
00469 inline ss_size_t c_str_len_a(stlport::string const& s)
00470 {
00471 return s.length();
00472 }
00473
00474 inline ss_size_t c_str_len_w(stlport::wstring const& s)
00475 {
00476 return s.length();
00477 }
00478
00479 template <ss_typename_param_k C>
00480 inline ss_size_t c_str_len(stlport::basic_string<C> const& s)
00481 {
00482 return s.length();
00483 }
00484
00485 #endif
00486
00487
00488
00489
00490
00491
00492
00493
00494
00495 #ifndef STLSOFT_STRING_ACCESS_NO_STD_STRING
00496 # if defined(STLSOFT_COMPILER_IS_MSVC) && \
00497 _MSC_VER < 1100
00498
00499 inline ss_char_a_t const* c_str_ptr_a(string const& s)
00500 {
00501 return s.c_str();
00502 }
00503
00504 inline ss_char_a_t const* c_str_ptr(string const& s)
00505 {
00506 return c_str_ptr_a(s);
00507 }
00508
00509 inline ss_char_w_t const* c_str_ptr_w(wstring const& s)
00510 {
00511 return s.c_str();
00512 }
00513
00514 inline ss_char_w_t const* c_str_ptr(wstring const& s)
00515 {
00516 return c_str_ptr_w(s);
00517 }
00518
00519 # else
00520
00528 inline ss_char_a_t const* c_str_ptr_a(stlsoft_ns_qual_std(string) const& s)
00529 {
00530 return s.c_str();
00531 }
00532
00533 # if !defined(STLSOFT_COMPILER_IS_GCC) || \
00534 !(__GNUC__ < 3)
00535
00543 inline ss_char_w_t const* c_str_ptr_w(stlsoft_wstring_t_ const& s)
00544 {
00545 return s.c_str();
00546 }
00547 # endif
00548
00558 template< ss_typename_param_k T
00559 , ss_typename_param_k A
00560 >
00561 inline ss_char_a_t const* c_str_ptr_a(stlsoft_ns_qual_std(basic_string)<ss_char_a_t, T, A> const& s)
00562 {
00563 return s.c_str();
00564 }
00565
00575 template< ss_typename_param_k T
00576 , ss_typename_param_k A
00577 >
00578 inline ss_char_w_t const* c_str_ptr_w(stlsoft_ns_qual_std(basic_string)<ss_char_w_t, T, A> const& s)
00579 {
00580 return s.c_str();
00581 }
00582
00591 template< ss_typename_param_k C
00592 , ss_typename_param_k T
00593 , ss_typename_param_k A
00594 >
00595 inline C const* c_str_ptr(stlsoft_ns_qual_std(basic_string)<C, T, A> const& s)
00596 {
00597 return s.c_str();
00598 }
00599 # endif
00600 #endif
00601
00602
00603 #if defined(_STLP_USE_NAMESPACES) && \
00604 defined(_STLP_USE_OWN_NAMESPACE) && \
00605 !defined(_STLP_REDEFINE_STD) && \
00606 ( !defined(_STLPORT_MAJOR) || \
00607 _STLPORT_MAJOR < 5)
00608
00609 inline ss_char_a_t const* c_str_ptr_a(stlport::string const& s)
00610 {
00611 return s.c_str();
00612 }
00613
00614 inline ss_char_w_t const* c_str_ptr_w(stlport::wstring const& s)
00615 {
00616 return s.c_str();
00617 }
00618
00619 template <ss_typename_param_k C>
00620 inline C const* c_str_ptr(stlport::basic_string<C> const& s)
00621 {
00622 return s.c_str();
00623 }
00624
00625 #endif
00626
00627
00628
00629
00630
00631
00632
00633
00634
00635 #ifndef STLSOFT_STRING_ACCESS_NO_STD_STRING
00636 # if defined(STLSOFT_COMPILER_IS_MSVC) && \
00637 _MSC_VER < 1100
00638
00639 inline ss_char_a_t const* c_str_ptr_null_a(string const& s)
00640 {
00641 return (0 == s.length()) ? 0 : s.c_str();
00642 }
00643
00644 inline ss_char_a_t const* c_str_ptr_null(string const& s)
00645 {
00646 return c_str_ptr_null_a(s);
00647 }
00648
00649 inline ss_char_w_t const* c_str_ptr_null_w(wstring const& s)
00650 {
00651 return (0 == s.length()) ? 0 : s.c_str();
00652 }
00653
00654 inline ss_char_w_t const* c_str_ptr_null(wstring const& s)
00655 {
00656 return c_str_ptr_null_w(s);
00657 }
00658
00659 # else
00660
00668 inline ss_char_a_t const* c_str_ptr_null_a(stlsoft_ns_qual_std(string) const& s)
00669 {
00670 return (0 == s.length()) ? 0 : s.c_str();
00671 }
00672
00673 # if !defined(STLSOFT_COMPILER_IS_GCC) || \
00674 !(__GNUC__ < 3)
00675
00683 inline ss_char_w_t const* c_str_ptr_null_w(stlsoft_wstring_t_ const& s)
00684 {
00685 return (0 == s.length()) ? 0 : s.c_str();
00686 }
00687 # endif
00688
00698 template< ss_typename_param_k T
00699 , ss_typename_param_k A
00700 >
00701 inline ss_char_a_t const* c_str_ptr_null_a(stlsoft_ns_qual_std(basic_string)<ss_char_a_t, T, A> const& s)
00702 {
00703 return (0 == s.length()) ? 0 : s.c_str();
00704 }
00705
00715 template< ss_typename_param_k T
00716 , ss_typename_param_k A
00717 >
00718 inline ss_char_w_t const* c_str_ptr_null_w(stlsoft_ns_qual_std(basic_string)<ss_char_w_t, T, A> const& s)
00719 {
00720 return (0 == s.length()) ? 0 : s.c_str();
00721 }
00722
00731 template< ss_typename_param_k C
00732 , ss_typename_param_k T
00733 , ss_typename_param_k A
00734 >
00735 inline C const* c_str_ptr_null(stlsoft_ns_qual_std(basic_string)<C, T, A> const& s)
00736 {
00737 return (0 == s.length()) ? 0 : s.c_str();
00738 }
00739
00740 # endif
00741 #endif
00742
00743
00744 #if defined(_STLP_USE_NAMESPACES) && \
00745 defined(_STLP_USE_OWN_NAMESPACE) && \
00746 !defined(_STLP_REDEFINE_STD) && \
00747 ( !defined(_STLPORT_MAJOR) || \
00748 _STLPORT_MAJOR < 5)
00749
00750 inline ss_char_a_t const* c_str_ptr_null_a(stlport::string const& s)
00751 {
00752 return (0 == s.length()) ? 0 : s.c_str();
00753 }
00754
00755 inline ss_char_w_t const* c_str_ptr_null_w(stlport::wstring const& s)
00756 {
00757 return (0 == s.length()) ? 0 : s.c_str();
00758 }
00759
00760 template <ss_typename_param_k C>
00761 inline C const* c_str_ptr_null(stlport::basic_string<C> const& s)
00762 {
00763 return (0 == s.length()) ? 0 : s.c_str();
00764 }
00765
00766 #endif
00767
00768 #if 0
00769
00775 template <ss_typename_param_k S>
00776 inline ss_char_a_t const* c_str_ptr_null_a(S const& s)
00777 {
00778 return stlsoft_ns_qual(c_str_ptr_null_a)(static_cast<ss_char_a_t const*>(stlsoft_ns_qual(c_str_ptr_a)(s))));
00779 }
00786 template <ss_typename_param_k S>
00787 inline ss_char_w_t const* c_str_ptr_null_w(S const& s)
00788 {
00789 return stlsoft_ns_qual(c_str_ptr_null_w)(static_cast<ss_char_w_t const*>(stlsoft_ns_qual(c_str_ptr_w)(s))));
00790 }
00791 #endif
00792
00794
00795
00796 #ifdef STLSOFT_UNITTEST
00797 # include "./unittest/basic_string_unittest_.h"
00798 #endif
00799
00800
00801
00802 #ifndef _STLSOFT_NO_NAMESPACE
00803 }
00804 #endif
00805
00806
00807
00808 #endif
00809
00810