00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024
00025
00026
00027
00028
00029
00030
00031
00032
00033
00034
00035
00036
00037
00038
00039
00040
00047 #ifndef WINSTL_INCL_WINSTL_CONTROLS_HPP_LISTBOX_DATA_CONST_ITERATOR
00048 #define WINSTL_INCL_WINSTL_CONTROLS_HPP_LISTBOX_DATA_CONST_ITERATOR
00049
00050 #ifndef STLSOFT_DOCUMENTATION_SKIP_SECTION
00051 # define WINSTL_VER_WINSTL_CONTROLS_HPP_LISTBOX_DATA_CONST_ITERATOR_MAJOR 1
00052 # define WINSTL_VER_WINSTL_CONTROLS_HPP_LISTBOX_DATA_CONST_ITERATOR_MINOR 1
00053 # define WINSTL_VER_WINSTL_CONTROLS_HPP_LISTBOX_DATA_CONST_ITERATOR_REVISION 1
00054 # define WINSTL_VER_WINSTL_CONTROLS_HPP_LISTBOX_DATA_CONST_ITERATOR_EDIT 5
00055 #endif
00056
00057
00058
00059
00060
00061
00062
00063
00064
00065
00066
00067
00068
00069
00070
00071 #ifndef WINSTL_INCL_WINSTL_H_WINSTL
00072 # include <winstl/winstl.h>
00073 #endif
00074 #ifndef WINSTL_INCL_WINSTL_MEMORY_HPP_PROCESSHEAP_ALLOCATOR
00075 # include <winstl/memory/processheap_allocator.hpp>
00076 #endif
00077 #ifndef STLSOFT_INCL_STLSOFT_ERROR_HPP_EXTERNAL_ITERATOR_INVALIDATION
00078 # include <stlsoft/error/external_iterator_invalidation.hpp>
00079 #endif
00080 #ifndef STLSOFT_INCL_STLSOFT_UTIL_STD_HPP_ITERATOR_HELPER
00081 # include <stlsoft/util/std/iterator_helper.hpp>
00082 #endif
00083
00084
00085
00086
00087
00088 #ifndef _WINSTL_NO_NAMESPACE
00089 # if defined(_STLSOFT_NO_NAMESPACE) || \
00090 defined(STLSOFT_DOCUMENTATION_SKIP_SECTION)
00091
00092 namespace winstl
00093 {
00094 # else
00095
00096
00097 namespace stlsoft
00098 {
00099
00100 namespace winstl_project
00101 {
00102
00103 # endif
00104 #endif
00105
00106
00107
00108
00109
00119 template <ss_typename_param_k CT>
00120 class listbox_data_const_iterator
00121 : public stlsoft_ns_qual(iterator_base)<winstl_ns_qual_std(random_access_iterator_tag)
00122 , DWORD
00123 , ws_ptrdiff_t
00124 , void
00125 , DWORD
00126 >
00127 {
00130 public:
00132 typedef DWORD value_type;
00134 typedef listbox_data_const_iterator<CT> class_type;
00136 typedef ws_size_t size_type;
00138 typedef ws_ptrdiff_t difference_type;
00140 typedef value_type const const_reference;
00141 #if defined(STLSOFT_LF_BIDIRECTIONAL_ITERATOR_SUPPORT)
00151 typedef stlsoft_ns_qual(const_reverse_iterator_base)< class_type
00152 , value_type
00153 , value_type
00154 , void
00155 , difference_type
00156 > const_reverse_iterator_type;
00157 #endif
00159 typedef CT control_traits_type;
00161
00164 public:
00166 listbox_data_const_iterator(HWND hwndListBox, int index)
00167 : m_hwnd(hwndListBox)
00168 , m_index(index)
00169 {}
00171
00174 public:
00176 const_reference operator *() const
00177 {
00178 return get_value_at_(m_hwnd, m_index);
00179 }
00180
00182 class_type& operator ++()
00183 {
00184 ++m_index;
00185
00186 return *this;
00187 }
00188
00190 class_type operator ++(int)
00191 {
00192 class_type ret(*this);
00193
00194 operator ++();
00195
00196 return ret;
00197 }
00198
00200 difference_type compare(class_type const& rhs) const
00201 {
00202 WINSTL_MESSAGE_ASSERT("invalid comparison between iterators from different ranges", (m_hwnd == rhs.m_hwnd || NULL == m_hwnd || NULL == rhs.m_hwnd));
00203
00204 return m_index - rhs.m_index;
00205 }
00206
00208 bool operator == (class_type const& rhs) const
00209 {
00210 return 0 == compare(rhs);
00211 }
00212
00214 bool operator != (class_type const& rhs) const
00215 {
00216 return 0 != compare(rhs);
00217 }
00219
00222 public:
00224 class_type& operator --()
00225 {
00226 --m_index;
00227
00228 return *this;
00229 }
00230
00232 class_type operator --(int)
00233 {
00234 class_type ret(*this);
00235
00236 operator --();
00237
00238 return ret;
00239 }
00241
00244 public:
00246 class_type& operator +=(difference_type index)
00247 {
00248 m_index += index;
00249
00250 return *this;
00251 }
00252
00254 class_type& operator -=(difference_type index)
00255 {
00256 m_index -= index;
00257
00258 return *this;
00259 }
00260
00262 value_type operator [](difference_type index) const
00263 {
00264
00265 return get_value_at_(m_hwnd, m_index + index);
00266 }
00267
00269 difference_type distance(class_type const& rhs) const
00270 {
00271 return m_index - rhs.m_index;
00272 }
00273
00275 class_type operator -(difference_type n) const
00276 {
00277 return class_type(*this) -= n;
00278 }
00279
00281 class_type operator +(difference_type n) const
00282 {
00283 return class_type(*this) += n;
00284 }
00285
00287 difference_type operator -(class_type const& rhs) const
00288 {
00289 return distance(rhs);
00290 }
00291
00293 ws_bool_t operator <(class_type const& rhs) const
00294 {
00295 return compare(rhs) < 0;
00296 }
00297
00299 ws_bool_t operator >(class_type const& rhs) const
00300 {
00301 return compare(rhs) > 0;
00302 }
00303
00305 ws_bool_t operator <=(class_type const& rhs) const
00306 {
00307 return compare(rhs) <= 0;
00308 }
00309
00311 ws_bool_t operator >=(class_type const& rhs) const
00312 {
00313 return compare(rhs) >= 0;
00314 }
00316
00319 public:
00320 static value_type get_value_at_(HWND hwnd, difference_type index)
00321 {
00322 WINSTL_MESSAGE_ASSERT("Invalid index", index >= 0);
00323
00324 return control_traits_type::get_data(hwnd, index);
00325 }
00327
00330 private:
00331 HWND m_hwnd;
00332 int m_index;
00334 };
00335
00336
00337
00338 #ifndef _WINSTL_NO_NAMESPACE
00339 # if defined(_STLSOFT_NO_NAMESPACE) || \
00340 defined(STLSOFT_DOCUMENTATION_SKIP_SECTION)
00341 }
00342 # else
00343 }
00344 }
00345 # endif
00346 #endif
00347
00348
00349
00350 #endif
00351
00352