00001 /* ///////////////////////////////////////////////////////////////////////// 00002 * File: mfcstl/mfcstl.hpp 00003 * 00004 * Purpose: Root header for the MFCSTL libraries. Performs various 00005 * compiler and platform discriminations, and definitions of 00006 * types. 00007 * 00008 * Created: 15th January 2002 00009 * Updated: 10th August 2009 00010 * 00011 * Thanks: To Cl�udio Albuquerque for suggesting the inclusion of 00012 * atlstr.h. 00013 * 00014 * Home: http://stlsoft.org/ 00015 * 00016 * Copyright (c) 2002-2009, Matthew Wilson and Synesis Software 00017 * All rights reserved. 00018 * 00019 * Redistribution and use in source and binary forms, with or without 00020 * modification, are permitted provided that the following conditions are met: 00021 * 00022 * - Redistributions of source code must retain the above copyright notice, this 00023 * list of conditions and the following disclaimer. 00024 * - Redistributions in binary form must reproduce the above copyright notice, 00025 * this list of conditions and the following disclaimer in the documentation 00026 * and/or other materials provided with the distribution. 00027 * - Neither the name(s) of Matthew Wilson and Synesis Software nor the names of 00028 * any contributors may be used to endorse or promote products derived from 00029 * this software without specific prior written permission. 00030 * 00031 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" 00032 * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 00033 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 00034 * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE 00035 * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR 00036 * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF 00037 * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS 00038 * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN 00039 * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) 00040 * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE 00041 * POSSIBILITY OF SUCH DAMAGE. 00042 * 00043 * ////////////////////////////////////////////////////////////////////// */ 00044 00045 00046 #ifndef MFCSTL_INCL_MFCSTL_HPP_MFCSTL 00047 #define MFCSTL_INCL_MFCSTL_HPP_MFCSTL 00048 #define MFCSTL_INCL_H_MFCSTL /* Define the old header include guard */ 00049 00050 /* File version */ 00051 #ifndef STLSOFT_DOCUMENTATION_SKIP_SECTION 00052 # define MFCSTL_VER_MFCSTL_HPP_MFCSTL_MAJOR 3 00053 # define MFCSTL_VER_MFCSTL_HPP_MFCSTL_MINOR 4 00054 # define MFCSTL_VER_MFCSTL_HPP_MFCSTL_REVISION 3 00055 # define MFCSTL_VER_MFCSTL_HPP_MFCSTL_EDIT 92 00056 #endif /* !STLSOFT_DOCUMENTATION_SKIP_SECTION */ 00057 00063 /* ///////////////////////////////////////////////////////////////////////// 00064 * MFCSTL version 00065 * 00066 * The libraries version information is comprised of major, minor and revision 00067 * components. 00068 * 00069 * The major version is denoted by the _MFCSTL_VER_MAJOR preprocessor symbol. 00070 * A changes to the major version component implies that a dramatic change has 00071 * occurred in the libraries, such that considerable changes to source dependent 00072 * on previous versions would need to be effected. 00073 * 00074 * The minor version is denoted by the _MFCSTL_VER_MINOR preprocessor symbol. 00075 * Changes to the minor version component imply that a significant change has 00076 * occurred to the libraries, either in the addition of new functionality or in 00077 * the destructive change to one or more components such that recomplilation and 00078 * code change may be necessitated. 00079 * 00080 * The revision version is denoted by the _MFCSTL_VER_REVISION preprocessor 00081 * symbol. Changes to the revision version component imply that a bug has been 00082 * fixed. Dependent code should be recompiled in order to pick up the changes. 00083 * 00084 * In addition to the individual version symbols - _MFCSTL_VER_MAJOR, 00085 * _MFCSTL_VER_MINOR and _MFCSTL_VER_REVISION - a composite symbol _MFCSTL_VER 00086 * is defined, where the upper 8 bits are 0, bits 16-23 represent the major 00087 * component, bits 8-15 represent the minor component, and bits 0-7 represent 00088 * the revision component. 00089 * 00090 * Each release of the libraries will bear a different version, and that version 00091 * will also have its own symbol: Version 1.0.1 specifies _MFCSTL_VER_1_0_1. 00092 * 00093 * Thus the symbol _MFCSTL_VER may be compared meaningfully with a specific 00094 * version symbol, e.g. #if _MFCSTL_VER >= _MFCSTL_VER_1_0_1 00095 */ 00096 00113 #ifndef STLSOFT_DOCUMENTATION_SKIP_SECTION 00114 # define _MFCSTL_VER_1_0_1 0x00010001 00115 # define _MFCSTL_VER_1_1_1 0x00010101 00116 # define _MFCSTL_VER_1_2_1 0x00010201 00117 # define _MFCSTL_VER_1_2_2 0x00010202 00118 # define _MFCSTL_VER_1_2_3 0x00010203 00119 # define _MFCSTL_VER_1_3_1 0x00010301 00120 # define _MFCSTL_VER_1_3_2 0x00010302 00121 # define _MFCSTL_VER_1_3_3 0x00010303 00122 # define _MFCSTL_VER_1_3_4 0x00010304 00123 # define _MFCSTL_VER_1_3_5 0x00010305 00124 # define _MFCSTL_VER_1_4_1 0x00010401 00125 # define _MFCSTL_VER_1_4_2 0x00010402 00126 # define _MFCSTL_VER_1_4_3 0x00010403 00127 # define _MFCSTL_VER_1_5_1 0x00010501 00128 # define _MFCSTL_VER_1_5_2 0x00010502 00129 # define _MFCSTL_VER_1_5_3 0x00010503 00130 #endif /* !STLSOFT_DOCUMENTATION_SKIP_SECTION */ 00131 00132 #define _MFCSTL_VER_MAJOR 1 00133 #define _MFCSTL_VER_MINOR 5 00134 #define _MFCSTL_VER_REVISION 3 00135 #define _MFCSTL_VER _MFCSTL_VER_1_5_3 00136 00137 /* ///////////////////////////////////////////////////////////////////////// 00138 * Includes 00139 */ 00140 00141 #ifndef STLSOFT_INCL_STLSOFT_H_STLSOFT 00142 # include <stlsoft/stlsoft.h> 00143 #endif /* !STLSOFT_INCL_STLSOFT_H_STLSOFT */ 00144 00145 #if defined(STLSOFT_COMPILER_IS_BORLAND) 00146 # pragma warn -8022 /* Suppresses "'f()' hides virtual function 'g()'" */ 00147 # pragma warn -8084 /* Suppresses "Suggest parentheses to clarify precedence in function 'f()'" */ 00148 #endif /* compiler */ 00149 00150 #ifndef STLSOFT_INCL_H_AFX 00151 # define STLSOFT_INCL_H_AFX 00152 # include <afx.h> // MFC base header 00153 #endif /* !STLSOFT_INCL_H_AFX */ 00154 00155 #if _MFC_VER >= 0x0700 00156 # include <atlstr.h> 00157 #endif /* _MFC_VER */ 00158 00159 #if defined(STLSOFT_COMPILER_IS_BORLAND) 00160 # pragma warn .8022 /* Suppresses "'f()' hides virtual function 'g()'" */ 00161 # pragma warn .8084 /* Suppresses "Suggest parentheses to clarify precedence in function 'f()'" */ 00162 #endif /* compiler */ 00163 00164 /* ///////////////////////////////////////////////////////////////////////// 00165 * STLSoft version compatibility 00166 */ 00167 00168 #if !defined(_STLSOFT_VER_1_9_1_B41) || \ 00169 _STLSOFT_VER < _STLSOFT_VER_1_9_1_B41 00170 # error This version of the MFCSTL libraries requires STLSoft version 1.9.1 beta 41, or later 00171 #endif /* _STLSOFT_VER */ 00172 00173 /* ///////////////////////////////////////////////////////////////////////// 00174 * Compiler compatibility 00175 * 00176 * Currently the only compilers supported by the MFCSTL libraries are 00177 * 00178 * Borland C++ 5.5, 5.51, 5.6 00179 * Digital Mars C/C++ 8.26 - 8.32 00180 * Metrowerks 2.4 & 3.0 (CodeWarrior 7.0 & 8.0) 00181 * Intel C/C++ 6.0 00182 * Visual C++ 4.2, 5.0, 6.0, 7.0 00183 */ 00184 00185 #if defined(STLSOFT_COMPILER_IS_BORLAND) 00186 /* Borland C++ */ 00187 # if __BORLANDC__ < 0x0550 00188 # error Versions of Borland C++ prior to 5.5 are not supported by the MFCSTL libraries 00189 # endif /* __BORLANDC__ */ 00190 00191 #elif defined(STLSOFT_COMPILER_IS_DMC) 00192 /* Digital Mars C/C++ */ 00193 # if __DMC__ < 0x0826 00194 # error Versions of Digital Mars C/C++ prior to 8.26 are not supported by the MFCSTL libraries 00195 # endif /* __DMC__ */ 00196 00197 #elif defined(STLSOFT_COMPILER_IS_INTEL) 00198 /* Intel C++ */ 00199 # if (__INTEL_COMPILER < 600) 00200 # error Versions of Intel C++ prior to 6.0 are not supported by the MFCSTL libraries 00201 # endif /* __INTEL_COMPILER */ 00202 00203 #elif defined(STLSOFT_COMPILER_IS_MWERKS) 00204 /* Metrowerks C++ */ 00205 # if (__MWERKS__ & 0xFF00) < 0x2400 00206 # error Versions of Metrowerks CodeWarrior C++ prior to 7.0 are not supported by the MFCSTL libraries 00207 # endif /* __MWERKS__ */ 00208 00209 #elif defined(STLSOFT_COMPILER_IS_MSVC) 00210 /* Visual C++ */ 00211 # if _MSC_VER < 1020 00212 # error Versions of Visual C++ prior to 4.2 are not supported by the MFCSTL libraries 00213 # endif /* _MSC_VER */ 00214 00215 #else /* ? compiler */ 00216 /* No recognised compiler */ 00217 # ifdef _STLSOFT_FORCE_ANY_COMPILER 00218 # define _MFCSTL_COMPILER_IS_UNKNOWN 00219 # ifdef _STLSOFT_COMPILE_VERBOSE 00220 # pragma message("Compiler is unknown to MFCSTL") 00221 # endif /* _STLSOFT_COMPILE_VERBOSE */ 00222 # else /* ? _STLSOFT_FORCE_ANY_COMPILER */ 00223 # error Currently only Borland C++, Digital Mars C/C++, Intel C/C++, Metrowerks CodeWarrior and Visual C++ compilers are supported by the MFCSTL libraries 00224 # endif /* _STLSOFT_FORCE_ANY_COMPILER */ 00225 #endif /* compiler */ 00226 00227 /* ///////////////////////////////////////////////////////////////////////// 00228 * Contract Enforcement 00229 * 00230 * The macro mfcstl_assert provides standard debug-mode assert functionality. 00231 */ 00232 00239 #define MFCSTL_ASSERT(expr) STLSOFT_ASSERT(expr) 00240 00248 #define MFCSTL_MESSAGE_ASSERT(msg, expr) STLSOFT_MESSAGE_ASSERT(msg, expr) 00249 00256 #define MFCSTL_STATIC_ASSERT(expr) STLSOFT_STATIC_ASSERT(expr) 00257 00258 00259 00260 #ifndef STLSOFT_DOCUMENTATION_SKIP_SECTION 00261 # define mfcstl_assert(expr) MFCSTL_ASSERT(expr) 00262 # define mfcstl_message_assert(msg, expr) MFCSTL_MESSAGE_ASSERT(msg, expr) 00263 # define mfcstl_static_assert(expr) MFCSTL_STATIC_ASSERT(expr) 00264 #endif /* !STLSOFT_DOCUMENTATION_SKIP_SECTION */ 00265 00266 /* ///////////////////////////////////////////////////////////////////////// 00267 * Namespace 00268 * 00269 * The MFCSTL components are contained within the mfcstl namespace. This is 00270 * usually an alias for stlsoft::mfcstl_project, 00271 * 00272 * When compilers support namespaces they are defined by default. They can be 00273 * undefined using a cascasing system, as follows: 00274 * 00275 * If _STLSOFT_NO_NAMESPACES is defined, then _MFCSTL_NO_NAMESPACES is defined. 00276 * 00277 * If _MFCSTL_NO_NAMESPACES is defined, then _MFCSTL_NO_NAMESPACE is defined. 00278 * 00279 * If _MFCSTL_NO_NAMESPACE is defined, then the MFCSTL constructs are defined 00280 * in the global scope. 00281 * 00282 * If _STLSOFT_NO_NAMESPACES, _MFCSTL_NO_NAMESPACES and _MFCSTL_NO_NAMESPACE are 00283 * all undefined but the symbol _STLSOFT_NO_NAMESPACE is defined (whence the 00284 * namespace stlsoft does not exist), then the MFCSTL constructs are defined 00285 * within the mfcstl namespace. The definition matrix is as follows: 00286 * 00287 * _STLSOFT_NO_NAMESPACE _MFCSTL_NO_NAMESPACE mfcstl definition 00288 * --------------------- -------------------- ----------------- 00289 * not defined not defined = stlsoft::mfcstl_project 00290 * not defined defined not defined 00291 * defined not defined mfcstl 00292 * defined defined not defined 00293 * 00294 * 00295 * 00296 * The macro mfcstl_ns_qual() macro can be used to refer to elements in the 00297 * MFCSTL libraries irrespective of whether they are in the 00298 * stlsoft::mfcstl_project (or mfcstl) namespace or in the global namespace. 00299 * 00300 * Furthermore, some compilers do not support the standard library in the std 00301 * namespace, so the mfcstl_ns_qual_std() macro can be used to refer to elements 00302 * in the MFCSTL libraries irrespective of whether they are in the std namespace 00303 * or in the global namespace. 00304 * 00305 * 00306 * The MFC libraries themselves may or may not be defined within the MFC 00307 * namespace, so the mfcstl_ns_qual_stl() macro can be used to refer to 00308 * elements in the MFCSTL libraries irrespective of whether they are in the std 00309 * namespace or in the global namespace. 00310 */ 00311 00312 /* No STLSoft namespaces means no MFCSTL namespaces */ 00313 #ifdef _STLSOFT_NO_NAMESPACES 00314 # define _MFCSTL_NO_NAMESPACES 00315 #endif /* _STLSOFT_NO_NAMESPACES */ 00316 00317 /* No MFCSTL namespaces means no mfcstl namespace */ 00318 #ifdef _MFCSTL_NO_NAMESPACES 00319 # define _MFCSTL_NO_NAMESPACE 00320 #endif /* _MFCSTL_NO_NAMESPACES */ 00321 00322 #ifndef _MFCSTL_NO_NAMESPACE 00323 # if defined(_STLSOFT_NO_NAMESPACE) || \ 00324 defined(STLSOFT_DOCUMENTATION_SKIP_SECTION) 00325 /* There is no stlsoft namespace, so must define ::mfcstl */ 00356 namespace mfcstl 00357 { 00358 # else 00359 /* Define stlsoft::mfcstl_project */ 00360 00361 namespace stlsoft 00362 { 00363 00364 namespace mfcstl_project 00365 { 00366 00367 # endif /* _STLSOFT_NO_NAMESPACE */ 00368 #else 00369 stlsoft_ns_using(move_lhs_from_rhs) 00370 #endif /* !_MFCSTL_NO_NAMESPACE */ 00371 00380 #ifndef _MFCSTL_NO_NAMESPACE 00381 # define mfcstl_ns_qual(x) ::mfcstl::x 00382 # define mfcstl_ns_using(x) using ::mfcstl::x; 00383 #else /* ? _MFCSTL_NO_NAMESPACE */ 00384 # define mfcstl_ns_qual(x) x 00385 # define mfcstl_ns_using(x) 00386 #endif /* !_MFCSTL_NO_NAMESPACE */ 00387 00396 #ifdef STLSOFT_CF_std_NAMESPACE 00397 # define mfcstl_ns_qual_std(x) ::std::x 00398 # define mfcstl_ns_using_std(x) using ::std::x; 00399 #else /* ? STLSOFT_CF_std_NAMESPACE */ 00400 # define mfcstl_ns_qual_std(x) x 00401 # define mfcstl_ns_using_std(x) 00402 #endif /* !STLSOFT_CF_std_NAMESPACE */ 00403 00404 /* ///////////////////////////////////////////////////////////////////////// 00405 * Typedefs 00406 * 00407 * The MFCSTL uses a number of typedefs to aid in compiler-independence in the 00408 * libraries' main code. 00409 */ 00410 00411 #ifndef STLSOFT_DOCUMENTATION_SKIP_SECTION 00412 00413 typedef stlsoft_ns_qual(ss_char_a_t) ms_char_a_t; 00414 typedef stlsoft_ns_qual(ss_char_w_t) ms_char_w_t; 00415 typedef stlsoft_ns_qual(ss_sint8_t) ms_sint8_t; 00416 typedef stlsoft_ns_qual(ss_uint8_t) ms_uint8_t; 00417 typedef stlsoft_ns_qual(ss_int16_t) ms_int16_t; 00418 typedef stlsoft_ns_qual(ss_sint16_t) ms_sint16_t; 00419 typedef stlsoft_ns_qual(ss_uint16_t) ms_uint16_t; 00420 typedef stlsoft_ns_qual(ss_int32_t) ms_int32_t; 00421 typedef stlsoft_ns_qual(ss_sint32_t) ms_sint32_t; 00422 typedef stlsoft_ns_qual(ss_uint32_t) ms_uint32_t; 00423 #ifdef STLSOFT_CF_64BIT_INT_SUPPORT 00424 typedef stlsoft_ns_qual(ss_int64_t) ms_int64_t; 00425 typedef stlsoft_ns_qual(ss_sint64_t) ms_sint64_t; 00426 typedef stlsoft_ns_qual(ss_uint64_t) ms_uint64_t; 00427 #endif /* STLSOFT_CF_64BIT_INT_SUPPORT */ 00428 typedef stlsoft_ns_qual(ss_int_t) ms_int_t; 00429 typedef stlsoft_ns_qual(ss_sint_t) ms_sint_t; 00430 typedef stlsoft_ns_qual(ss_uint_t) ms_uint_t; 00431 typedef stlsoft_ns_qual(ss_long_t) ms_long_t; 00432 typedef stlsoft_ns_qual(ss_bool_t) ms_bool_t; 00433 typedef DWORD ms_dword_t; 00434 typedef stlsoft_ns_qual(ss_size_t) ms_size_t; 00435 typedef stlsoft_ns_qual(ss_ptrdiff_t) ms_ptrdiff_t; 00436 typedef stlsoft_ns_qual(ss_streampos_t) ms_streampos_t; 00437 typedef stlsoft_ns_qual(ss_streamoff_t) ms_streamoff_t; 00438 00439 #endif /* !STLSOFT_DOCUMENTATION_SKIP_SECTION */ 00440 00441 /* ///////////////////////////////////////////////////////////////////////// 00442 * Values 00443 * 00444 * Since the boolean type may not be supported natively on all compilers, the 00445 * values of true and false may also not be provided. Hence the values of 00446 * ms_true_v and ms_false_v are defined, and are used in all code. 00447 */ 00448 00449 #ifndef STLSOFT_DOCUMENTATION_SKIP_SECTION 00450 00451 #define ms_true_v ss_true_v 00452 #define ms_false_v ss_false_v 00453 00454 #endif /* !STLSOFT_DOCUMENTATION_SKIP_SECTION */ 00455 /* ///////////////////////////////////////////////////////////////////////// 00456 * Code modification macros 00457 */ 00458 00459 #ifndef STLSOFT_DOCUMENTATION_SKIP_SECTION 00460 /* Exception signatures. */ 00461 #define mfcstl_throw_0() stlsoft_throw_0() 00462 #define mfcstl_throw_1(x1) stlsoft_throw_1(x1) 00463 #define mfcstl_throw_2(x1, x2) stlsoft_throw_2(x1, x2) 00464 #define mfcstl_throw_3(x1, x2, x3) stlsoft_throw_3(x1, x2, x3) 00465 #define mfcstl_throw_4(x1, x2, x3, x4) stlsoft_throw_4(x1, x2, x3, x4) 00466 #define mfcstl_throw_5(x1, x2, x3, x4, x5) stlsoft_throw_5(x1, x2, x3, x4, x5) 00467 #define mfcstl_throw_6(x1, x2, x3, x4, x5, x6) stlsoft_throw_6(x1, x2, x3, x4, x5, x6) 00468 #define mfcstl_throw_7(x1, x2, x3, x4, x5, x6, x7) stlsoft_throw_7(x1, x2, x3, x4, x5, x6, x7) 00469 #define mfcstl_throw_8(x1, x2, x3, x4, x5, x6, x7, x8) stlsoft_throw_8(x1, x2, x3, x4, x5, x6, x7, x8) 00470 #endif /* !STLSOFT_DOCUMENTATION_SKIP_SECTION */ 00471 00472 #ifndef STLSOFT_DOCUMENTATION_SKIP_SECTION 00473 # define MFCSTL_NUM_ELEMENTS(ar) STLSOFT_NUM_ELEMENTS(ar) 00474 # define mfcstl_num_elements(ar) MFCSTL_NUM_ELEMENTS(ar) 00475 #endif /* !STLSOFT_DOCUMENTATION_SKIP_SECTION */ 00476 00481 #define mfcstl_destroy_instance(t, _type, p) STLSOFT_DESTROY_INSTANCE(t, _type, p) 00482 00487 #define mfcstl_gen_opaque(_htype) STLSOFT_GEN_OPAQUE(_htype) 00488 00489 /* ////////////////////////////////////////////////////////////////////// */ 00490 00491 #ifndef _MFCSTL_NO_NAMESPACE 00492 # if defined(_STLSOFT_NO_NAMESPACE) || \ 00493 defined(STLSOFT_DOCUMENTATION_SKIP_SECTION) 00494 } // namespace mfcstl 00495 # else 00496 } // namespace mfcstl_project 00497 } // namespace stlsoft 00498 namespace mfcstl = ::stlsoft::mfcstl_project; 00499 # endif /* _STLSOFT_NO_NAMESPACE */ 00500 #endif /* !_MFCSTL_NO_NAMESPACE */ 00501 00502 /* ///////////////////////////////////////////////////////////////////////// 00503 * Inclusion 00504 */ 00505 00506 #ifdef STLSOFT_CF_PRAGMA_ONCE_SUPPORT 00507 # pragma once 00508 #endif /* STLSOFT_CF_PRAGMA_ONCE_SUPPORT */ 00509 00510 /* ////////////////////////////////////////////////////////////////////// */ 00511 00512 #endif /* MFCSTL_INCL_MFCSTL_HPP_MFCSTL */ 00513 00514 /* ///////////////////////////// end of file //////////////////////////// */