os/ossrv/genericopenlibs/cppstdlib/stl/src/collate.cpp
changeset 0 bde4ae8d615e
     1.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     1.2 +++ b/os/ossrv/genericopenlibs/cppstdlib/stl/src/collate.cpp	Fri Jun 15 03:10:57 2012 +0200
     1.3 @@ -0,0 +1,69 @@
     1.4 +/*
     1.5 + * Copyright (c) 1999
     1.6 + * Silicon Graphics Computer Systems, Inc.
     1.7 + *
     1.8 + * Copyright (c) 1999
     1.9 + * Boris Fomitchev
    1.10 + *
    1.11 + * This material is provided "as is", with absolutely no warranty expressed
    1.12 + * or implied. Any use is at your own risk.
    1.13 + *
    1.14 + * Permission to use or copy this software for any purpose is hereby granted
    1.15 + * without fee, provided the above notices are retained on all copies.
    1.16 + * Permission to modify the code and to distribute modified code is granted,
    1.17 + * provided the above notices are retained, and a notice that the code was
    1.18 + * modified is included with the above copyright notice.
    1.19 + *
    1.20 + */
    1.21 +#include "stlport_prefix.h"
    1.22 +
    1.23 +#include <locale>
    1.24 +
    1.25 +_STLP_BEGIN_NAMESPACE
    1.26 +
    1.27 +// collate<char>
    1.28 +
    1.29 +_STLP_DECLSPEC collate<char>::~collate() {}
    1.30 +
    1.31 +_STLP_DECLSPEC int collate<char>::do_compare(const char* low1, const char* high1,
    1.32 +                              const char* low2, const char* high2) const
    1.33 +{ return _STLP_PRIV __lexicographical_compare_3way(low1, high1, low2, high2); }
    1.34 +
    1.35 +_STLP_DECLSPEC string collate<char>::do_transform(const char* low, const char* high) const
    1.36 +{ return string(low, high); }
    1.37 +
    1.38 +_STLP_DECLSPEC long collate<char>::do_hash(const char* low, const char* high) const {
    1.39 +  unsigned long result = 0;
    1.40 +  for ( ; low < high; ++low)
    1.41 +    result = 5 * result + *low;
    1.42 +  return result;
    1.43 +}
    1.44 +
    1.45 +#if !defined (_STLP_NO_WCHAR_T)
    1.46 +// collate<wchar_t>
    1.47 +
    1.48 +_STLP_DECLSPEC collate<wchar_t>::~collate() {}
    1.49 +
    1.50 +_STLP_DECLSPEC int
    1.51 +collate<wchar_t>::do_compare(const wchar_t* low1, const wchar_t* high1,
    1.52 +                             const wchar_t* low2, const wchar_t* high2) const
    1.53 +{ return _STLP_PRIV __lexicographical_compare_3way(low1, high1, low2, high2); }
    1.54 +
    1.55 +_STLP_DECLSPEC wstring collate<wchar_t>::do_transform(const wchar_t* low, const wchar_t* high) const
    1.56 +{ return wstring(low, high); }
    1.57 +
    1.58 +_STLP_DECLSPEC long collate<wchar_t>::do_hash(const wchar_t* low, const wchar_t* high) const {
    1.59 +  unsigned long result = 0;
    1.60 +  for ( ; low < high; ++low)
    1.61 +    result = 5 * result + *low;
    1.62 +  return result;
    1.63 +}
    1.64 +#endif
    1.65 +
    1.66 +_STLP_END_NAMESPACE
    1.67 +
    1.68 +
    1.69 +// Local Variables:
    1.70 +// mode:C++
    1.71 +// End:
    1.72 +