diff options
author | Benjamin Barenblat <bbarenblat@gmail.com> | 2021-11-23 23:13:26 -0500 |
---|---|---|
committer | Benjamin Barenblat <bbarenblat@gmail.com> | 2021-11-23 23:13:26 -0500 |
commit | e5df1aafb6d1346207343ccb858fa373e6b86301 (patch) | |
tree | fb26f0091dda7dd69d48d6b06169ea618332b99e /SrcShared/String2 |
Check in the Palm OS Emulator, version 3.5 (2001). These files come from
the tarball present in the Debian archives [1]. The SHA-256 digest of
the tarball, c5e0d23424e88525bfba0ecdf0a432a8d93c885d04740df06a9eeee44e5f25e4,
matches the digest preserved in the FreeBSD ports tree [2], giving
further confidence that these files are as distributed by upstream.
[1] http://archive.debian.org/debian/pool/contrib/p/pose/
[2] https://svnweb.freebsd.org/ports/head/palm/pose/distinfo?revision=271305&view=markup&pathrev=282162
Diffstat (limited to 'SrcShared/String2')
-rw-r--r-- | SrcShared/String2 | 193 |
1 files changed, 193 insertions, 0 deletions
diff --git a/SrcShared/String2 b/SrcShared/String2 new file mode 100644 index 0000000..52d3987 --- /dev/null +++ b/SrcShared/String2 @@ -0,0 +1,193 @@ +// string standard header +#ifndef _STRING_ +#define _STRING_ +#include "xstring2" +#include <istream> + +#ifdef _MSC_VER +#pragma pack(push,8) +#endif /* _MSC_VER */ +_STD_BEGIN + // basic_string TEMPLATE OPERATORS +template<class _E, class _Tr, class _A> inline + basic_string<_E, _Tr, _A> __cdecl operator+( + const basic_string<_E, _Tr, _A>& _L, + const basic_string<_E, _Tr, _A>& _R) + {return (basic_string<_E, _Tr, _A>(_L) += _R); } +template<class _E, class _Tr, class _A> inline + basic_string<_E, _Tr, _A> __cdecl operator+(const _E *_L, + const basic_string<_E, _Tr, _A>& _R) + {return (basic_string<_E, _Tr, _A>(_L) += _R); } +template<class _E, class _Tr, class _A> inline + basic_string<_E, _Tr, _A> __cdecl operator+( + const _E _L, const basic_string<_E, _Tr, _A>& _R) + {return (basic_string<_E, _Tr, _A>(1, _L) += _R); } +template<class _E, class _Tr, class _A> inline + basic_string<_E, _Tr, _A> __cdecl operator+( + const basic_string<_E, _Tr, _A>& _L, + const _E *_R) + {return (basic_string<_E, _Tr, _A>(_L) += _R); } +template<class _E, class _Tr, class _A> inline + basic_string<_E, _Tr, _A> __cdecl operator+( + const basic_string<_E, _Tr, _A>& _L, const _E _R) + {return (basic_string<_E, _Tr, _A>(_L) += _R); } +template<class _E, class _Tr, class _A> inline + bool __cdecl operator==(const basic_string<_E, _Tr, _A>& _L, + const basic_string<_E, _Tr, _A>& _R) + {return (_L.compare(_R) == 0); } +template<class _E, class _Tr, class _A> inline + bool __cdecl operator==(const _E * _L, + const basic_string<_E, _Tr, _A>& _R) + {return (_R.compare(_L) == 0); } +template<class _E, class _Tr, class _A> inline + bool __cdecl operator==(const basic_string<_E, _Tr, _A>& _L, + const _E *_R) + {return (_L.compare(_R) == 0); } +template<class _E, class _Tr, class _A> inline + bool __cdecl operator!=(const basic_string<_E, _Tr, _A>& _L, + const basic_string<_E, _Tr, _A>& _R) + {return (!(_L == _R)); } +template<class _E, class _Tr, class _A> inline + bool __cdecl operator!=(const _E *_L, + const basic_string<_E, _Tr, _A>& _R) + {return (!(_L == _R)); } +template<class _E, class _Tr, class _A> inline + bool __cdecl operator!=(const basic_string<_E, _Tr, _A>& _L, + const _E *_R) + {return (!(_L == _R)); } +template<class _E, class _Tr, class _A> inline + bool __cdecl operator<(const basic_string<_E, _Tr, _A>& _L, + const basic_string<_E, _Tr, _A>& _R) + {return (_L.compare(_R) < 0); } +template<class _E, class _Tr, class _A> inline + bool __cdecl operator<(const _E * _L, + const basic_string<_E, _Tr, _A>& _R) + {return (_R.compare(_L) > 0); } +template<class _E, class _Tr, class _A> inline + bool __cdecl operator<(const basic_string<_E, _Tr, _A>& _L, + const _E *_R) + {return (_L.compare(_R) < 0); } +template<class _E, class _Tr, class _A> inline + bool __cdecl operator>(const basic_string<_E, _Tr, _A>& _L, + const basic_string<_E, _Tr, _A>& _R) + {return (_R < _L); } +template<class _E, class _Tr, class _A> inline + bool __cdecl operator>(const _E * _L, + const basic_string<_E, _Tr, _A>& _R) + {return (_R < _L); } +template<class _E, class _Tr, class _A> inline + bool __cdecl operator>(const basic_string<_E, _Tr, _A>& _L, + const _E *_R) + {return (_R < _L); } +template<class _E, class _Tr, class _A> inline + bool __cdecl operator<=(const basic_string<_E, _Tr, _A>& _L, + const basic_string<_E, _Tr, _A>& _R) + {return (!(_R < _L)); } +template<class _E, class _Tr, class _A> inline + bool __cdecl operator<=(const _E * _L, + const basic_string<_E, _Tr, _A>& _R) + {return (!(_R < _L)); } +template<class _E, class _Tr, class _A> inline + bool __cdecl operator<=(const basic_string<_E, _Tr, _A>& _L, + const _E *_R) + {return (!(_R < _L)); } +template<class _E, class _Tr, class _A> inline + bool __cdecl operator>=(const basic_string<_E, _Tr, _A>& _L, + const basic_string<_E, _Tr, _A>& _R) + {return (!(_L < _R)); } +template<class _E, class _Tr, class _A> inline + bool __cdecl operator>=(const _E * _L, + const basic_string<_E, _Tr, _A>& _R) + {return (!(_L < _R)); } +template<class _E, class _Tr, class _A> inline + bool __cdecl operator>=(const basic_string<_E, _Tr, _A>& _L, + const _E *_R) + {return (!(_L < _R)); } + // basic_string INSERTERS AND EXTRACTORS +template<class _E, class _Tr, class _A> inline + basic_istream<_E, _Tr>& __cdecl operator>>( + basic_istream<_E, _Tr>& _I, + basic_string<_E, _Tr, _A>& _X) + {typedef ctype<_E> _Ctype; + typedef basic_istream<_E, _Tr> _Myis; + ios_base::iostate _St = ios_base::goodbit; + bool _Chg = false; + _X.erase(); + const _Myis::sentry _Ok(_I); + if (_Ok) + {const _Ctype& _Fac = _USE(_I.getloc(), _Ctype); + _TRY_IO_BEGIN + _A::size_type _N = 0 < _I.width() + && _I.width() < _X.max_size() + ? _I.width() : _X.max_size(); + _Tr::int_type _C = _I.rdbuf()->sgetc(); + for (; 0 < --_N; _C = _I.rdbuf()->snextc()) + if(_Tr::eq_int_type(_Tr::eof(), _C)) + {_St |= ios_base::eofbit; + break; } + else if (_Fac.is(_Ctype::space, + _Tr::to_char_type(_C))) + break; + else + {_X.append(1, _Tr::to_char_type(_C)); + _Chg = true; } + _CATCH_IO_(_I); } + _I.width(0); + if (!_Chg) + _St |= ios_base::failbit; + _I.setstate(_St); + return (_I); } +template<class _E, class _Tr, class _A> inline + basic_istream<_E, _Tr>& __cdecl getline(basic_istream<_E, _Tr>& _I, + basic_string<_E, _Tr, _A>& _X) + {return (getline(_I, _X, _I.widen('\n'))); } +template<class _E, class _Tr, class _A> inline + basic_istream<_E, _Tr>& __cdecl getline(basic_istream<_E, _Tr>& _I, + basic_string<_E, _Tr, _A>& _X, const _E _D) + {typedef basic_istream<_E, _Tr> _Myis; + ios_base::iostate _St = ios_base::goodbit; + bool _Chg = false; + _X.erase(); + const _Myis::sentry _Ok(_I, true); + if (_Ok) + {_TRY_IO_BEGIN + _Tr::int_type _C = _I.rdbuf()->sgetc(); + for (; ; _C = _I.rdbuf()->snextc()) + if (_Tr::eq_int_type(_Tr::eof(), _C)) + {_St |= ios_base::eofbit; + break; } + else if (_Tr::eq(_C, _D)) + {_Chg = true; + _I.rdbuf()->snextc(); + break; } + else if (_X.max_size() <= _X.size()) + {_St |= ios_base::failbit; + break; } + else + _X += _Tr::to_char_type(_C), _Chg = true; + _CATCH_IO_(_I); } + if (!_Chg) + _St |= ios_base::failbit; + _I.setstate(_St); + return (_I); } +template<class _E, class _Tr, class _A> inline + basic_ostream<_E, _Tr>& __cdecl operator<<( + basic_ostream<_E, _Tr>& _O, + const basic_string<_E, _Tr, _A>& _X) + { + for (_A::size_type _N = 0; _N < _X.size(); ++_N) + if (_Tr::eq_int_type(_Tr::eof(), + _O.rdbuf()->sputc(_X[_N]))) + break; + return (_O); } +_STD_END +#ifdef _MSC_VER +#pragma pack(pop) +#endif /* _MSC_VER */ + +#endif /* _STRING */ + +/* + * Copyright (c) 1994 by P.J. Plauger. ALL RIGHTS RESERVED. + * Consult your license regarding permissions and restrictions. + */ |