⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 _string.h

📁 symbian上STL模板库的实现
💻 H
📖 第 1 页 / 共 4 页
字号:
                size_type __pos = 0) const         { return find_first_not_of(__s._M_start, __pos, __s.size()); }        size_type find_first_not_of(const _CharT* __s, size_type __pos = 0) const         { _STLP_FIX_LITERAL_BUG(__s) return find_first_not_of(__s, __pos, _Traits::length(__s)); }        size_type find_first_not_of(const _CharT* __s, size_type __pos,                size_type __n) const;        size_type find_first_not_of(_CharT __c, size_type __pos = 0) const;    public:                         // find_last_not_of        size_type find_last_not_of(const _Self& __s,                 size_type __pos = npos) const        { return find_last_not_of(__s._M_start, __pos, __s.size()); }        size_type find_last_not_of(const _CharT* __s, size_type __pos = npos) const        { _STLP_FIX_LITERAL_BUG(__s) return find_last_not_of(__s, __pos, _Traits::length(__s)); }        size_type find_last_not_of(const _CharT* __s, size_type __pos,                size_type __n) const;        size_type find_last_not_of(_CharT __c, size_type __pos = npos) const;    public:                         // Substring.        _Self substr(size_type __pos = 0, size_type __n = npos) const {            if (__pos > size())                this->_M_throw_out_of_range();            return _Self(this->_M_start + __pos,                     this->_M_start + __pos + (min) (__n, size() - __pos));        }    public:                         // Compare        int compare(const _Self& __s) const         { return _M_compare(this->_M_start, this->_M_finish, __s._M_start, __s._M_finish); }        int compare(size_type __pos1, size_type __n1,                const _Self& __s) const {            if (__pos1 > size())                this->_M_throw_out_of_range();            return _M_compare(this->_M_start + __pos1,                     this->_M_start + __pos1 + (min) (__n1, size() - __pos1),                    __s._M_start, __s._M_finish);        }        int compare(size_type __pos1, size_type __n1,                const _Self& __s,                size_type __pos2, size_type __n2) const {            if (__pos1 > size() || __pos2 > __s.size())                this->_M_throw_out_of_range();            return _M_compare(this->_M_start + __pos1,                     this->_M_start + __pos1 + (min) (__n1, size() - __pos1),                    __s._M_start + __pos2,                     __s._M_start + __pos2 + (min) (__n2, __s.size() - __pos2));        }        int compare(const _CharT* __s) const {            _STLP_FIX_LITERAL_BUG(__s)                 return _M_compare(this->_M_start, this->_M_finish, __s, __s + _Traits::length(__s));        }        int compare(size_type __pos1, size_type __n1, const _CharT* __s) const {            _STLP_FIX_LITERAL_BUG(__s)                if (__pos1 > size())                    this->_M_throw_out_of_range();            return _M_compare(this->_M_start + __pos1,                     this->_M_start + __pos1 + (min) (__n1, size() - __pos1),                    __s, __s + _Traits::length(__s));        }        int compare(size_type __pos1, size_type __n1, const _CharT* __s,                size_type __n2) const {            _STLP_FIX_LITERAL_BUG(__s)                if (__pos1 > size())                    this->_M_throw_out_of_range();            return _M_compare(this->_M_start + __pos1,                     this->_M_start + __pos1 + (min) (__n1, size() - __pos1),                    __s, __s + __n2);        }    public:                        // Helper functions for compare.        static int _STLP_CALL _M_compare(const _CharT* __f1, const _CharT* __l1,                const _CharT* __f2, const _CharT* __l2) {            const ptrdiff_t __n1 = __l1 - __f1;            const ptrdiff_t __n2 = __l2 - __f2;            const int cmp = _Traits::compare(__f1, __f2, (min) (__n1, __n2));            return cmp != 0 ? cmp : (__n1 < __n2 ? -1 : (__n1 > __n2 ? 1 : 0));        }};#if ! defined (__STLP_STATIC_CONST_INIT_BUG) && \    __GNUC__ == 2 && __GNUC_MINOR__ == 96template <class _CharT, class _Traits, class _Alloc>const size_t basic_string<_CharT, _Traits, _Alloc>::npos = ~(size_t) 0;#endif# if defined (_STLP_USE_TEMPLATE_EXPORT)_STLP_EXPORT_TEMPLATE_CLASS basic_string<char, char_traits<char>, allocator<char> >;#  if defined (_STLP_HAS_WCHAR_T)_STLP_EXPORT_TEMPLATE_CLASS basic_string<wchar_t, char_traits<wchar_t>, allocator<wchar_t> >;#  endif# endif /* _STLP_USE_TEMPLATE_EXPORT */// ------------------------------------------------------------// Non-member functions.    template <class _CharT, class _Traits, class _Alloc> inline basic_string<_CharT,_Traits,_Alloc> _STLP_CALLoperator+(const basic_string<_CharT,_Traits,_Alloc>& __s,        const basic_string<_CharT,_Traits,_Alloc>& __y){    typedef basic_string<_CharT,_Traits,_Alloc> _Str;    typedef typename _Str::_Reserve_t _Reserve_t;# ifdef __GNUC__    // gcc counts this as a function    _Str __result  = _Str(_Reserve_t(),__s.size() + __y.size());# else    _Str __result(_Reserve_t(), __s.size() + __y.size());# endif    __result.append(__s);    __result.append(__y);    return __result;}# if defined (__GNUC__) || defined (__MLCCPP__)#  define _STLP_INIT_AMBIGUITY 1# endiftemplate <class _CharT, class _Traits, class _Alloc> inline basic_string<_CharT,_Traits,_Alloc> _STLP_CALLoperator+(const _CharT* __s,        const basic_string<_CharT,_Traits,_Alloc>& __y) {    _STLP_FIX_LITERAL_BUG(__s)        typedef basic_string<_CharT,_Traits,_Alloc> _Str;    typedef typename _Str::_Reserve_t _Reserve_t;    const size_t __n = _Traits::length(__s);# ifdef _STLP_INIT_AMBIGUITY    _Str __result = _Str(_Reserve_t(), __n + __y.size());# else    _Str __result(_Reserve_t(), __n + __y.size());# endif    __result.append(__s, __s + __n);    __result.append(__y);    return __result;}template <class _CharT, class _Traits, class _Alloc> inline basic_string<_CharT,_Traits,_Alloc> _STLP_CALLoperator+(_CharT __c,        const basic_string<_CharT,_Traits,_Alloc>& __y) {    typedef basic_string<_CharT,_Traits,_Alloc> _Str;    typedef typename _Str::_Reserve_t _Reserve_t;# ifdef _STLP_INIT_AMBIGUITY    _Str __result = _Str(_Reserve_t(), 1 + __y.size());# else    _Str __result(_Reserve_t(), 1 + __y.size());# endif    __result.push_back(__c);    __result.append(__y);    return __result;}template <class _CharT, class _Traits, class _Alloc> inline basic_string<_CharT,_Traits,_Alloc> _STLP_CALLoperator+(const basic_string<_CharT,_Traits,_Alloc>& __x,        const _CharT* __s) {    _STLP_FIX_LITERAL_BUG(__s)        typedef basic_string<_CharT,_Traits,_Alloc> _Str;    typedef typename _Str::_Reserve_t _Reserve_t;    const size_t __n = _Traits::length(__s);# ifdef _STLP_INIT_AMBIGUITY    _Str __result = _Str(_Reserve_t(), __x.size() + __n, __x.get_allocator());# else    _Str __result(_Reserve_t(), __x.size() + __n, __x.get_allocator());# endif    __result.append(__x);    __result.append(__s, __s + __n);    return __result;}template <class _CharT, class _Traits, class _Alloc> inline basic_string<_CharT,_Traits,_Alloc> _STLP_CALLoperator+(const basic_string<_CharT,_Traits,_Alloc>& __x,        const _CharT __c) {    typedef basic_string<_CharT,_Traits,_Alloc> _Str;    typedef typename _Str::_Reserve_t _Reserve_t;# ifdef _STLP_INIT_AMBIGUITY    _Str __result = _Str(_Reserve_t(), __x.size() + 1, __x.get_allocator());# else    _Str __result(_Reserve_t(), __x.size() + 1, __x.get_allocator());# endif    __result.append(__x);    __result.push_back(__c);    return __result;}# undef _STLP_INIT_AMBIGUITY// Operator== and operator!=template <class _CharT, class _Traits, class _Alloc> inline bool _STLP_CALLoperator==(const basic_string<_CharT,_Traits,_Alloc>& __x,        const basic_string<_CharT,_Traits,_Alloc>& __y) {    return __x.size() == __y.size() && _Traits::compare(__x.data(), __y.data(), __x.size()) == 0;}template <class _CharT, class _Traits, class _Alloc> inline bool _STLP_CALLoperator==(const _CharT* __s,        const basic_string<_CharT,_Traits,_Alloc>& __y) {    _STLP_FIX_LITERAL_BUG(__s)        size_t __n = _Traits::length(__s);    return __n == __y.size() && _Traits::compare(__s, __y.data(), __n) == 0;}template <class _CharT, class _Traits, class _Alloc> inline bool _STLP_CALLoperator==(const basic_string<_CharT,_Traits,_Alloc>& __x,        const _CharT* __s) {    _STLP_FIX_LITERAL_BUG(__s)        size_t __n = _Traits::length(__s);    return __x.size() == __n && _Traits::compare(__x.data(), __s, __n) == 0;}// Operator< (and also >, <=, and >=).template <class _CharT, class _Traits, class _Alloc> inline bool _STLP_CALLoperator<(const basic_string<_CharT,_Traits,_Alloc>& __x,        const basic_string<_CharT,_Traits,_Alloc>& __y) {    return basic_string<_CharT,_Traits,_Alloc> ::_M_compare(__x.begin(), __x.end(),             __y.begin(), __y.end()) < 0;}template <class _CharT, class _Traits, class _Alloc> inline bool _STLP_CALLoperator<(const _CharT* __s,        const basic_string<_CharT,_Traits,_Alloc>& __y) {    _STLP_FIX_LITERAL_BUG(__s)        size_t __n = _Traits::length(__s);    return basic_string<_CharT,_Traits,_Alloc> ::_M_compare(__s, __s + __n, __y.begin(), __y.end()) < 0;}template <class _CharT, class _Traits, class _Alloc> inline bool _STLP_CALLoperator<(const basic_string<_CharT,_Traits,_Alloc>& __x,        const _CharT* __s) {    _STLP_FIX_LITERAL_BUG(__s)        size_t __n = _Traits::length(__s);    return basic_string<_CharT,_Traits,_Alloc> ::_M_compare(__x.begin(), __x.end(), __s, __s + __n) < 0;}#ifdef _STLP_USE_SEPARATE_RELOPS_NAMESPACEtemplate <class _CharT, class _Traits, class _Alloc> inline bool _STLP_CALLoperator!=(const basic_string<_CharT,_Traits,_Alloc>& __x,        const basic_string<_CharT,_Traits,_Alloc>& __y) {    return !(__x == __y);}template <class _CharT, class _Traits, class _Alloc> inline bool _STLP_CALLoperator>(const basic_string<_CharT,_Traits,_Alloc>& __x,        const basic_string<_CharT,_Traits,_Alloc>& __y) {    return __y < __x;}template <class _CharT, class _Traits, class _Alloc> inline bool _STLP_CALLoperator<=(const basic_string<_CharT,_Traits,_Alloc>& __x,        const basic_string<_CharT,_Traits,_Alloc>& __y) {    return !(__y < __x);}template <class _CharT, class _Traits, class _Alloc> inline bool _STLP_CALLoperator>=(const basic_string<_CharT,_Traits,_Alloc>& __x,        const basic_string<_CharT,_Traits,_Alloc>& __y) {    return !(__x < __y);}#endif /* _STLP_USE_SEPARATE_RELOPS_NAMESPACE */template <class _CharT, class _Traits, class _Alloc> inline bool _STLP_CALL operator!=(const _CharT* __s,        const basic_string<_CharT,_Traits,_Alloc>& __y) {    _STLP_FIX_LITERAL_BUG(__s)        return !(__s == __y);}template <class _CharT, class _Traits, class _Alloc> inline bool _STLP_CALL operator!=(const basic_string<_CharT,_Traits,_Alloc>& __x,        const _CharT* __s) {    _STLP_FIX_LITERAL_BUG(__s)        return !(__x == __s);}template <class _CharT, class _Traits, class _Alloc> inline bool _STLP_CALLoperator>(const _CharT* __s,        const basic_string<_CharT,_Traits,_Alloc>& __y) {    _STLP_FIX_LITERAL_BUG(__s)        return __y < __s;}template <class _CharT, class _Traits, class _Alloc> inline bool _STLP_CALLoperator>(const basic_string<_CharT,_Traits,_Alloc>& __x,        const _CharT* __s) {    _STLP_FIX_LITERAL_BUG(__s)        return __s < __x;}template <class _CharT, class _Traits, class _Alloc> inline bool _STLP_CALLoperator<=(const _CharT* __s,        const basic_string<_CharT,_Traits,_Alloc>& __y) {    _STLP_FIX_LITERAL_BUG(__s)        return !(__y < __s);}template <class _CharT, class _Traits, class _Alloc> inline bool _STLP_CALLoperator<=(const basic_string<_CharT,_Traits,_Alloc>& __x,        const _CharT* __s) {    _STLP_FIX_LITERAL_BUG(__s)        return !(__s < __x);}template <class _CharT, class _Traits, class _Alloc> inline bool _STLP_CALLoperator>=(const _CharT* __s,        const basic_string<_CharT,_Traits,_Alloc>& __y) {    _STLP_FIX_LITERAL_BUG(__s)        return !(__s < __y);}template <class _CharT, class _Traits, class _Alloc> inline bool _STLP_CALLoperator>=(const basic_string<_CharT,_Traits,_Alloc>& __x,        const _CharT* __s) {    _STLP_FIX_LITERAL_BUG(__s)        return !(__x < __s);}// Swap.#ifdef _STLP_FUNCTION_TMPL_PARTIAL_ORDERtemplate <class _CharT, class _Traits, class _Alloc> inline void _STLP_CALLswap(basic_string<_CharT,_Traits,_Alloc>& __x,        basic_string<_CharT,_Traits,_Alloc>& __y) {    __x.swap(__y);}#endif /* _STLP_FUNCTION_TMPL_PARTIAL_ORDER */template <class _CharT, class _Traits, class _Alloc> void  _STLP_CALL _S_string_copy(const basic_string<_CharT,_Traits,_Alloc>& __s,        _CharT* __buf,        size_t __n);# undef basic_string#if defined(_STLP_WINCE)// A couple of functions to transfer between ASCII/Unicodewstring __ASCIIToWide(const char *ascii);string __WideToASCII(const wchar_t *wide);#endif_STLP_END_NAMESPACE# ifdef _STLP_DEBUG#  include <stl/debug/_string.h> # endif# if !defined (_STLP_LINK_TIME_INSTANTIATION)#  include <bits/STLPort/_string.tcc> # endif//# include <stl/_string_io.h>  //# include <stl/_string_hash.h>  #endif /* _STLP_STRING_H */// Local Variables:// mode:C++// End:

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -