File: collate.cpp

package info (click to toggle)
stlport4.6 4.6.2-3
  • links: PTS
  • area: main
  • in suites: etch, etch-m68k
  • size: 7,048 kB
  • ctags: 16,390
  • sloc: ansic: 46,190; cpp: 18,805; sh: 266; asm: 93; perl: 58; makefile: 8
file content (83 lines) | stat: -rw-r--r-- 1,924 bytes parent folder | download | duplicates (6)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
/*
 * Copyright (c) 1999
 * Silicon Graphics Computer Systems, Inc.
 *
 * Copyright (c) 1999 
 * Boris Fomitchev
 *
 * This material is provided "as is", with absolutely no warranty expressed
 * or implied. Any use is at your own risk.
 *
 * Permission to use or copy this software for any purpose is hereby granted 
 * without fee, provided the above notices are retained on all copies.
 * Permission to modify the code and to distribute modified code is granted,
 * provided the above notices are retained, and a notice that the code was
 * modified is included with the above copyright notice.
 *
 */ 
# include "stlport_prefix.h"

#include "stl/_collate.h"

_STLP_BEGIN_NAMESPACE

// collate<char>

collate<char>::~collate() {}

int collate<char>::do_compare(const char* low1, const char* high1,
                              const char* low2, const char* high2) const
{
  return __lexicographical_compare_3way(low1, high1, low2, high2);
}

string collate<char>::do_transform(const char* low, const char* high) const
{
  return string(low, high);
}

long collate<char>::do_hash(const char* low, const char* high) const {
  unsigned long result = 0;
  for ( ; low < high; ++low)
    result = 5 * result + *low;
  return result;
}




# ifndef _STLP_NO_WCHAR_T
// collate<wchar_t>

collate<wchar_t>::~collate() {}

int
collate<wchar_t>::do_compare(const wchar_t* low1, const wchar_t* high1,
                             const wchar_t* low2, const wchar_t* high2) const
{
  return __lexicographical_compare_3way(low1, high1, low2, high2);
}


wstring
collate<wchar_t>::do_transform(const wchar_t* low, const wchar_t* high) const
{
  return wstring(low, high);
}

long collate<wchar_t>::do_hash(const wchar_t* low, const wchar_t* high) const
{
  unsigned long result = 0;
  for ( ; low < high; ++low)
    result = 5 * result + *low;
  return result;
}
# endif

_STLP_END_NAMESPACE


// Local Variables:
// mode:C++
// End: