williamr@4
|
1 |
/*
|
williamr@4
|
2 |
* Copyright (c) 1999
|
williamr@4
|
3 |
* Silicon Graphics Computer Systems, Inc.
|
williamr@4
|
4 |
*
|
williamr@4
|
5 |
* Permission to use, copy, modify, distribute and sell this software
|
williamr@4
|
6 |
* and its documentation for any purpose is hereby granted without fee,
|
williamr@4
|
7 |
* provided that the above copyright notice appear in all copies and
|
williamr@4
|
8 |
* that both that copyright notice and this permission notice appear
|
williamr@4
|
9 |
* in supporting documentation. Silicon Graphics makes no
|
williamr@4
|
10 |
* representations about the suitability of this software for any
|
williamr@4
|
11 |
* purpose. It is provided "as is" without express or implied warranty.
|
williamr@4
|
12 |
*/
|
williamr@4
|
13 |
|
williamr@4
|
14 |
// WARNING: This is an internal header file, included by other C++
|
williamr@4
|
15 |
// standard library headers. You should not attempt to use this header
|
williamr@4
|
16 |
// file directly.
|
williamr@4
|
17 |
|
williamr@4
|
18 |
#ifndef _STLP_INTERNAL_CTRAITS_FUNCTIONS_H
|
williamr@4
|
19 |
#define _STLP_INTERNAL_CTRAITS_FUNCTIONS_H
|
williamr@4
|
20 |
|
williamr@4
|
21 |
# ifndef _STLP_INTERNAL_FUNCTION_H
|
williamr@4
|
22 |
# include <stl/_function_base.h>
|
williamr@4
|
23 |
# endif
|
williamr@4
|
24 |
|
williamr@4
|
25 |
// This file contains a few small adapters that allow a character
|
williamr@4
|
26 |
// traits class to be used as a function object.
|
williamr@4
|
27 |
|
williamr@4
|
28 |
_STLP_BEGIN_NAMESPACE
|
williamr@4
|
29 |
|
williamr@4
|
30 |
template <class _Traits>
|
williamr@4
|
31 |
struct _Eq_traits
|
williamr@4
|
32 |
: public binary_function<typename _Traits::char_type,
|
williamr@4
|
33 |
typename _Traits::char_type,
|
williamr@4
|
34 |
bool>
|
williamr@4
|
35 |
{
|
williamr@4
|
36 |
bool operator()(const typename _Traits::char_type& __x,
|
williamr@4
|
37 |
const typename _Traits::char_type& __y) const
|
williamr@4
|
38 |
{ return _Traits::eq(__x, __y); }
|
williamr@4
|
39 |
};
|
williamr@4
|
40 |
|
williamr@4
|
41 |
template <class _Traits>
|
williamr@4
|
42 |
struct _Eq_char_bound
|
williamr@4
|
43 |
: public unary_function<typename _Traits::char_type, bool>
|
williamr@4
|
44 |
{
|
williamr@4
|
45 |
typename _Traits::char_type __val;
|
williamr@4
|
46 |
_Eq_char_bound(typename _Traits::char_type __c) : __val(__c) {}
|
williamr@4
|
47 |
bool operator()(const typename _Traits::char_type& __x) const
|
williamr@4
|
48 |
{ return _Traits::eq(__x, __val); }
|
williamr@4
|
49 |
};
|
williamr@4
|
50 |
|
williamr@4
|
51 |
template <class _Traits>
|
williamr@4
|
52 |
struct _Neq_char_bound
|
williamr@4
|
53 |
: public unary_function<typename _Traits::char_type, bool>
|
williamr@4
|
54 |
{
|
williamr@4
|
55 |
typename _Traits::char_type __val;
|
williamr@4
|
56 |
_Neq_char_bound(typename _Traits::char_type __c) : __val(__c) {}
|
williamr@4
|
57 |
bool operator()(const typename _Traits::char_type& __x) const
|
williamr@4
|
58 |
{ return !_Traits::eq(__x, __val); }
|
williamr@4
|
59 |
};
|
williamr@4
|
60 |
|
williamr@4
|
61 |
template <class _Traits>
|
williamr@4
|
62 |
struct _Eq_int_bound
|
williamr@4
|
63 |
: public unary_function<typename _Traits::char_type, bool>
|
williamr@4
|
64 |
{
|
williamr@4
|
65 |
typename _Traits::int_type __val;
|
williamr@4
|
66 |
|
williamr@4
|
67 |
_Eq_int_bound(typename _Traits::int_type __c) : __val(__c) {}
|
williamr@4
|
68 |
bool operator()(const typename _Traits::char_type& __x) const
|
williamr@4
|
69 |
{ return _Traits::eq_int_type(_Traits::to_int_type(__x), __val); }
|
williamr@4
|
70 |
};
|
williamr@4
|
71 |
|
williamr@4
|
72 |
# if 0
|
williamr@4
|
73 |
template <class _Traits>
|
williamr@4
|
74 |
struct _Lt_traits
|
williamr@4
|
75 |
: public binary_function<typename _Traits::char_type,
|
williamr@4
|
76 |
typename _Traits::char_type,
|
williamr@4
|
77 |
bool>
|
williamr@4
|
78 |
{
|
williamr@4
|
79 |
bool operator()(const typename _Traits::char_type& __x,
|
williamr@4
|
80 |
const typename _Traits::char_type& __y) const
|
williamr@4
|
81 |
{ return _Traits::lt(__x, __y); }
|
williamr@4
|
82 |
};
|
williamr@4
|
83 |
# endif
|
williamr@4
|
84 |
|
williamr@4
|
85 |
_STLP_END_NAMESPACE
|
williamr@4
|
86 |
|
williamr@4
|
87 |
#endif /* _STLP_INTERNAL_CTRAITS_FUNCTIONS_H */
|
williamr@4
|
88 |
|
williamr@4
|
89 |
// Local Variables:
|
williamr@4
|
90 |
// mode:C++
|
williamr@4
|
91 |
// End:
|
williamr@4
|
92 |
|
williamr@4
|
93 |
|
williamr@4
|
94 |
|
williamr@4
|
95 |
|