/home/ntakagi/work/STLport-5.1.5/src/collate.cpp

Go to the documentation of this file.
00001 /*
00002  * Copyright (c) 1999
00003  * Silicon Graphics Computer Systems, Inc.
00004  *
00005  * Copyright (c) 1999
00006  * Boris Fomitchev
00007  *
00008  * This material is provided "as is", with absolutely no warranty expressed
00009  * or implied. Any use is at your own risk.
00010  *
00011  * Permission to use or copy this software for any purpose is hereby granted
00012  * without fee, provided the above notices are retained on all copies.
00013  * Permission to modify the code and to distribute modified code is granted,
00014  * provided the above notices are retained, and a notice that the code was
00015  * modified is included with the above copyright notice.
00016  *
00017  */
00018 #include "stlport_prefix.h"
00019 
00020 #include <locale>
00021 
00022 _STLP_BEGIN_NAMESPACE
00023 
00024 // collate<char>
00025 
00026 collate<char>::~collate() {}
00027 
00028 int collate<char>::do_compare(const char* low1, const char* high1,
00029                               const char* low2, const char* high2) const
00030 { return _STLP_PRIV __lexicographical_compare_3way(low1, high1, low2, high2); }
00031 
00032 string collate<char>::do_transform(const char* low, const char* high) const
00033 { return string(low, high); }
00034 
00035 long collate<char>::do_hash(const char* low, const char* high) const {
00036   unsigned long result = 0;
00037   for ( ; low < high; ++low)
00038     result = 5 * result + *low;
00039   return result;
00040 }
00041 
00042 #if !defined (_STLP_NO_WCHAR_T)
00043 // collate<wchar_t>
00044 
00045 collate<wchar_t>::~collate() {}
00046 
00047 int
00048 collate<wchar_t>::do_compare(const wchar_t* low1, const wchar_t* high1,
00049                              const wchar_t* low2, const wchar_t* high2) const
00050 { return _STLP_PRIV __lexicographical_compare_3way(low1, high1, low2, high2); }
00051 
00052 wstring collate<wchar_t>::do_transform(const wchar_t* low, const wchar_t* high) const
00053 { return wstring(low, high); }
00054 
00055 long collate<wchar_t>::do_hash(const wchar_t* low, const wchar_t* high) const {
00056   unsigned long result = 0;
00057   for ( ; low < high; ++low)
00058     result = 5 * result + *low;
00059   return result;
00060 }
00061 #endif
00062 
00063 _STLP_END_NAMESPACE
00064 
00065 
00066 // Local Variables:
00067 // mode:C++
00068 // End:
00069 



Generated on Mon Mar 10 15:32:16 2008 by  doxygen 1.5.1