00001 /* ///////////////////////////////////////////////////////////////////////// 00002 * File: comstl/functional/type_functionals.hpp 00003 * 00004 * Purpose: Type-specific predicates and functions. 00005 * 00006 * Created: 14th June 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 00048 #ifndef COMSTL_INCL_COMSTL_FUNCTIONAL_HPP_TYPE_FUNCTIONALS 00049 #define COMSTL_INCL_COMSTL_FUNCTIONAL_HPP_TYPE_FUNCTIONALS 00050 00051 #ifndef STLSOFT_DOCUMENTATION_SKIP_SECTION 00052 # define COMSTL_VER_COMSTL_FUNCTIONAL_HPP_TYPE_FUNCTIONALS_MAJOR 4 00053 # define COMSTL_VER_COMSTL_FUNCTIONAL_HPP_TYPE_FUNCTIONALS_MINOR 0 00054 # define COMSTL_VER_COMSTL_FUNCTIONAL_HPP_TYPE_FUNCTIONALS_REVISION 2 00055 # define COMSTL_VER_COMSTL_FUNCTIONAL_HPP_TYPE_FUNCTIONALS_EDIT 65 00056 #endif /* !STLSOFT_DOCUMENTATION_SKIP_SECTION */ 00057 00058 /* ///////////////////////////////////////////////////////////////////////// 00059 * Auto-generation and compatibility 00060 */ 00061 00062 /* 00063 [Incompatibilies-start] 00064 [Incompatibilies-end] 00065 STLSOFT_COMPILER_IS_GCC: __GNUC__ < 3 || (__GNUC__ == 3 && __GNUC_MINOR__ < 4) 00066 */ 00067 00068 /* ///////////////////////////////////////////////////////////////////////// 00069 * Includes 00070 */ 00071 00072 #ifndef COMSTL_INCL_COMSTL_H_COMSTL 00073 # include <comstl/comstl.h> 00074 #endif /* !COMSTL_INCL_COMSTL_H_COMSTL */ 00075 00076 #ifndef STLSOFT_INCL_FUNCTIONAL 00077 # define STLSOFT_INCL_FUNCTIONAL 00078 # include <functional> 00079 #endif /* !STLSOFT_INCL_FUNCTIONAL */ 00080 00081 /* ///////////////////////////////////////////////////////////////////////// 00082 * Namespace 00083 */ 00084 00085 #ifndef _COMSTL_NO_NAMESPACE 00086 # if defined(_STLSOFT_NO_NAMESPACE) || \ 00087 defined(STLSOFT_DOCUMENTATION_SKIP_SECTION) 00088 /* There is no stlsoft namespace, so must define ::comstl */ 00089 namespace comstl 00090 { 00091 # else 00092 /* Define stlsoft::comstl_project */ 00093 00094 namespace stlsoft 00095 { 00096 00097 namespace comstl_project 00098 { 00099 00100 # endif /* _STLSOFT_NO_NAMESPACE */ 00101 #endif /* !_COMSTL_NO_NAMESPACE */ 00102 00103 /* ///////////////////////////////////////////////////////////////////////// 00104 * Functionals 00105 */ 00106 00114 // [[synesis:class:unary-functor: BSTR_close]] 00115 struct BSTR_close 00116 : public comstl_ns_qual_std(unary_function)<BSTR, void> 00117 { 00121 void operator ()(BSTR s) const 00122 { 00123 ::SysFreeString(s); 00124 } 00125 }; 00126 00134 // [[synesis:class:unary-functor: olestring_close]] 00135 struct olestring_close 00136 : public comstl_ns_qual_std(unary_function)<LPOLESTR, void> 00137 { 00141 void operator ()(LPOLESTR s) const 00142 { 00143 ::CoTaskMemFree(s); 00144 } 00145 }; 00146 00154 // [[synesis:class:unary-functor: task_memory_close]] 00155 struct task_memory_close 00156 : public comstl_ns_qual_std(unary_function)<void *, void> 00157 { 00161 void operator ()(void *p) const 00162 { 00163 ::CoTaskMemFree(p); 00164 } 00165 }; 00166 00174 // [[synesis:class:unary-functor: VARIANT_close]] 00175 struct VARIANT_close 00176 : public comstl_ns_qual_std(unary_function)<VARIANT&, void> 00177 { 00181 void operator ()(VARIANT &v) const 00182 { 00183 ::VariantClear(&v); 00184 } 00185 }; 00186 00188 // Unit-testing 00189 00190 #ifdef STLSOFT_UNITTEST 00191 # include "./unittest/type_functionals_unittest_.h" 00192 #endif /* STLSOFT_UNITTEST */ 00193 00194 /* ////////////////////////////////////////////////////////////////////// */ 00195 00196 #ifndef _COMSTL_NO_NAMESPACE 00197 # if defined(_STLSOFT_NO_NAMESPACE) || \ 00198 defined(STLSOFT_DOCUMENTATION_SKIP_SECTION) 00199 } // namespace comstl 00200 # else 00201 } // namespace comstl_project 00202 } // namespace stlsoft 00203 # endif /* _STLSOFT_NO_NAMESPACE */ 00204 #endif /* !_COMSTL_NO_NAMESPACE */ 00205 00206 /* ////////////////////////////////////////////////////////////////////// */ 00207 00208 #endif /* !COMSTL_INCL_COMSTL_FUNCTIONAL_HPP_TYPE_FUNCTIONALS */ 00209 00210 /* ///////////////////////////// end of file //////////////////////////// */