00001 /* ///////////////////////////////////////////////////////////////////////// 00002 * File: mfcstl/collections/clist_traits.hpp 00003 * 00004 * Purpose: Definition of the CList_traits traits class. 00005 * 00006 * Created: 1st December 2002 00007 * Updated: 10th August 2009 00008 * 00009 * Home: http://stlsoft.org/ 00010 * 00011 * Copyright (c) 2002-2009, Matthew Wilson and Synesis Software 00012 * All rights reserved. 00013 * 00014 * Redistribution and use in source and binary forms, with or without 00015 * modification, are permitted provided that the following conditions are met: 00016 * 00017 * - Redistributions of source code must retain the above copyright notice, this 00018 * list of conditions and the following disclaimer. 00019 * - Redistributions in binary form must reproduce the above copyright notice, 00020 * this list of conditions and the following disclaimer in the documentation 00021 * and/or other materials provided with the distribution. 00022 * - Neither the name(s) of Matthew Wilson and Synesis Software nor the names of 00023 * any contributors may be used to endorse or promote products derived from 00024 * this software without specific prior written permission. 00025 * 00026 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" 00027 * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 00028 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 00029 * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE 00030 * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR 00031 * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF 00032 * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS 00033 * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN 00034 * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) 00035 * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE 00036 * POSSIBILITY OF SUCH DAMAGE. 00037 * 00038 * ////////////////////////////////////////////////////////////////////// */ 00039 00040 00047 #ifndef MFCSTL_INCL_MFCSTL_COLLECTIONS_HPP_CLIST_TRAITS 00048 #define MFCSTL_INCL_MFCSTL_COLLECTIONS_HPP_CLIST_TRAITS 00049 00050 #ifndef STLSOFT_DOCUMENTATION_SKIP_SECTION 00051 # define MFCSTL_VER_MFCSTL_COLLECTIONS_HPP_CLIST_TRAITS_MAJOR 3 00052 # define MFCSTL_VER_MFCSTL_COLLECTIONS_HPP_CLIST_TRAITS_MINOR 0 00053 # define MFCSTL_VER_MFCSTL_COLLECTIONS_HPP_CLIST_TRAITS_REVISION 1 00054 # define MFCSTL_VER_MFCSTL_COLLECTIONS_HPP_CLIST_TRAITS_EDIT 57 00055 #endif /* !STLSOFT_DOCUMENTATION_SKIP_SECTION */ 00056 00057 /* ///////////////////////////////////////////////////////////////////////// 00058 * Includes 00059 */ 00060 00061 #ifndef MFCSTL_INCL_MFCSTL_HPP_MFCSTL 00062 # include <mfcstl/mfcstl.hpp> 00063 #endif /* !MFCSTL_INCL_MFCSTL_HPP_MFCSTL */ 00064 #if defined(STLSOFT_CF_TEMPLATE_PARTIAL_SPECIALISATION_SUPPORT) && \ 00065 !defined(MFCSTL_NO_INCLUDE_AFXTEMPL_BY_DEFAULT) 00066 # include <afxtempl.h> 00067 #endif /* STLSOFT_CF_TEMPLATE_PARTIAL_SPECIALISATION_SUPPORT && !MFCSTL_NO_INCLUDE_AFXTEMPL_BY_DEFAULT */ 00068 00069 #ifdef STLSOFT_UNITTEST 00070 # include <stlsoft/meta/is_same_type.hpp> 00071 #endif /* STLSOFT_UNITTEST */ 00072 00073 /* ///////////////////////////////////////////////////////////////////////// 00074 * Namespace 00075 */ 00076 00077 #ifndef _MFCSTL_NO_NAMESPACE 00078 # if defined(_STLSOFT_NO_NAMESPACE) || \ 00079 defined(STLSOFT_DOCUMENTATION_SKIP_SECTION) 00080 /* There is no stlsoft namespace, so must define ::mfcstl */ 00081 namespace mfcstl 00082 { 00083 # else 00084 /* Define stlsoft::mfcstl_project */ 00085 00086 namespace stlsoft 00087 { 00088 00089 namespace mfcstl_project 00090 { 00091 00092 # endif /* _STLSOFT_NO_NAMESPACE */ 00093 #endif /* !_MFCSTL_NO_NAMESPACE */ 00094 00095 /* ///////////////////////////////////////////////////////////////////////// 00096 * Pre-processor options 00097 * 00098 * Because the CObList, CPtrList, CStringList and CList<,> implementations all 00099 * internally represent their logical position indicators (of type POSTION) as 00100 * pointers to the nodes within the lists, it is workable to be able to copy 00101 * these position variables. 00102 * 00103 * However, nothing in the MFC documentation stipulates this to be a reliable 00104 * and documented part of the classes' interfaces, so this is a potentially 00105 * unsafe assumption. 00106 * 00107 * Therefore, the iterator model for the CList class is Input Iterator. 00108 * If you wish to use forward iterators, you may specify the pre-processor 00109 * symbol _MFCSTL_LIST_ADAPTOR_ENABLE_FWD_ITERATOR, in which case the iterator 00110 * classes will implement copy semantics, rather than the default move 00111 * semantics. 00112 */ 00113 00114 /* ///////////////////////////////////////////////////////////////////////// 00115 * Classes 00116 */ 00117 00118 #ifdef STLSOFT_DOCUMENTATION_SKIP_SECTION 00119 00127 template <ss_typename_param_k C> 00128 struct CList_traits 00129 { 00131 typedef ???? value_type; 00133 typedef ???? arg_type; 00135 typedef ???? list_type; 00136 }; 00137 00138 #else /* ? STLSOFT_DOCUMENTATION_SKIP_SECTION */ 00139 00140 template <ss_typename_param_k C> 00141 struct CList_traits; 00142 00143 STLSOFT_TEMPLATE_SPECIALISATION 00144 struct CList_traits<CObList> 00145 { 00146 typedef CObject* value_type; 00147 typedef CObject* arg_type; 00148 typedef CObList list_type; 00149 }; 00150 00151 // For CPtrList 00152 00153 STLSOFT_TEMPLATE_SPECIALISATION 00154 struct CList_traits<CPtrList> 00155 { 00156 typedef void* value_type; 00157 typedef void* arg_type; 00158 typedef CPtrList list_type; 00159 }; 00160 00161 // For CStringList 00162 00163 STLSOFT_TEMPLATE_SPECIALISATION 00164 struct CList_traits<CStringList> 00165 { 00166 typedef CString value_type; 00167 # if 0 00168 typedef CString const& arg_type; 00169 # else /* ? 0 */ 00170 typedef LPCTSTR arg_type; 00171 # endif /* 0 */ 00172 typedef CStringList list_type; 00173 }; 00174 00175 // For CList<, > 00176 00177 # if defined(__AFXTEMPL_H__) && \ 00178 defined(STLSOFT_CF_TEMPLATE_PARTIAL_SPECIALISATION_SUPPORT) 00179 /* If your translator supports partial template specialisation, then you 00180 * should be fine with the following specialisation, otherwise you will need 00181 * to provide your own traits class, e.g 00182 * 00183 * struct my_traits_type 00184 * { 00185 * typedef MyValType value_type; 00186 * typedef MyValType const& arg_type; 00187 * }; 00188 */ 00189 00190 template <class V, class A> 00191 struct CList_traits<CList<V, A> > 00192 { 00193 typedef V value_type; 00194 typedef A arg_type; 00195 typedef CList<V, A> list_type; 00196 }; 00197 00198 # endif /* __AFXTEMPL_H__ && STLSOFT_CF_TEMPLATE_PARTIAL_SPECIALISATION_SUPPORT */ 00199 #endif /* STLSOFT_DOCUMENTATION_SKIP_SECTION */ 00200 00205 template< ss_typename_param_k V 00206 , ss_typename_param_k A 00207 , ss_typename_param_k C 00208 > 00209 struct CList_specific_traits 00210 { 00211 typedef V value_type; 00212 typedef A arg_type; 00213 typedef C list_type; 00214 }; 00215 00217 // Unit-testing 00218 00219 #ifdef STLSOFT_UNITTEST 00220 # include "./unittest/clist_traits_unittest_.h" 00221 #endif /* STLSOFT_UNITTEST */ 00222 00223 /* ////////////////////////////////////////////////////////////////////// */ 00224 00225 #ifndef _MFCSTL_NO_NAMESPACE 00226 # if defined(_STLSOFT_NO_NAMESPACE) || \ 00227 defined(STLSOFT_DOCUMENTATION_SKIP_SECTION) 00228 } /* namespace mfcstl */ 00229 # else 00230 } /* namespace mfcstl_project */ 00231 } /* namespace stlsoft */ 00232 # endif /* _STLSOFT_NO_NAMESPACE */ 00233 #endif /* !_MFCSTL_NO_NAMESPACE */ 00234 00235 /* ////////////////////////////////////////////////////////////////////// */ 00236 00237 #endif /* !MFCSTL_INCL_MFCSTL_COLLECTIONS_HPP_CLIST_TRAITS */ 00238 00239 /* ///////////////////////////// end of file //////////////////////////// */