00001 /* ///////////////////////////////////////////////////////////////////////// 00002 * File: dotnetstl/dotnetstl.hpp 00003 * 00004 * Purpose: Root header for the .netSTL libraries. Performs various compiler 00005 * and platform discriminations, and definitions of types. 00006 * 00007 * Created: 12th May 2003 00008 * Updated: 10th August 2009 00009 * 00010 * Home: http://stlsoft.org/ 00011 * 00012 * Copyright (c) 2003-2009, Matthew Wilson and Synesis Software 00013 * All rights reserved. 00014 * 00015 * Redistribution and use in source and binary forms, with or without 00016 * modification, are permitted provided that the following conditions are met: 00017 * 00018 * - Redistributions of source code must retain the above copyright notice, this 00019 * list of conditions and the following disclaimer. 00020 * - Redistributions in binary form must reproduce the above copyright notice, 00021 * this list of conditions and the following disclaimer in the documentation 00022 * and/or other materials provided with the distribution. 00023 * - Neither the name(s) of Matthew Wilson and Synesis Software nor the names of 00024 * any contributors may be used to endorse or promote products derived from 00025 * this software without specific prior written permission. 00026 * 00027 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" 00028 * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 00029 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 00030 * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE 00031 * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR 00032 * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF 00033 * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS 00034 * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN 00035 * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) 00036 * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE 00037 * POSSIBILITY OF SUCH DAMAGE. 00038 * 00039 * ////////////////////////////////////////////////////////////////////// */ 00040 00041 00042 #ifndef DOTNETSTL_INCL_DOTNETSTL_HPP_DOTNETSTL 00043 #define DOTNETSTL_INCL_DOTNETSTL_HPP_DOTNETSTL 00044 #define DOTNETSTL_INCL_H_DOTNETSTL 00045 00046 /* File version */ 00047 #ifndef STLSOFT_DOCUMENTATION_SKIP_SECTION 00048 # define DOTNETSTL_VER_DOTNETSTL_HPP_DOTNETSTL_MAJOR 3 00049 # define DOTNETSTL_VER_DOTNETSTL_HPP_DOTNETSTL_MINOR 4 00050 # define DOTNETSTL_VER_DOTNETSTL_HPP_DOTNETSTL_REVISION 2 00051 # define DOTNETSTL_VER_DOTNETSTL_HPP_DOTNETSTL_EDIT 50 00052 #endif /* !STLSOFT_DOCUMENTATION_SKIP_SECTION */ 00053 00059 /* ///////////////////////////////////////////////////////////////////////// 00060 * .netSTL version 00061 * 00062 * The libraries version information is comprised of major, minor and revision 00063 * components. 00064 * 00065 * The major version is denoted by the DOTNETSTL_VER_MAJOR preprocessor symbol. 00066 * A changes to the major version component implies that a dramatic change has 00067 * occurred in the libraries, such that considerable changes to source dependent 00068 * on previous versions would need to be effected. 00069 * 00070 * The minor version is denoted by the DOTNETSTL_VER_MINOR preprocessor symbol. 00071 * Changes to the minor version component imply that a significant change has 00072 * occurred to the libraries, either in the addition of new functionality or in 00073 * the destructive change to one or more components such that recomplilation and 00074 * code change may be necessitated. 00075 * 00076 * The revision version is denoted by the DOTNETSTL_VER_REVISION preprocessor 00077 * symbol. Changes to the revision version component imply that a bug has been 00078 * fixed. Dependent code should be recompiled in order to pick up the changes. 00079 * 00080 * In addition to the individual version symbols - DOTNETSTL_VER_MAJOR, 00081 * DOTNETSTL_VER_MINOR and DOTNETSTL_VER_REVISION - a composite symbol DOTNETSTL_VER 00082 * is defined, where the upper 8 bits are 0, bits 16-23 represent the major 00083 * component, bits 8-15 represent the minor component, and bits 0-7 represent 00084 * the revision component. 00085 * 00086 * Each release of the libraries will bear a different version, and that version 00087 * will also have its own symbol: Version 1.0.1 specifies DOTNETSTL_VER_1_0_1. 00088 * 00089 * Thus the symbol DOTNETSTL_VER may be compared meaningfully with a specific 00090 * version symbol, e.g. #if DOTNETSTL_VER >= DOTNETSTL_VER_1_0_1 00091 */ 00092 00109 #ifndef STLSOFT_DOCUMENTATION_SKIP_SECTION 00110 # define DOTNETSTL_VER_1_0_1 0x00010001 00111 # define DOTNETSTL_VER_1_1_1 0x00010101 00112 # define DOTNETSTL_VER_1_1_2 0x00010102 00113 # define DOTNETSTL_VER_1_2_1 0x00010201 00114 # define DOTNETSTL_VER_1_2_2 0x00010202 00115 # define DOTNETSTL_VER_1_2_3 0x00010203 00116 # define DOTNETSTL_VER_1_3_1 0x00010301 00117 # define DOTNETSTL_VER_1_3_2 0x00010302 00118 #endif /* !STLSOFT_DOCUMENTATION_SKIP_SECTION */ 00119 00120 #define DOTNETSTL_VER_MAJOR 1 00121 #define DOTNETSTL_VER_MINOR 3 00122 #define DOTNETSTL_VER_REVISION 2 00123 #define DOTNETSTL_VER DOTNETSTL_VER_1_3_2 00124 00125 /* ///////////////////////////////////////////////////////////////////////// 00126 * Includes 00127 */ 00128 00129 #ifndef STLSOFT_INCL_STLSOFT_H_STLSOFT 00130 # include <stlsoft/stlsoft.h> 00131 #endif /* !STLSOFT_INCL_STLSOFT_H_STLSOFT */ 00132 00133 /* ///////////////////////////////////////////////////////////////////////// 00134 * STLSoft version compatibility 00135 */ 00136 00137 #if !defined(_STLSOFT_VER_1_9_1_B41) || \ 00138 _STLSOFT_VER < _STLSOFT_VER_1_9_1_B41 00139 # error This version of the .netSTL libraries requires STLSoft version 1.9.1 beta 41, or later 00140 #endif /* _STLSOFT_VER */ 00141 00142 /* ///////////////////////////////////////////////////////////////////////// 00143 * Compiler compatibility 00144 * 00145 * Currently the only compilers supported by the .netSTL libraries are 00146 * 00147 * Borland C++ 5.5, 5.51, 5.6 00148 * Digital Mars C/C++ 8.26 - 8.32 00149 * Metrowerks 2.4 & 3.0 (CodeWarrior 7.0 & 8.0) 00150 * Intel C/C++ 6.0 00151 * Visual C++ 5.0, 6.0, 7.0 00152 */ 00153 00154 #if defined(STLSOFT_COMPILER_IS_MSVC) 00155 /* Visual C++ */ 00156 # if _MSC_VER < 1300 00157 # error Versions of Visual C++ prior to 7.0 are not supported by the .netSTL libraries 00158 # endif /* compiler */ 00159 00160 #else /* ? compiler */ 00161 /* No recognised compiler */ 00162 # ifdef _STLSOFT_FORCE_ANY_COMPILER 00163 # define DOTNETSTL_COMPILER_IS_UNKNOWN 00164 # ifdef _STLSOFT_COMPILE_VERBOSE 00165 # pragma message("Compiler is unknown to .netSTL") 00166 # endif /* _STLSOFT_COMPILE_VERBOSE */ 00167 # else /* ? _STLSOFT_FORCE_ANY_COMPILER */ 00168 # error Currently only Visual C++ compilers are supported by the .netSTL libraries 00169 # endif /* _STLSOFT_FORCE_ANY_COMPILER */ 00170 #endif /* compiler */ 00171 00172 /* ///////////////////////////////////////////////////////////////////////// 00173 * More includes 00174 */ 00175 00176 //#if _MSC_VER >= 1300 00177 # using <mscorlib.dll> 00178 //#else /* ? _MSC_VER */ 00179 //# using <system.dll> 00180 //#endif /* _MSC_VER */ 00181 00182 /* ///////////////////////////////////////////////////////////////////////// 00183 * Contract Enforcement 00184 * 00185 * The macro dotnetstl_assert provides standard debug-mode assert functionality. 00186 */ 00187 00194 #define DOTNETSTL_ASSERT(expr) STLSOFT_ASSERT(expr) 00195 00203 #define DOTNETSTL_MESSAGE_ASSERT(msg, expr) STLSOFT_MESSAGE_ASSERT(msg, expr) 00204 00211 #define DOTNETSTL_STATIC_ASSERT(expr) STLSOFT_STATIC_ASSERT(expr) 00212 00213 00214 #ifndef STLSOFT_DOCUMENTATION_SKIP_SECTION 00215 # define dotnetstl_assert(expr) DOTNETSTL_ASSERT(expr) 00216 # define dotnetstl_message_assert(msg, expr) DOTNETSTL_MESSAGE_ASSERT(msg, expr) 00217 # define dotnetstl_static_assert(expr) DOTNETSTL_STATIC_ASSERT(expr) 00218 #endif /* !STLSOFT_DOCUMENTATION_SKIP_SECTION */ 00219 00220 /* ///////////////////////////////////////////////////////////////////////// 00221 * Namespace 00222 * 00223 * The .netSTL components are contained within the dotnetstl namespace. This is 00224 * usually an alias for stlsoft::dotnetstl_project, 00225 * 00226 * When compilers support namespaces they are defined by default. They can be 00227 * undefined using a cascasing system, as follows: 00228 * 00229 * DOTNETSTL_NO_NAMESPACES may not be defined. 00230 * 00231 * If _STLSOFT_NO_NAMESPACE is defined (whence the namespace stlsoft does not 00232 * exist), then the .netSTL constructs are defined within the dotnetstl 00233 * namespace. The definition matrix is as follows: 00234 * 00235 * _STLSOFT_NO_NAMESPACE dotnetstl definition 00236 * --------------------- ----------------- 00237 * not defined = stlsoft::dotnetstl_project 00238 * defined dotnetstl 00239 * 00240 * The macro dotnetstl_ns_qual() macro can be used to refer to elements in the 00241 * .netSTL libraries irrespective of whether they are in the 00242 * stlsoft::dotnetstl_project or dotnetstl namespaces. 00243 * 00244 * Furthermore, some compilers do not support the standard library in the std 00245 * namespace, so the dotnetstl_ns_qual_std() macro can be used to refer to elements 00246 * in the .netSTL libraries irrespective of whether they are in the std namespace 00247 * or in the global namespace. 00248 */ 00249 00250 /* Cannot define .netSTL entities within the global namespace */ 00251 #if defined(DOTNETSTL_NO_NAMESPACE) 00252 # error .netSTL constructs cannot be defined to be in the global namespace 00253 #endif /* DOTNETSTL_NO_NAMESPACE */ 00254 00255 00256 #ifdef _STLSOFT_NO_NAMESPACE 00257 /* There is no stlsoft namespace, so must define ::dotnetstl */ 00261 namespace dotnetstl 00262 { 00263 # else 00264 /* Define stlsoft::dotnetstl_project */ 00265 00266 namespace stlsoft 00267 { 00268 00269 namespace dotnetstl_project 00270 { 00271 00272 #endif /* _STLSOFT_NO_NAMESPACE */ 00273 00282 #define dotnetstl_ns_qual(x) ::dotnetstl::x 00283 #define dotnetstl_ns_using(x) using ::dotnetstl::x; 00284 00293 #ifdef STLSOFT_CF_std_NAMESPACE 00294 # define dotnetstl_ns_qual_std(x) ::std::x 00295 # define dotnetstl_ns_using_std(x) using ::std::x; 00296 #else /* ? STLSOFT_CF_std_NAMESPACE */ 00297 # define dotnetstl_ns_qual_std(x) x 00298 # define dotnetstl_ns_using_std(x) 00299 #endif /* !STLSOFT_CF_std_NAMESPACE */ 00300 00301 /* ///////////////////////////////////////////////////////////////////////// 00302 * CLR / VC++ versions 00303 */ 00304 00305 #if defined(_MSC_VER) && \ 00306 _MSC_VER >= 1400 00307 # define DOTNETSTL_HAT_SYNTAX_SUPPORT 00308 #else /* ? _MSC_VER */ 00309 #endif /* _MSC_VER */ 00310 00311 /* ///////////////////////////////////////////////////////////////////////// 00312 * Typedefs 00313 * 00314 * The .netSTL uses a number of typedefs to aid in compiler-independence in the 00315 * libraries' main code. 00316 */ 00317 00318 #ifndef STLSOFT_DOCUMENTATION_SKIP_SECTION 00319 00320 typedef stlsoft_ns_qual(ss_char_a_t) ds_char_a_t; 00321 typedef stlsoft_ns_qual(ss_char_w_t) ds_char_w_t; 00322 typedef stlsoft_ns_qual(ss_sint8_t) ds_sint8_t; 00323 typedef stlsoft_ns_qual(ss_uint8_t) ds_uint8_t; 00324 typedef stlsoft_ns_qual(ss_int16_t) ds_int16_t; 00325 typedef stlsoft_ns_qual(ss_sint16_t) ds_sint16_t; 00326 typedef stlsoft_ns_qual(ss_uint16_t) ds_uint16_t; 00327 typedef stlsoft_ns_qual(ss_int32_t) ds_int32_t; 00328 typedef stlsoft_ns_qual(ss_sint32_t) ds_sint32_t; 00329 typedef stlsoft_ns_qual(ss_uint32_t) ds_uint32_t; 00330 #ifdef STLSOFT_CF_64BIT_INT_SUPPORT 00331 typedef stlsoft_ns_qual(ss_int64_t) ds_int64_t; 00332 typedef stlsoft_ns_qual(ss_sint64_t) ds_sint64_t; 00333 typedef stlsoft_ns_qual(ss_uint64_t) ds_uint64_t; 00334 #endif /* STLSOFT_CF_64BIT_INT_SUPPORT */ 00335 typedef stlsoft_ns_qual(ss_int_t) ds_int_t; 00336 typedef stlsoft_ns_qual(ss_sint_t) ds_sint_t; 00337 typedef stlsoft_ns_qual(ss_uint_t) ds_uint_t; 00338 typedef stlsoft_ns_qual(ss_long_t) ds_long_t; 00339 typedef stlsoft_ns_qual(ss_bool_t) ds_bool_t; 00340 typedef stlsoft_ns_qual(ss_size_t) ds_size_t; 00341 typedef stlsoft_ns_qual(ss_ptrdiff_t) ds_ptrdiff_t; 00342 typedef stlsoft_ns_qual(ss_streampos_t) ds_streampos_t; 00343 typedef stlsoft_ns_qual(ss_streamoff_t) ds_streamoff_t; 00344 00345 #endif /* !STLSOFT_DOCUMENTATION_SKIP_SECTION */ 00346 00347 /* ///////////////////////////////////////////////////////////////////////// 00348 * Values 00349 * 00350 * Since the boolean type may not be supported natively on all compilers, the 00351 * values of true and false may also not be provided. Hence the values of 00352 * ds_true_v and ds_false_v are defined, and are used in all code. 00353 */ 00354 00355 #ifndef STLSOFT_DOCUMENTATION_SKIP_SECTION 00356 00357 #define ds_true_v ss_true_v 00358 #define ds_false_v ss_false_v 00359 00360 #endif /* !STLSOFT_DOCUMENTATION_SKIP_SECTION */ 00361 /* ///////////////////////////////////////////////////////////////////////// 00362 * Code modification macros 00363 */ 00364 00365 #ifndef STLSOFT_DOCUMENTATION_SKIP_SECTION 00366 /* Exception signatures. */ 00367 # define dotnetstl_throw_0() stlsoft_throw_0() 00368 # define dotnetstl_throw_1(x1) stlsoft_throw_1(x1) 00369 # define dotnetstl_throw_2(x1, x2) stlsoft_throw_2(x1, x2) 00370 # define dotnetstl_throw_3(x1, x2, x3) stlsoft_throw_3(x1, x2, x3) 00371 # define dotnetstl_throw_4(x1, x2, x3, x4) stlsoft_throw_4(x1, x2, x3, x4) 00372 # define dotnetstl_throw_5(x1, x2, x3, x4, x5) stlsoft_throw_5(x1, x2, x3, x4, x5) 00373 # define dotnetstl_throw_6(x1, x2, x3, x4, x5, x6) stlsoft_throw_6(x1, x2, x3, x4, x5, x6) 00374 # define dotnetstl_throw_7(x1, x2, x3, x4, x5, x6, x7) stlsoft_throw_7(x1, x2, x3, x4, x5, x6, x7) 00375 # define dotnetstl_throw_8(x1, x2, x3, x4, x5, x6, x7, x8) stlsoft_throw_8(x1, x2, x3, x4, x5, x6, x7, x8) 00376 #endif /* !STLSOFT_DOCUMENTATION_SKIP_SECTION */ 00377 00378 #ifndef STLSOFT_DOCUMENTATION_SKIP_SECTION 00379 # define DOTNETSTL_NUM_ELEMENTS(ar) STLSOFT_NUM_ELEMENTS(ar) 00380 # define dotnetstl_num_elements(ar) DOTNETSTL_NUM_ELEMENTS(ar) 00381 #endif /* !STLSOFT_DOCUMENTATION_SKIP_SECTION */ 00382 00387 #define dotnetstl_destroy_instance(t, _type, p) STLSOFT_DESTROY_INSTANCE(t, _type, p) 00388 00393 #define dotnetstl_gen_opaque(_htype) STLSOFT_GEN_OPAQUE(_htype) 00394 00395 /* ////////////////////////////////////////////////////////////////////// */ 00396 00397 #ifndef DOTNETSTL_NO_NAMESPACE 00398 # if defined(_STLSOFT_NO_NAMESPACE) || \ 00399 defined(STLSOFT_DOCUMENTATION_SKIP_SECTION) 00400 } // namespace dotnetstl 00401 # else 00402 } // namespace dotnetstl_project 00403 } // namespace stlsoft 00404 namespace dotnetstl = ::stlsoft::dotnetstl_project; 00405 # endif /* _STLSOFT_NO_NAMESPACE */ 00406 #endif /* !DOTNETSTL_NO_NAMESPACE */ 00407 00408 /* ///////////////////////////////////////////////////////////////////////// 00409 * Inclusion 00410 */ 00411 00412 #ifdef STLSOFT_CF_PRAGMA_ONCE_SUPPORT 00413 # pragma once 00414 #endif /* STLSOFT_CF_PRAGMA_ONCE_SUPPORT */ 00415 00416 /* ////////////////////////////////////////////////////////////////////// */ 00417 00418 #endif /* DOTNETSTL_INCL_DOTNETSTL_HPP_DOTNETSTL */ 00419 00420 /* ///////////////////////////// end of file //////////////////////////// */