_map.h

00001 /*
00002  * Copyright (c) 1999, 2000
00003  * Boris Fomitchev
00004  *
00005  * This material is provided "as is", with absolutely no warranty expressed
00006  * or implied. Any use is at your own risk.
00007  *
00008  * Permission to use or copy this software for any purpose is hereby granted 
00009  * without fee, provided the above notices are retained on all copies.
00010  * Permission to modify the code and to distribute modified code is granted,
00011  * provided the above notices are retained, and a notice that the code was
00012  * modified is included with the above copyright notice.
00013  *
00014  */
00015 
00016 /* NOTE: This is an internal header file, included by other STL headers.
00017  *   You should not attempt to use it directly.
00018  */
00019 
00020 #ifndef _STLP_INTERNAL_WRAP_MAP_H
00021 #define _STLP_INTERNAL_WRAP_MAP_H
00022 
00023 #ifndef _STLP_INTERNAL_MAP_H
00024 # include <stl/_map.h>
00025 #endif
00026 
00027 # ifdef _STLP_USE_NAMESPACES
00028 namespace STLPORT { 
00029 # endif
00030 
00031 #  if defined (_STLP_MINIMUM_DEFAULT_TEMPLATE_PARAMS)
00032 #   define __MAP_TEMPLATE_HEADER  template <class _Key, class _Tp>
00033 #   define __MAP_ARGUMENTS        _Key, _Tp
00034 #   define __MMAP_TEMPLATE_HEADER  template <class _Key, class _Tp>
00035 #   define __MMAP_ARGUMENTS        _Key, _Tp
00036 #   define _Compare less<_Key>
00037 #  else
00038 #   define __MAP_TEMPLATE_HEADER  template <class _Key, class _Tp, class _Compare >
00039 #   define __MAP_ARGUMENTS        _Key, _Tp, _Compare
00040 #   define __MMAP_TEMPLATE_HEADER  template <class _Key, class _Tp, class _Compare >
00041 #   define __MMAP_ARGUMENTS        _Key, _Tp, _Compare
00042 #  endif
00043 
00044 
00045 #  define __MAP_SUPER  __map< _Key, _Tp, _Compare, _STLP_DEFAULT_PAIR_ALLOCATOR(const _Key, _Tp) >
00046 #  define __MMAP_SUPER  __multimap< _Key, _Tp, _Compare, _STLP_DEFAULT_PAIR_ALLOCATOR(const _Key, _Tp) >
00047 
00048 // provide a "default" map adaptor
00049 __MAP_TEMPLATE_HEADER
00050 class map : public __MAP_SUPER
00051 {
00052   typedef map< __MAP_ARGUMENTS > _Self;
00053 public:
00054     typedef __MAP_SUPER _Super;
00055     __IMPORT_WITH_REVERSE_ITERATORS(_Super)
00056     __IMPORT_SUPER_COPY_ASSIGNMENT(map, _Self, __MAP_SUPER)
00057     map() : __MAP_SUPER(_Compare()) {}
00058     explicit map(const _Compare& __comp) : __MAP_SUPER(__comp) {}
00059     map(const typename _Super::value_type* __first, 
00060         const typename _Super::value_type* __last) : 
00061       __MAP_SUPER(__first, __last, _Compare()) { }
00062     map(const typename _Super::value_type* __first, 
00063         const typename _Super::value_type* __last, 
00064         const _Compare& __comp) : __MAP_SUPER(__first, __last, __comp) { }
00065     map(typename _Super::const_iterator __first, 
00066         typename _Super::const_iterator __last) : 
00067         __MAP_SUPER(__first, __last, _Compare()) { }
00068     map(typename _Super::const_iterator __first, 
00069         typename _Super::const_iterator __last, 
00070         const _Compare& __comp) : __MAP_SUPER(__first, __last, __comp) { }
00071 };
00072 
00073 #  if defined (_STLP_BASE_MATCH_BUG)
00074 __MAP_TEMPLATE_HEADER
00075 inline bool operator==(const map< __MAP_ARGUMENTS >& __x, 
00076                        const map< __MAP_ARGUMENTS >& __y) {
00077   typedef __MAP_SUPER _Super;
00078   return operator==((const _Super&)__x,(const _Super&)__y);
00079 }
00080 
00081 __MAP_TEMPLATE_HEADER
00082 inline bool operator<(const map< __MAP_ARGUMENTS >& __x, 
00083                       const map< __MAP_ARGUMENTS >& __y) {
00084   typedef __MAP_SUPER _Super;
00085   return operator < ((const _Super&)__x,(const _Super&)__y);
00086 }
00087 #  endif /* _STLP_BASE_MATCH_BUG */
00088 
00089 
00090 // provide a "default" multimap adaptor
00091 __MMAP_TEMPLATE_HEADER
00092 class multimap : public __MMAP_SUPER
00093 {
00094   typedef multimap< __MMAP_ARGUMENTS > _Self;
00095 public:
00096     typedef __MMAP_SUPER  _Super;
00097     __IMPORT_WITH_REVERSE_ITERATORS(_Super)
00098     // copy & assignment from super
00099     __IMPORT_SUPER_COPY_ASSIGNMENT(multimap, _Self, __MMAP_SUPER)
00100     multimap() : __MMAP_SUPER(_Compare()) {}
00101     explicit multimap(const _Compare& __comp) : __MMAP_SUPER(__comp) {}
00102     multimap(const typename _Super::value_type* __first, 
00103              const typename _Super::value_type* __last) : 
00104         __MMAP_SUPER(__first, __last, _Compare()) { }
00105     multimap(const typename _Super::value_type* __first,
00106              const typename _Super::value_type* __last, 
00107              const _Compare& __comp) : __MMAP_SUPER(__first, __last, __comp) { }
00108     multimap(typename _Super::const_iterator __first, 
00109              typename _Super::const_iterator __last) : 
00110       __MMAP_SUPER(__first, __last, _Compare()) { }
00111     multimap(typename _Super::const_iterator __first, 
00112              typename _Super::const_iterator __last, 
00113              const _Compare& __comp) : __MMAP_SUPER(__first, __last, __comp) { }
00114 };
00115 
00116 #  if defined (_STLP_BASE_MATCH_BUG)
00117 __MMAP_TEMPLATE_HEADER
00118 inline bool operator==(const multimap< __MMAP_ARGUMENTS >& __x, 
00119                        const multimap< __MMAP_ARGUMENTS >& __y) {
00120   typedef __MMAP_SUPER  _Super;
00121   return (const _Super&)__x == (const _Super&)__y;
00122 }
00123 
00124 __MMAP_TEMPLATE_HEADER
00125 inline bool operator<(const multimap< __MMAP_ARGUMENTS >& __x, 
00126                       const multimap< __MMAP_ARGUMENTS >& __y) {
00127   typedef __MMAP_SUPER  _Super;
00128   return (const _Super&)__x < (const _Super&)__y;
00129 }
00130 #  endif
00131 
00132 # undef __MMAP_TEMPLATE_HEADER
00133 # undef __MMAP_ARGUMENTS
00134 # undef __MMAP_SUPER
00135 
00136 # undef __MAP_TEMPLATE_HEADER
00137 # undef __MAP_ARGUMENTS
00138 # undef __MAP_SUPER
00139 
00140 # undef _Compare
00141 
00142 # ifdef _STLP_USE_NAMESPACES
00143 } /* namespace STLPORT */
00144 # endif
00145 
00146 #endif /* _STLP_INTERNAL_WRAP_MAP_H */
00147 
00148 // Local Variables:
00149 // mode:C++
00150 // End:

Generated on Mon Jun 5 10:20:46 2006 for Intelligence.kdevelop by  doxygen 1.4.6