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
00041
00042
00043
00051 #ifndef WINSTL_INCL_WINSTL_CLIPBOARD_HPP_CLIPBOARD_FORMAT_SEQUENCE
00052 #define WINSTL_INCL_WINSTL_CLIPBOARD_HPP_CLIPBOARD_FORMAT_SEQUENCE
00053
00054 #ifndef STLSOFT_DOCUMENTATION_SKIP_SECTION
00055 # define WINSTL_VER_WINSTL_CLIPBOARD_HPP_CLIPBOARD_FORMAT_SEQUENCE_MAJOR 4
00056 # define WINSTL_VER_WINSTL_CLIPBOARD_HPP_CLIPBOARD_FORMAT_SEQUENCE_MINOR 0
00057 # define WINSTL_VER_WINSTL_CLIPBOARD_HPP_CLIPBOARD_FORMAT_SEQUENCE_REVISION 3
00058 # define WINSTL_VER_WINSTL_CLIPBOARD_HPP_CLIPBOARD_FORMAT_SEQUENCE_EDIT 32
00059 #endif
00060
00061
00062
00063
00064
00065 #ifndef WINSTL_INCL_WINSTL_H_WINSTL
00066 # include <winstl/winstl.h>
00067 #endif
00068 #ifndef STLSOFT_INCL_STLSOFT_COLLECTIONS_UTIL_HPP_COLLECTIONS
00069 # include <stlsoft/collections/util/collections.hpp>
00070 #endif
00071 #ifndef STLSOFT_INCL_STLSOFT_UTIL_STD_HPP_ITERATOR_HELPER
00072 # include <stlsoft/util/std/iterator_helper.hpp>
00073 #endif
00074
00075
00076
00077
00078
00079 #ifndef _WINSTL_NO_NAMESPACE
00080 # if defined(_STLSOFT_NO_NAMESPACE) || \
00081 defined(STLSOFT_DOCUMENTATION_SKIP_SECTION)
00082
00083 namespace winstl
00084 {
00085 # else
00086
00087
00088 namespace stlsoft
00089 {
00090
00091 namespace winstl_project
00092 {
00093
00094 # endif
00095 #endif
00096
00097
00098
00099
00100
00101
00132 class clipboard_format_sequence
00133 : public stlsoft_ns_qual(stl_collection_tag)
00134 {
00137 public:
00139 typedef clipboard_format_sequence class_type;
00141 typedef UINT value_type;
00143 typedef ws_size_t size_type;
00145 typedef ws_ptrdiff_t difference_type;
00147
00150 public:
00152 clipboard_format_sequence()
00153 : m_bOpen(::OpenClipboard(NULL) != FALSE)
00154 {}
00155
00157 ~clipboard_format_sequence() stlsoft_throw_0()
00158 {
00159 if(m_bOpen)
00160 {
00161 ::CloseClipboard();
00162 }
00163 }
00165
00168 public:
00170 class const_iterator
00171 : public stlsoft_ns_qual(iterator_base)<winstl_ns_qual_std(input_iterator_tag)
00172 , value_type
00173 , ws_ptrdiff_t
00174 , void
00175 , value_type
00176 >
00177 {
00178 friend class clipboard_format_sequence;
00179
00180 public:
00182 typedef const_iterator class_type;
00184 typedef clipboard_format_sequence container_type;
00185
00188 private:
00190 const_iterator(UINT nextFmt)
00191 : m_nextFmt(nextFmt)
00192 {}
00193 public:
00195 const_iterator()
00196 : m_nextFmt(0)
00197 {}
00199 const_iterator(class_type const& rhs)
00200 : m_nextFmt(rhs.m_nextFmt)
00201 {}
00202
00204 class_type& operator =(class_type const& rhs)
00205 {
00206 m_nextFmt = rhs.m_nextFmt;
00207
00208 return *this;
00209 }
00210
00212
00213 public:
00215 class_type& operator ++()
00216 {
00217 WINSTL_MESSAGE_ASSERT("Incrementing an invalid iterator!", m_nextFmt != 0);
00218
00219 m_nextFmt = ::EnumClipboardFormats(m_nextFmt);
00220
00221 return *this;
00222 }
00224 class_type operator ++(int)
00225 {
00226 class_type ret(*this);
00227
00228 operator ++();
00229
00230 return ret;
00231 }
00232
00233 value_type operator *() const
00234 {
00235 WINSTL_MESSAGE_ASSERT("Dereferencing an invalid iterator!", m_nextFmt != 0);
00236
00237 return m_nextFmt;
00238 }
00239
00245 ws_bool_t operator ==(class_type const& rhs) const
00246 {
00247 return m_nextFmt == rhs.m_nextFmt;
00248 }
00249
00255 ws_bool_t operator !=(class_type const& rhs) const
00256 {
00257 return !operator ==(rhs);
00258 }
00259
00261 private:
00262 UINT m_nextFmt;
00263 };
00264
00268 const_iterator begin() const
00269 {
00270 return const_iterator(::EnumClipboardFormats(0));
00271 }
00275 const_iterator end() const
00276 {
00277 return const_iterator(0);
00278 }
00279
00281 ws_bool_t empty() const
00282 {
00283 return begin() != end();
00284 }
00285
00287 size_type size() const
00288 {
00289 return static_cast<size_type>(::CountClipboardFormats());
00290 }
00291
00295 ws_bool_t inaccessible() const
00296 {
00297 return !m_bOpen;
00298 }
00300
00303 private:
00304 ws_bool_t m_bOpen;
00306
00309 private:
00310 clipboard_format_sequence(clipboard_format_sequence const&);
00311 clipboard_format_sequence& operator =(clipboard_format_sequence const&);
00313 };
00314
00315
00316
00317 #ifndef _WINSTL_NO_NAMESPACE
00318 # if defined(_STLSOFT_NO_NAMESPACE) || \
00319 defined(STLSOFT_DOCUMENTATION_SKIP_SECTION)
00320 }
00321 # else
00322 }
00323 }
00324 # endif
00325 #endif
00326
00327
00328
00329 #endif
00330
00331