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
00049 #ifndef COMSTL_INCL_COMSTL_STRING_HPP_BSTR
00050 #define COMSTL_INCL_COMSTL_STRING_HPP_BSTR
00051
00052 #ifndef STLSOFT_DOCUMENTATION_SKIP_SECTION
00053 # define _COMSTL_VER_COMSTL_STRING_HPP_BSTR_MAJOR 2
00054 # define _COMSTL_VER_COMSTL_STRING_HPP_BSTR_MINOR 8
00055 # define _COMSTL_VER_COMSTL_STRING_HPP_BSTR_REVISION 3
00056 # define _COMSTL_VER_COMSTL_STRING_HPP_BSTR_EDIT 61
00057 #endif
00058
00059
00060
00061
00062
00063 #ifndef COMSTL_INCL_COMSTL_H_COMSTL
00064 # include <comstl/comstl.h>
00065 #endif
00066
00067
00068
00069 #ifdef STLSOFT_CF_EXCEPTION_SUPPORT
00070 # ifndef COMSTL_INCL_COMSTL_ERROR_HPP_EXCEPTIONS
00071 # include <comstl/error/exceptions.hpp>
00072 # endif
00073 #endif
00074 #ifndef COMSTL_INCL_COMSTL_STRING_H_BSTR_FUNCTIONS
00075 # include <comstl/string/BSTR_functions.h>
00076 #endif
00077 #ifndef STLSOFT_INCL_STLSOFT_SHIMS_ACCESS_HPP_STRING
00078 # include <stlsoft/shims/access/string.hpp>
00079 #endif
00080 #ifndef STLSOFT_INCL_STLSOFT_STRING_HPP_STRING_TRAITS_FWD
00081 # include <stlsoft/string/string_traits_fwd.hpp>
00082 #endif
00083 #ifndef STLSOFT_INCL_STLSOFT_UTIL_STD_HPP_ITERATOR_HELPER
00084 # include <stlsoft/util/std/iterator_helper.hpp>
00085 #endif
00086 #ifndef STLSOFT_INCL_STLSOFT_UTIL_HPP_STD_SWAP
00087 # include <stlsoft/util/std_swap.hpp>
00088 #endif
00089 #ifndef STLSOFT_INCL_STLSOFT_INTERNAL_H_SAFESTR
00090 # include <stlsoft/internal/safestr.h>
00091 #endif
00092
00093 #ifdef STLSOFT_CF_EXCEPTION_SUPPORT
00094 # include <stdexcept>
00095 #endif
00096
00097
00098
00099
00100
00101 #ifndef _COMSTL_NO_NAMESPACE
00102 # if defined(_STLSOFT_NO_NAMESPACE) || \
00103 defined(STLSOFT_DOCUMENTATION_SKIP_SECTION)
00104
00105 namespace comstl
00106 {
00107 # else
00108
00109
00110 namespace stlsoft
00111 {
00112
00113 namespace comstl_project
00114 {
00115
00116 # endif
00117 #endif
00118
00119
00120
00121
00122
00127 class bstr
00128 {
00131 public:
00132 typedef bstr class_type;
00133 typedef cs_char_o_t char_type;
00134 typedef char_type value_type;
00135 typedef char_type* pointer;
00136 typedef char_type const* const_pointer;
00137 typedef char_type& reference;
00138 typedef char_type const& const_reference;
00139 typedef cs_ptrdiff_t difference_type;
00140 typedef cs_size_t size_type;
00141 typedef cs_ptrdiff_t ssize_type;
00142 typedef cs_bool_t bool_type;
00143 typedef pointer iterator;
00144 typedef const_pointer const_iterator;
00145 #if defined(STLSOFT_LF_BIDIRECTIONAL_ITERATOR_SUPPORT)
00146 typedef stlsoft_ns_qual(reverse_iterator_base)<
00147 iterator
00148 , value_type
00149 , reference
00150 , pointer
00151 , difference_type
00152 > reverse_iterator;
00153
00154 typedef stlsoft_ns_qual(const_reverse_iterator_base)<
00155 const_iterator
00156 , value_type const
00157 , const_reference
00158 , const_pointer
00159 , difference_type
00160 > const_reverse_iterator;
00161 #endif
00162
00163 typedef BSTR resource_type;
00165
00168 public:
00169 bstr();
00170 ss_explicit_k bstr(cs_char_a_t const* s, ssize_type len = -1);
00171 ss_explicit_k bstr(cs_char_w_t const* s, ssize_type len = -1);
00172 bstr(size_type n, char_type ch);
00174 bstr(class_type const& rhs);
00175 bstr(class_type const& rhs, size_type pos, size_type len);
00176 ~bstr() stlsoft_throw_0();
00177
00179 class_type& operator =(class_type const& rhs);
00180
00181 class_type& assign(cs_char_a_t const* s, ssize_type len = -1);
00182 class_type& assign(cs_char_w_t const* s, ssize_type len = -1);
00183
00184 class_type& assign(const_iterator from, const_iterator to);
00185
00186 class_type& operator =(cs_char_a_t const* s);
00187 class_type& operator =(cs_char_w_t const* s);
00188
00189 class_type& attach(BSTR bstr);
00190
00191 BSTR detach();
00192
00193 void clear();
00195
00198 public:
00199 class_type& append(class_type const& s, ssize_type len = -1);
00200 class_type& append(cs_char_w_t const* s, ssize_type len = -1);
00201
00202 class_type& operator +=(class_type const& s);
00203 class_type& operator +=(cs_char_w_t const* s);
00205
00208 public:
00209 const_pointer data() const;
00210 const_pointer c_str() const;
00211 size_type length() const;
00212 size_type size() const;
00213 bool_type empty() const;
00214 BSTR get() const;
00215 reference operator [](size_type);
00216 const_reference operator [](size_type) const;
00217
00218 const_pointer *NonDestructiveAddress() const;
00219 BSTR *NonDestructiveAddress();
00220 BSTR *DestructiveAddress();
00222
00225 public:
00229 iterator begin();
00233 iterator end();
00237 const_iterator begin() const;
00241 const_iterator end() const;
00242
00243 #if defined(STLSOFT_LF_BIDIRECTIONAL_ITERATOR_SUPPORT)
00247 const_reverse_iterator rbegin() const;
00251 const_reverse_iterator rend() const;
00255 reverse_iterator rbegin();
00259 reverse_iterator rend();
00260 #endif
00262
00265 public:
00267 bool_type equal(class_type const& rhs) const;
00269 bool_type equal(BSTR const& rhs) const;
00271
00274 public:
00276 void swap(class_type& rhs) stlsoft_throw_0();
00278 void swap(BSTR& rhs) stlsoft_throw_0();
00280
00283 private:
00284 BSTR m_bstr;
00286 };
00287
00288
00289
00290
00291
00296 inline bstr::const_pointer c_str_data(comstl_ns_qual(bstr) const& b)
00297 {
00298 return b.data();
00299 }
00300
00301 #ifndef STLSOFT_DOCUMENTATION_SKIP_SECTION
00302
00303 inline bstr::const_pointer c_str_data_w(comstl_ns_qual(bstr) const& b)
00304 {
00305 return b.data();
00306 }
00307
00308 inline bstr::const_pointer c_str_data_o(comstl_ns_qual(bstr) const& b)
00309 {
00310 return b.data();
00311 }
00312
00313 #endif
00314
00319 inline cs_size_t c_str_len(comstl_ns_qual(bstr) const& b)
00320 {
00321 return b.length();
00322 }
00323
00324 #ifndef STLSOFT_DOCUMENTATION_SKIP_SECTION
00325
00326 inline cs_size_t c_str_len_w(comstl_ns_qual(bstr) const& b)
00327 {
00328 return b.length();
00329 }
00330
00331 inline cs_size_t c_str_len_o(comstl_ns_qual(bstr) const& b)
00332 {
00333 return b.length();
00334 }
00335
00336 #endif
00337
00342 inline bstr::const_pointer c_str_ptr(comstl_ns_qual(bstr) const& b)
00343 {
00344 return b.c_str();
00345 }
00346
00347 #ifndef STLSOFT_DOCUMENTATION_SKIP_SECTION
00348
00349 inline bstr::const_pointer c_str_ptr_w(comstl_ns_qual(bstr) const& b)
00350 {
00351 return b.c_str();
00352 }
00353
00354 inline bstr::const_pointer c_str_ptr_o(comstl_ns_qual(bstr) const& b)
00355 {
00356 return b.c_str();
00357 }
00358
00359 #endif
00360
00365 inline bstr::const_pointer c_str_ptr_null(comstl_ns_qual(bstr) const& b)
00366 {
00367 return stlsoft_ns_qual(c_str_ptr_null)(b.c_str());
00368 }
00369
00370 #ifndef STLSOFT_DOCUMENTATION_SKIP_SECTION
00371
00372 inline bstr::const_pointer c_str_ptr_null_w(comstl_ns_qual(bstr) const& b)
00373 {
00374 return stlsoft_ns_qual(c_str_ptr_null_w)(b.c_str());
00375 }
00376
00377 inline bstr::const_pointer c_str_ptr_null_o(comstl_ns_qual(bstr) const& b)
00378 {
00379 return stlsoft_ns_qual(c_str_ptr_null)(b.c_str());
00380 }
00381
00386 template< ss_typename_param_k S
00387 >
00388 inline S& operator <<(S& stm, comstl_ns_qual(bstr) const& str)
00389 {
00390 STLSOFT_STATIC_ASSERT(sizeof(OLECHAR) == sizeof(ss_typename_type_k S::char_type));
00391
00392 stm << str.c_str();
00393
00394 return stm;
00395 }
00396
00397 #endif
00398
00399
00400
00401
00402
00403 inline cs_bool_t operator ==(bstr const& lhs, bstr const& rhs)
00404 {
00405 return lhs.equal(rhs);
00406 }
00407
00408 inline cs_bool_t operator !=(bstr const& lhs, bstr const& rhs)
00409 {
00410 return !operator ==(lhs, rhs);
00411 }
00412
00413 inline cs_bool_t operator ==(bstr const& lhs, BSTR const& rhs)
00414 {
00415 return lhs.equal(rhs);
00416 }
00417
00418 inline cs_bool_t operator !=(bstr const& lhs, BSTR const& rhs)
00419 {
00420 return !operator ==(lhs, rhs);
00421 }
00422
00423 inline cs_bool_t operator ==(BSTR const& lhs, bstr const& rhs)
00424 {
00425 return rhs.equal(lhs);
00426 }
00427
00428 inline cs_bool_t operator !=(BSTR const& lhs, bstr const& rhs)
00429 {
00430 return !operator ==(lhs, rhs);
00431 }
00432
00434
00435
00436 #ifdef STLSOFT_UNITTEST
00437 # include "./unittest/bstr_unittest_.h"
00438 #endif
00439
00440
00441
00442
00443
00444 #ifndef STLSOFT_DOCUMENTATION_SKIP_SECTION
00445
00446
00447 inline bstr::bstr()
00448 : m_bstr(NULL)
00449 {}
00450
00451 inline bstr::bstr(cs_char_a_t const* s, ssize_type len )
00452 {
00453
00454 COMSTL_MESSAGE_ASSERT("Default length must be specified by -1. No other -ve value allowed", (len >= 0 || len == -1));
00455 COMSTL_MESSAGE_ASSERT("Cannot pass in NULL pointer and -1 (default) length", (NULL != s || len >= 0));
00456
00457
00458
00459
00460
00461
00462
00463 ssize_type actualLen = static_cast<ssize_type>(stlsoft_ns_qual(c_str_len)(s));
00464
00465 if( NULL != s &&
00466 len > actualLen)
00467 {
00468 m_bstr = bstr_create(static_cast<cs_char_w_t const*>(NULL), static_cast<cs_size_t>(len));
00469
00470 if(NULL != m_bstr)
00471 {
00472 # ifdef _WIN64
00473 int buffLen = static_cast<int>(actualLen + 1);
00474 # else
00475 int buffLen = actualLen + 1;
00476 # endif
00477
00478 ::MultiByteToWideChar(0, 0, s, buffLen, m_bstr, buffLen);
00479 }
00480 }
00481 else
00482 {
00483 if(-1 == len)
00484 {
00485 len = actualLen;
00486 }
00487
00488 m_bstr = bstr_create(s, static_cast<cs_size_t>(len));
00489 }
00490
00491 #ifdef STLSOFT_CF_EXCEPTION_SUPPORT
00492 if( NULL == m_bstr &&
00493 NULL != s &&
00494 0 != len &&
00495 '\0' != 0[s])
00496 {
00497 STLSOFT_THROW_X(com_exception("failed to allocate string", HRESULT_FROM_WIN32(::GetLastError())));
00498 }
00499 #endif
00500 }
00501
00502 inline bstr::bstr(cs_char_w_t const* s, ssize_type len )
00503 {
00504
00505 COMSTL_MESSAGE_ASSERT("Default length must be specified by -1. No other -ve value allowed", (len >= 0 || len == -1));
00506 COMSTL_MESSAGE_ASSERT("Cannot pass in NULL pointer and -1 (default) length", (NULL != s || len >= 0));
00507
00508
00509
00510
00511
00512
00513
00514 ssize_type actualLen = static_cast<ssize_type>(stlsoft_ns_qual(c_str_len)(s));
00515
00516 if( NULL != s &&
00517 len > actualLen)
00518 {
00519 m_bstr = bstr_create(static_cast<cs_char_w_t const*>(NULL), static_cast<cs_size_t>(len));
00520
00521 if(NULL != m_bstr)
00522 {
00523 #ifdef STLSOFT_USING_SAFE_STR_FUNCTIONS
00524 ::wcscpy_s(m_bstr, static_cast<cs_size_t>(actualLen), s);
00525 #else
00526 ::wcscpy(m_bstr, s);
00527 #endif
00528 }
00529 }
00530 else
00531 {
00532 if(-1 == len)
00533 {
00534 len = actualLen;
00535 }
00536
00537 m_bstr = bstr_create(s, static_cast<cs_size_t>(len));
00538 }
00539
00540 #ifdef STLSOFT_CF_EXCEPTION_SUPPORT
00541 if( NULL == m_bstr &&
00542 NULL != s &&
00543 0 != len &&
00544 '\0' != 0[s])
00545 {
00546 STLSOFT_THROW_X(com_exception("failed to allocate string", HRESULT_FROM_WIN32(::GetLastError())));
00547 }
00548 #endif
00549 }
00550
00551 inline bstr::bstr(bstr::size_type n, bstr::char_type ch)
00552 : m_bstr(bstr_create_w(NULL, n))
00553 {
00554 if(NULL == m_bstr)
00555 {
00556 if(0 != n)
00557 {
00558 #ifdef STLSOFT_CF_EXCEPTION_SUPPORT
00559 STLSOFT_THROW_X(com_exception("failed to allocate string", HRESULT_FROM_WIN32(::GetLastError())));
00560 #endif
00561 }
00562 }
00563 else
00564 {
00565 { for(size_type i = 0; i < n; ++i)
00566 {
00567 m_bstr[i] = ch;
00568 }}
00569 }
00570 }
00571
00572 inline bstr::bstr(bstr::class_type const& rhs)
00573 : m_bstr(bstr_dup(rhs.m_bstr))
00574 {
00575 #ifdef STLSOFT_CF_EXCEPTION_SUPPORT
00576 if( NULL == m_bstr &&
00577 !rhs.empty())
00578 {
00579 STLSOFT_THROW_X(com_exception("failed to allocate string", HRESULT_FROM_WIN32(::GetLastError())));
00580 }
00581 #endif
00582 }
00583
00584 inline bstr::bstr(bstr::class_type const& rhs, bstr::size_type pos, bstr::size_type len)
00585 : m_bstr(NULL)
00586 {
00587 #ifdef STLSOFT_CF_EXCEPTION_SUPPORT
00588 if(pos > rhs.size())
00589 {
00590 throw stlsoft_ns_qual_std(out_of_range)("Position out of range");
00591 }
00592 #else
00593 COMSTL_MESSAGE_ASSERT("Position out of range", pos <= rhs.size());
00594 #endif
00595
00596 if(pos + len > rhs.size())
00597 {
00598 len = rhs.size() - pos;
00599 }
00600
00601 m_bstr = bstr_create(rhs.data() + pos, len);
00602
00603 #ifdef STLSOFT_CF_EXCEPTION_SUPPORT
00604 if( NULL == m_bstr &&
00605 !rhs.empty())
00606 {
00607 STLSOFT_THROW_X(com_exception("failed to allocate string", HRESULT_FROM_WIN32(::GetLastError())));
00608 }
00609 #endif
00610 }
00611
00612 inline bstr::~bstr() stlsoft_throw_0()
00613 {
00614 ::SysFreeString(m_bstr);
00615 }
00616
00617 inline bstr::class_type& bstr::operator =(bstr::class_type const& rhs)
00618 {
00619 class_type t(rhs);
00620
00621 t.swap(*this);
00622
00623 return *this;
00624 }
00625
00626 inline bstr::class_type& bstr::assign(cs_char_a_t const* s, ssize_type len )
00627 {
00628 class_type t(s, len);
00629
00630 t.swap(*this);
00631
00632 return *this;
00633 }
00634
00635 inline bstr::class_type& bstr::assign(cs_char_w_t const* s, ssize_type len )
00636 {
00637 class_type t(s, len);
00638
00639 t.swap(*this);
00640
00641 return *this;
00642 }
00643
00644 inline bstr::class_type& bstr::assign(bstr::const_iterator from, bstr::const_iterator to)
00645 {
00646 return assign(from, to - from);
00647 }
00648
00649 inline bstr::class_type& bstr::operator =(cs_char_a_t const* s)
00650 {
00651 return assign(s);
00652 }
00653
00654 inline bstr::class_type& bstr::operator =(cs_char_w_t const* s)
00655 {
00656 return assign(s);
00657 }
00658
00659 inline bstr::class_type& bstr::attach(BSTR bstr)
00660 {
00661 *DestructiveAddress() = bstr;
00662
00663 return *this;
00664 }
00665
00666 inline BSTR bstr::detach()
00667 {
00668 BSTR str = m_bstr;
00669
00670 m_bstr = NULL;
00671
00672 return str;
00673 }
00674
00675 inline void bstr::clear()
00676 {
00677 ::SysFreeString(m_bstr);
00678
00679 m_bstr = NULL;
00680 }
00681
00682 inline bstr::class_type& bstr::append(bstr::class_type const& s, ssize_type len )
00683 {
00684 return append(s.data(), len);
00685 }
00686
00687 inline bstr::class_type& bstr::append(cs_char_w_t const* s, ssize_type len )
00688 {
00689 if(empty())
00690 {
00691 bstr rhs(s, len);
00692
00693 rhs.swap(*this);
00694 }
00695 else
00696 {
00697 if(len < 0)
00698 {
00699 len = (NULL == s) ? 0 : static_cast<ssize_type>(::wcslen(s));
00700 }
00701
00702 if(0 != len)
00703 {
00704 size_type totalLen = size() + len;
00705 bstr rhs(data(), static_cast<ssize_type>(totalLen));
00706
00707 #ifdef STLSOFT_USING_SAFE_STR_FUNCTIONS
00708 ::wcsncpy_s(&rhs[0] + size(), static_cast<cs_size_t>(totalLen), s, static_cast<cs_size_t>(len));
00709 #else
00710 ::wcsncpy(&rhs[0] + size(), s, static_cast<cs_size_t>(len));
00711 #endif
00712
00713 rhs.swap(*this);
00714 }
00715 }
00716
00717 return *this;
00718 }
00719
00720 inline bstr::class_type& bstr::operator +=(bstr::class_type const& s)
00721 {
00722 return append(s);
00723 }
00724
00725 inline bstr::class_type& bstr::operator +=(cs_char_w_t const* s)
00726 {
00727 return append(s);
00728 }
00729
00730
00731
00732
00733 inline bstr::const_pointer bstr::data() const
00734 {
00735 return this->c_str();
00736 }
00737
00738 inline bstr::const_pointer bstr::c_str() const
00739 {
00740 return (NULL == m_bstr) ? L"" : m_bstr;
00741 }
00742
00743 inline bstr::size_type bstr::length() const
00744 {
00745 return static_cast<size_type>(::SysStringLen(m_bstr));
00746 }
00747
00748 inline bstr::size_type bstr::size() const
00749 {
00750 return this->length();
00751 }
00752
00753 inline bstr::bool_type bstr::empty() const
00754 {
00755 return 0 == this->size();
00756 }
00757
00758 inline BSTR bstr::get() const
00759 {
00760 return m_bstr;
00761 }
00762
00763 inline bstr::reference bstr::operator [](bstr::size_type index)
00764 {
00765 COMSTL_MESSAGE_ASSERT("invalid index", index < size());
00766
00767 return index[m_bstr];
00768 }
00769
00770 inline bstr::const_reference bstr::operator [](bstr::size_type index) const
00771 {
00772 COMSTL_MESSAGE_ASSERT("invalid index", index <= size());
00773
00774 return index[data()];
00775 }
00776
00777 inline bstr::const_pointer *bstr::NonDestructiveAddress() const
00778 {
00779 return const_cast<const_pointer*>(&m_bstr);
00780 }
00781
00782 inline BSTR* bstr::NonDestructiveAddress()
00783 {
00784 return &m_bstr;
00785 }
00786
00787 inline BSTR* bstr::DestructiveAddress()
00788 {
00789 clear();
00790
00791 return &m_bstr;
00792 }
00793
00794 inline bstr::iterator bstr::begin()
00795 {
00796 return get();
00797 }
00798
00799 inline bstr::iterator bstr::end()
00800 {
00801 return get() + size();
00802 }
00803
00804 inline bstr::const_iterator bstr::begin() const
00805 {
00806 return get();
00807 }
00808
00809 inline bstr::const_iterator bstr::end() const
00810 {
00811 return get() + size();
00812 }
00813
00814 #if defined(STLSOFT_LF_BIDIRECTIONAL_ITERATOR_SUPPORT)
00815 inline bstr::const_reverse_iterator bstr::rbegin() const
00816 {
00817 return const_reverse_iterator(end());
00818 }
00819
00820 inline bstr::const_reverse_iterator bstr::rend() const
00821 {
00822 return const_reverse_iterator(begin());
00823 }
00824
00825 inline bstr::reverse_iterator bstr::rbegin()
00826 {
00827 return reverse_iterator(end());
00828 }
00829
00830 inline bstr::reverse_iterator bstr::rend()
00831 {
00832 return reverse_iterator(begin());
00833 }
00834 #endif
00835
00836 inline bstr::bool_type bstr::equal(bstr::class_type const& rhs) const
00837 {
00838 return 0 == bstr_compare(this->get(), rhs.get());
00839 }
00840
00841 inline bstr::bool_type bstr::equal(BSTR const& rhs) const
00842 {
00843 return 0 == bstr_compare(this->get(), rhs);
00844 }
00845
00846
00847
00848 inline void bstr::swap(bstr::class_type& rhs) stlsoft_throw_0()
00849 {
00850 std_swap(m_bstr, rhs.m_bstr);
00851 }
00852
00853 inline void bstr::swap(BSTR& rhs) stlsoft_throw_0()
00854 {
00855 std_swap(m_bstr, rhs);
00856 }
00857
00858 #endif
00859
00860
00861
00862
00863 #ifndef _COMSTL_NO_NAMESPACE
00864 # if defined(_STLSOFT_NO_NAMESPACE) || \
00865 defined(STLSOFT_DOCUMENTATION_SKIP_SECTION)
00866 }
00867 # else
00868 }
00869 }
00870 # endif
00871 #endif
00872
00873
00874
00875
00876
00877
00878
00879
00880
00881 #ifndef _COMSTL_NO_NAMESPACE
00882 # if !defined(_STLSOFT_NO_NAMESPACE) && \
00883 !defined(STLSOFT_DOCUMENTATION_SKIP_SECTION)
00884 namespace stlsoft
00885 {
00886 # else
00887
00888 # endif
00889
00890 using ::comstl::c_str_data;
00891 using ::comstl::c_str_data_w;
00892 using ::comstl::c_str_data_o;
00893
00894 using ::comstl::c_str_len;
00895 using ::comstl::c_str_len_w;
00896 using ::comstl::c_str_len_o;
00897
00898 using ::comstl::c_str_ptr;
00899 using ::comstl::c_str_ptr_w;
00900 using ::comstl::c_str_ptr_o;
00901
00902 using ::comstl::c_str_ptr_null;
00903 using ::comstl::c_str_ptr_null_w;
00904 using ::comstl::c_str_ptr_null_o;
00905
00906
00907
00908
00909
00912 STLSOFT_TEMPLATE_SPECIALISATION
00913 struct string_traits< ::comstl::bstr>
00914 {
00915 typedef ::comstl::bstr value_type;
00916 typedef ::comstl::bstr::value_type char_type;
00917 typedef value_type::size_type size_type;
00918 typedef char_type const const_char_type;
00919 typedef value_type string_type;
00920 typedef string_type::pointer pointer;
00921 typedef string_type::const_pointer const_pointer;
00922 typedef string_type::iterator iterator;
00923 typedef string_type::const_iterator const_iterator;
00924 #if defined(STLSOFT_LF_BIDIRECTIONAL_ITERATOR_SUPPORT)
00925 typedef string_type::reverse_iterator reverse_iterator;
00926 typedef string_type::const_reverse_iterator const_reverse_iterator;
00927 #endif
00928 enum
00929 {
00930 is_pointer = false
00931 , is_pointer_to_const = false
00932 , char_type_size = sizeof(char_type)
00933 };
00934
00935 static string_type empty_string()
00936 {
00937 return string_type();
00938 }
00939 static string_type construct(string_type const& src, size_type pos, size_type len)
00940 {
00941 return string_type(src, pos, len);
00942 }
00943 # ifdef STLSOFT_CF_MEMBER_TEMPLATE_FUNCTION_SUPPORT
00944 template <ss_typename_param_k I>
00945 static string_type& assign_inplace(string_type& str, I first, I last)
00946 # else
00947 static string_type& assign_inplace(string_type& str, const_iterator first, const_iterator last)
00948 # endif
00949 {
00950
00951 return (str = string_type(first, last - first), str);
00952 }
00953 };
00954
00955
00956 # if !defined(_STLSOFT_NO_NAMESPACE) && \
00957 !defined(STLSOFT_DOCUMENTATION_SKIP_SECTION)
00958 }
00959 # else
00960
00961 # endif
00962 #endif
00963
00964
00965
00966 #endif
00967
00968