mfc_atl.qbk 6.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148
  1. [/
  2. Copyright 2010 Neil Groves
  3. Distributed under the Boost Software License, Version 1.0.
  4. (See accompanying file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
  5. /]
  6. [def __mfc_collections__ [@http://msdn.microsoft.com/en-us/library/942860sh.aspx MFC Collection Classes]]
  7. [def __atl_collections__ [@http://msdn.microsoft.com/en-us/library/15e672bd.aspx ATL Collection Classes]]
  8. [section:mfc_atl MFC/ATL (courtesy of Shunsuke Sogame)]
  9. [h4 Introduction]
  10. This implementation was kindly donated by Shunsuke Sogame. This header adapts MFC and ATL containers to the appropriate Range concepts.
  11. [table
  12. []
  13. [[[*Author:]] [Shunsuke Sogame]]
  14. [[[*Contact:]] [mb2act@yahoo.co.jp]]
  15. [[[*Date:]] [26th of May 2006]]
  16. [[[*Copyright:]] [Shunsuke Sogame 2005-2006. Use, modification and distribution is subject to the Boost Software License, Version 1.0]]
  17. ]
  18. [h4 Overview]
  19. Boost.Range MFC/ATL Extension provides Boost.Range support for MFC/ATL collection and string types.
  20. ``
  21. CTypedPtrArray<CPtrArray, CList<CString> *> myArray;
  22. ...
  23. BOOST_FOREACH (CList<CString> *theList, myArray)
  24. {
  25. BOOST_FOREACH (CString& str, *theList)
  26. {
  27. boost::to_upper(str);
  28. std::sort(boost::begin(str), boost::end(str));
  29. ...
  30. }
  31. }
  32. ``
  33. [section:requirements Requirements]
  34. * Boost C++ Libraries Version 1.34.0 or later (no compilation required)
  35. * Visual C++ 7.1 or later (for MFC and ATL)
  36. [endsect]
  37. [section:mfc_ranges MFC Ranges]
  38. If the `<boost/range/mfc.hpp>` is included before or after Boost.Range headers, the MFC collections and strings become models of Range. The table below lists the Traversal Category and `range_reference` of MFC ranges.
  39. [table
  40. [[Range] [Traversal Category] [`range_reference<Range>::type`]]
  41. [[`CArray<T,A>`] [__random_access_range__] [`T&`]]
  42. [[`CList<T,A>`] [__bidirectional_range__] [`T&`]]
  43. [[`CMap<K,AK,M,AM>`] [__forward_range__] [`Range::CPair&`]]
  44. [[`CTypedPtrArray<B,T*>`] [__random_access_range__] [`T* const`]]
  45. [[`CTypedPtrList<B,T*>`] [__bidirectional_range__] [`T* const`]]
  46. [[`CTypedPtrMap<B,T*,V*>`] [__forward_range__] [`std::pair<T*,V*> const`]]
  47. [[`CByteArray`] [__random_access_range__] [`BYTE&`]]
  48. [[`CDWordArray`] [__random_access_range__] [`DWORD&`]]
  49. [[`CObArray`] [__random_access_range__] [`CObject*&`]]
  50. [[`CPtrArray`] [__random_access_range__] [`void*&`]]
  51. [[`CStringArray`] [__random_access_range__] [`CString&`]]
  52. [[`CUIntArray`] [__random_access_range__] [`UINT&`]]
  53. [[`CWordArray`] [__random_access_range__] [`WORD&`]]
  54. [[`CObList`] [__bidirectional_range__] [`CObject*&`]]
  55. [[`CPtrList`] [__bidirectional_range__] [`void*&`]]
  56. [[`CStringList`] [__bidirectional_range__] [`CString&`]]
  57. [[`CMapPtrToWord`] [__forward_range__] [`std::pair<void*,WORD> const`]]
  58. [[`CMapPtrToPtr`] [__forward_range__] [`std::pair<void*,void*> const`]]
  59. [[`CMapStringToOb`] [__forward_range__] [`std::pair<String,CObject*> const`]]
  60. [[`CMapStringToString`] [__forward_range__] [`Range::CPair&`]]
  61. [[`CMapWordToOb`] [__forward_range__] [`std::pair<WORD,CObject*> const`]]
  62. [[`CMapWordToPtr`] [__forward_range__] [`std::pair<WORD,void*> const`]]
  63. ]
  64. Other Boost.Range metafunctions are defined by the following. Let `Range` be any type listed above and `Ref` be the same as `range_reference<Range>::type`. `range_value<Range>::type` is the same as `remove_reference<remove_const<Ref>::type>::type`, `range_difference<Range>::type` is the same as `std::ptrdiff_t`, and `range_pointer<Range>::type` is the same as `add_pointer<remove_reference<Ref>::type>::type`. As for `const Range`, see below.
  65. Adam Walling has provided the header `<boost/range/mfc_map.hpp>` to add support
  66. for the map adaptor with MFC map types.
  67. [endsect]
  68. [section:atl_ranges ATL Ranges]
  69. If the `<boost/range/atl.hpp>` is included before or after Boost.Range headers, the ATL collections and strings become models of Range. The table below lists the Traversal Category and `range_reference` of ATL ranges.
  70. [table
  71. [[Range] [Traversal Category] [`range_reference<Range>::type`]]
  72. [[`CAtlArray<E,ET>`] [__random_access_range__] [`E&`]]
  73. [[`CAutoPtrArray<E>`] [__random_access_range__] [`E&`]]
  74. [[`CInterfaceArray<I,pi>`] [__random_access_range__] [`CComQIPtr<I,pi>&`]]
  75. [[`CAtlList<E,ET>`] [__bidirectional_range__] [`E&`]]
  76. [[`CAutoPtrList<E>`] [__bidirectional_range__] [`E&`]]
  77. [[`CHeapPtrList<E,A>`] [__bidirectional_range__] [`E&`]]
  78. [[`CInterfaceList<I,pi>`] [__bidirectional_range__] [`CComQIPtr<I,pi>&`]]
  79. [[`CAtlMap<K,V,KT,VT>`] [__forward_range__] [`Range::CPair&`]]
  80. [[`CRBTree<K,V,KT,VT>`] [__bidirectional_range__] [`Range::CPair&`]]
  81. [[`CRBMap<K,V,KT,VT>`] [__bidirectional_range__] [`Range::CPair&`]]
  82. [[`CRBMultiMap<K,V,KT,VT>`] [__bidirectional_range__] [`Range::CPair&`]]
  83. [[`CSimpleStringT<B,b>`] [__random_access_range__] [`B&`]]
  84. [[`CStringT<B,ST>`] [__random_access_range__] [`B&`]]
  85. [[`CFixedStringT<S,n>`] [__random_access_range__] [`range_reference<S>::type`]]
  86. [[`CComBSTR`] [__random_access_range__] [`OLECHAR&`]]
  87. [[`CSimpleArray<T,TE>`] [__random_access_range__] [`T&`]]
  88. ]
  89. Other __boost_range_home__ metafunctions are defined by the following. Let `Range` be any type listed above and `Ref` be the same as `range_reference<Range>::type`. `range_value<Range>::type` is the same as `remove_reference<Ref>::type`, `range_difference<Range>::type` is the same as `std::ptrdiff_t`, and `range_pointer<Range>::type` is the same as `add_pointer<remove_reference<Ref>::type>::type`. As for `const Range`, see below.
  90. [endsect]
  91. [section:const_ranges const Ranges]
  92. `range_reference<const Range>::type` is defined by the following algorithm. Let `Range` be any type listed above and `Ref` be the same as `range_reference<Range>::type`.
  93. ``
  94. if (Range is CObArray || Range is CObList)
  95. return CObject const * &
  96. else if (Range is CPtrArray || Range is CPtrList)
  97. return void const * &
  98. else if (there is a type X such that X& is the same as Ref)
  99. return X const &
  100. else if (there is a type X such that X* const is the same as Ref)
  101. return X const * const
  102. else
  103. return Ref
  104. ``
  105. Other Boost.Range metafunctions are defined by the following.
  106. [table
  107. [[Range metafunction] [Result]]
  108. [[`range_value<const Range>::type`] [`range_value<Range>::type`]]
  109. [[`range_difference<const Range>::type`] [`std::ptrdiff_t`]]
  110. [[`range_pointer<const Range>::type`] [`add_pointer<remove_reference<range_reference<const Range>::type>::type>::type`]]
  111. ]
  112. [endsect]
  113. [section:references References]
  114. # __boost_range_home__
  115. # __mfc_collections__
  116. # __atl_collections__
  117. [endsect]
  118. [endsect]