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