libstdc++
|
00001 // -*- C++ -*- 00002 00003 // Copyright (C) 2005, 2006, 2009, 2010 Free Software Foundation, Inc. 00004 // 00005 // This file is part of the GNU ISO C++ Library. This library is free 00006 // software; you can redistribute it and/or modify it under the terms 00007 // of the GNU General Public License as published by the Free Software 00008 // Foundation; either version 3, or (at your option) any later 00009 // version. 00010 00011 // This library is distributed in the hope that it will be useful, but 00012 // WITHOUT ANY WARRANTY; without even the implied warranty of 00013 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 00014 // General Public License for more details. 00015 00016 // Under Section 7 of GPL version 3, you are granted additional 00017 // permissions described in the GCC Runtime Library Exception, version 00018 // 3.1, as published by the Free Software Foundation. 00019 00020 // You should have received a copy of the GNU General Public License and 00021 // a copy of the GCC Runtime Library Exception along with this program; 00022 // see the files COPYING3 and COPYING.RUNTIME respectively. If not, see 00023 // <http://www.gnu.org/licenses/>. 00024 00025 // Copyright (C) 2004 Ami Tavory and Vladimir Dreizin, IBM-HRL. 00026 00027 // Permission to use, copy, modify, sell, and distribute this software 00028 // is hereby granted without fee, provided that the above copyright 00029 // notice appears in all copies, and that both that copyright notice 00030 // and this permission notice appear in supporting documentation. None 00031 // of the above authors, nor IBM Haifa Research Laboratories, make any 00032 // representation about the suitability of this software for any 00033 // purpose. It is provided "as is" without express or implied 00034 // warranty. 00035 00036 /** 00037 * @file point_iterator.hpp 00038 * Contains an iterator class returned by the tables' find and insert 00039 * methods. 00040 */ 00041 00042 /// Find type iterator. 00043 class point_iterator_ 00044 { 00045 public: 00046 /// Category. 00047 typedef trivial_iterator_tag iterator_category; 00048 00049 /// Difference type. 00050 typedef trivial_iterator_difference_type difference_type; 00051 00052 /// Iterator's value type. 00053 typedef value_type_ value_type; 00054 00055 /// Iterator's pointer type. 00056 typedef pointer_ pointer; 00057 00058 /// Iterator's const pointer type. 00059 typedef const_pointer_ const_pointer; 00060 00061 /// Iterator's reference type. 00062 typedef reference_ reference; 00063 00064 /// Iterator's const reference type. 00065 typedef const_reference_ const_reference; 00066 00067 /// Default constructor. 00068 inline 00069 point_iterator_() 00070 : m_p_value(0) 00071 { } 00072 00073 /// Copy constructor. 00074 inline 00075 point_iterator_(const point_iterator_& other) 00076 : m_p_value(other.m_p_value) 00077 { } 00078 00079 /// Access. 00080 pointer 00081 operator->() const 00082 { 00083 _GLIBCXX_DEBUG_ASSERT(m_p_value != 0); 00084 return (m_p_value); 00085 } 00086 00087 /// Access. 00088 reference 00089 operator*() const 00090 { 00091 _GLIBCXX_DEBUG_ASSERT(m_p_value != 0); 00092 return (*m_p_value); 00093 } 00094 00095 /// Compares content to a different iterator object. 00096 bool 00097 operator==(const point_iterator_& other) const 00098 { return m_p_value == other.m_p_value; } 00099 00100 /// Compares content to a different iterator object. 00101 bool 00102 operator==(const point_const_iterator_& other) const 00103 { return m_p_value == other.m_p_value; } 00104 00105 /// Compares content to a different iterator object. 00106 bool 00107 operator!=(const point_iterator_& other) const 00108 { return m_p_value != other.m_p_value; } 00109 00110 /// Compares content (negatively) to a different iterator object. 00111 bool 00112 operator!=(const point_const_iterator_& other) const 00113 { return m_p_value != other.m_p_value; } 00114 00115 inline 00116 point_iterator_(pointer p_value) : m_p_value(p_value) 00117 { } 00118 00119 protected: 00120 friend class point_const_iterator_; 00121 00122 friend class PB_DS_CLASS_C_DEC; 00123 00124 protected: 00125 pointer m_p_value; 00126 };