os/ossrv/genericopenlibs/cppstdlib/stl/src/collate.cpp
author sl
Tue, 10 Jun 2014 14:32:02 +0200
changeset 1 260cb5ec6c19
permissions -rw-r--r--
Update contrib.
sl@0
     1
/*
sl@0
     2
 * Copyright (c) 1999
sl@0
     3
 * Silicon Graphics Computer Systems, Inc.
sl@0
     4
 *
sl@0
     5
 * Copyright (c) 1999
sl@0
     6
 * Boris Fomitchev
sl@0
     7
 *
sl@0
     8
 * This material is provided "as is", with absolutely no warranty expressed
sl@0
     9
 * or implied. Any use is at your own risk.
sl@0
    10
 *
sl@0
    11
 * Permission to use or copy this software for any purpose is hereby granted
sl@0
    12
 * without fee, provided the above notices are retained on all copies.
sl@0
    13
 * Permission to modify the code and to distribute modified code is granted,
sl@0
    14
 * provided the above notices are retained, and a notice that the code was
sl@0
    15
 * modified is included with the above copyright notice.
sl@0
    16
 *
sl@0
    17
 */
sl@0
    18
#include "stlport_prefix.h"
sl@0
    19
sl@0
    20
#include <locale>
sl@0
    21
sl@0
    22
_STLP_BEGIN_NAMESPACE
sl@0
    23
sl@0
    24
// collate<char>
sl@0
    25
sl@0
    26
_STLP_DECLSPEC collate<char>::~collate() {}
sl@0
    27
sl@0
    28
_STLP_DECLSPEC int collate<char>::do_compare(const char* low1, const char* high1,
sl@0
    29
                              const char* low2, const char* high2) const
sl@0
    30
{ return _STLP_PRIV __lexicographical_compare_3way(low1, high1, low2, high2); }
sl@0
    31
sl@0
    32
_STLP_DECLSPEC string collate<char>::do_transform(const char* low, const char* high) const
sl@0
    33
{ return string(low, high); }
sl@0
    34
sl@0
    35
_STLP_DECLSPEC long collate<char>::do_hash(const char* low, const char* high) const {
sl@0
    36
  unsigned long result = 0;
sl@0
    37
  for ( ; low < high; ++low)
sl@0
    38
    result = 5 * result + *low;
sl@0
    39
  return result;
sl@0
    40
}
sl@0
    41
sl@0
    42
#if !defined (_STLP_NO_WCHAR_T)
sl@0
    43
// collate<wchar_t>
sl@0
    44
sl@0
    45
_STLP_DECLSPEC collate<wchar_t>::~collate() {}
sl@0
    46
sl@0
    47
_STLP_DECLSPEC int
sl@0
    48
collate<wchar_t>::do_compare(const wchar_t* low1, const wchar_t* high1,
sl@0
    49
                             const wchar_t* low2, const wchar_t* high2) const
sl@0
    50
{ return _STLP_PRIV __lexicographical_compare_3way(low1, high1, low2, high2); }
sl@0
    51
sl@0
    52
_STLP_DECLSPEC wstring collate<wchar_t>::do_transform(const wchar_t* low, const wchar_t* high) const
sl@0
    53
{ return wstring(low, high); }
sl@0
    54
sl@0
    55
_STLP_DECLSPEC long collate<wchar_t>::do_hash(const wchar_t* low, const wchar_t* high) const {
sl@0
    56
  unsigned long result = 0;
sl@0
    57
  for ( ; low < high; ++low)
sl@0
    58
    result = 5 * result + *low;
sl@0
    59
  return result;
sl@0
    60
}
sl@0
    61
#endif
sl@0
    62
sl@0
    63
_STLP_END_NAMESPACE
sl@0
    64
sl@0
    65
sl@0
    66
// Local Variables:
sl@0
    67
// mode:C++
sl@0
    68
// End:
sl@0
    69