Synesis Software STLSoft - ... Robust, Lightweight, Cross-platform, Template Software ...

pantheios/pantheios.hpp

Go to the documentation of this file.
00001 /* /////////////////////////////////////////////////////////////////////////
00002  * File:        pantheios/pantheios.hpp
00003  *
00004  * Purpose:     Primary header file for Pantheios
00005  *
00006  * Created:     21st June 2005
00007  * Updated:     9th January 2011
00008  *
00009  * Home:        http://www.pantheios.org/
00010  *
00011  * Copyright (c) 2005-2011, Matthew Wilson and Synesis Software
00012  * Copyright (c) 1999-2005, Synesis Software and Matthew Wilson
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
00017  * met:
00018  *
00019  * - Redistributions of source code must retain the above copyright notice,
00020  *   this list of conditions and the following disclaimer.
00021  * - Redistributions in binary form must reproduce the above copyright
00022  *   notice, this list of conditions and the following disclaimer in the
00023  *   documentation and/or other materials provided with the distribution.
00024  * - Neither the name(s) of Matthew Wilson and Synesis Software nor the
00025  *   names of any contributors may be used to endorse or promote products
00026  *   derived from this software without specific prior written permission.
00027  *
00028  * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS
00029  * IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
00030  * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
00031  * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
00032  * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
00033  * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
00034  * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
00035  * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
00036  * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
00037  * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
00038  * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
00039  *
00040  * ////////////////////////////////////////////////////////////////////// */
00041 
00042 
00054 #ifndef PANTHEIOS_INCL_PANTHEIOS_HPP_PANTHEIOS
00055 #define PANTHEIOS_INCL_PANTHEIOS_HPP_PANTHEIOS
00056 
00057 /* /////////////////////////////////////////////////////////////////////////
00058  * Version information
00059  */
00060 
00061 #ifndef PANTHEIOS_DOCUMENTATION_SKIP_SECTION
00062 # define PANTHEIOS_VER_PANTHEIOS_HPP_PANTHEIOS_MAJOR      3
00063 # define PANTHEIOS_VER_PANTHEIOS_HPP_PANTHEIOS_MINOR      9
00064 # define PANTHEIOS_VER_PANTHEIOS_HPP_PANTHEIOS_REVISION   2
00065 # define PANTHEIOS_VER_PANTHEIOS_HPP_PANTHEIOS_EDIT       102
00066 #endif /* !PANTHEIOS_DOCUMENTATION_SKIP_SECTION */
00067 
00068 /* /////////////////////////////////////////////////////////////////////////
00069  * Includes
00070  */
00071 
00072 /* Main Pantheios Header */
00073 #ifndef PANTHEIOS_INCL_PANTHEIOS_H_PANTHEIOS
00074 # include <pantheios/pantheios.h>
00075 #endif /* !PANTHEIOS_INCL_PANTHEIOS_H_PANTHEIOS */
00076 
00077 #ifndef __cplusplus
00078 # error pantheios/pantheios.hpp is only valid in C++ compilation units
00079 #endif /* !__cplusplus */
00080 
00081 /* Required to validate the parameters are not integral types */
00082 #ifndef STLSOFT_INCL_STLSOFT_META_HPP_IS_FUNDAMENTAL_TYPE
00083 # include <stlsoft/meta/is_fundamental_type.hpp>
00084 #endif /* !STLSOFT_INCL_STLSOFT_META_HPP_IS_FUNDAMENTAL_TYPE */
00085 
00086 /* Now select various headers to bring in string access shims */
00087 #ifndef STLSOFT_INCL_STLSOFT_SHIMS_ACCESS_STRING_H_FWD
00088 # include <stlsoft/shims/access/string/fwd.h>
00089 #endif /* !STLSOFT_INCL_STLSOFT_SHIMS_ACCESS_STRING_H_FWD */
00090 
00091 /* Backwards-compatibility */
00092 #ifndef PANTHEIOS_DOCUMENTATION_SKIP_SECTION
00093 # if defined(PANTHEIOS_NO_INCLUDE_STLSOFT_SHIM_ACCESS_SHIMS) && \
00094      !defined(PANTHEIOS_NO_INCLUDE_STLSOFT_STRING_ACCESS)
00095 #  ifdef STLSOFT_CF_PRAGMA_MESSAGE_SUPPORT
00096 #   pragma messsage("The symbol PANTHEIOS_NO_INCLUDE_STLSOFT_SHIM_ACCESS_SHIMS is deprecated, and support for it will be removed before 1.0.1. Please use PANTHEIOS_NO_INCLUDE_STLSOFT_STRING_ACCESS instead.")
00097 #  endif /* STLSOFT_CF_PRAGMA_MESSAGE_SUPPORT */
00098 #  define PANTHEIOS_NO_INCLUDE_STLSOFT_STRING_ACCESS
00099 # endif /* PANTHEIOS_NO_INCLUDE_STLSOFT_SHIM_ACCESS_SHIMS && !PANTHEIOS_NO_INCLUDE_STLSOFT_STRING_ACCESS */
00100 #endif /* !PANTHEIOS_DOCUMENTATION_SKIP_SECTION */
00101 
00102 
00103 
00104 #ifdef PANTHEIOS_CUSTOM_SHIM_INCLUDE
00105 # include PANTHEIOS_CUSTOM_SHIM_INCLUDE
00106 #else /* ? PANTHEIOS_CUSTOM_SHIM_INCLUDE */
00107 # if !defined(PANTHEIOS_NO_INCLUDE_STLSOFT_STRING_ACCESS)
00108 #  ifndef STLSOFT_INCL_STLSOFT_SHIMS_ACCESS_HPP_STRING
00109 #   include <stlsoft/shims/access/string.hpp>
00110 #  endif /* !STLSOFT_INCL_STLSOFT_SHIMS_ACCESS_HPP_STRING */
00111 #  ifndef STLSOFT_INCL_STLSOFT_SHIMS_ACCESS_STRING_STD_HPP_TIME
00112 #   include <stlsoft/shims/access/string/std/time.hpp>
00113 #  endif /* !STLSOFT_INCL_STLSOFT_SHIMS_ACCESS_STRING_STD_HPP_TIME */
00114 
00115 
00116 #  ifdef PANTHEIOS_NO_INCLUDE_OS_AND_3PTYLIB_STRING_ACCESS
00117 #   define PANTHEIOS_NO_INCLUDE_ACESTL_STRING_ACCESS
00118 #   define PANTHEIOS_NO_INCLUDE_ATLSTL_STRING_ACCESS
00119 #   define PANTHEIOS_NO_INCLUDE_COMSTL_STRING_ACCESS
00120 #   define PANTHEIOS_NO_INCLUDE_MFCSTL_STRING_ACCESS
00121 #   define PANTHEIOS_NO_INCLUDE_PLATFORMSTL_STRING_ACCESS
00122 #   define PANTHEIOS_NO_INCLUDE_UNIXSTL_STRING_ACCESS
00123 #   define PANTHEIOS_NO_INCLUDE_WINSTL_STRING_ACCESS
00124 #   define PANTHEIOS_NO_INCLUDE_WTLSTL_STRING_ACCESS
00125 #  endif /* PANTHEIOS_NO_INCLUDE_OS_AND_3PTYLIB_STRING_ACCESS */
00126 
00127  /* Include shims for MFC, if
00128   *
00129   *  - it's not been proscribed, by PANTHEIOS_NO_INCLUDE_MFCSTL_STRING_ACCESS, and either
00130   *      - it's been explicitly requested, by PANTHEIOS_FORCE_INCLUDE_MFCSTL_STRING_ACCESS, or
00131   *      - _AFX and _MFC_VER are defined
00132   */
00133 #  if !defined(PANTHEIOS_NO_INCLUDE_MFCSTL_STRING_ACCESS) && \
00134       (   defined(PANTHEIOS_FORCE_INCLUDE_MFCSTL_STRING_ACCESS) || \
00135           defined(_AFXDLL) || \
00136           (   defined(_AFX) && \
00137               defined(_MFC_VER)))
00138 #   ifndef MFCSTL_INCL_MFCSTL_SHIMS_ACCESS_HPP_STRING
00139 #    include <mfcstl/shims/access/string.hpp>
00140 #   endif /* !MFCSTL_INCL_MFCSTL_SHIMS_ACCESS_HPP_STRING */
00141 #  endif /* MFC */
00142 
00143  /* Include shims for ATL, if
00144   *
00145   *  - it's not been proscribed, by PANTHEIOS_NO_INCLUDE_ATLSTL_STRING_ACCESS, and either
00146   *      - it's been explicitly requested, by PANTHEIOS_FORCE_INCLUDE_ATLSTL_STRING_ACCESS, or
00147   *      - _ATL and _ATL_VER are defined
00148   */
00149 #  if !defined(PANTHEIOS_NO_INCLUDE_ATLSTL_STRING_ACCESS) && \
00150       (   defined(PANTHEIOS_FORCE_INCLUDE_ATLSTL_STRING_ACCESS) || \
00151           (   defined(_ATL) && \
00152               defined(_ATL_VER)))
00153 #   ifndef ATLSTL_INCL_ATLSTL_SHIMS_ACCESS_HPP_STRING
00154 #    include <atlstl/shims/access/string.hpp>
00155 #   endif /* !ATLSTL_INCL_ATLSTL_SHIMS_ACCESS_HPP_STRING */
00156 #  endif /* ATL */
00157 
00158  /* Include shims for COM, if
00159   *
00160   *  - it's not been proscribed, by PANTHEIOS_NO_INCLUDE_COMSTL_STRING_ACCESS, and either
00161   *      - it's been explicitly requested, by PANTHEIOS_FORCE_INCLUDE_COMSTL_STRING_ACCESS, or
00162   *      - WIN32/WIN64 is defined
00163   */
00164 #  if !defined(PANTHEIOS_NO_INCLUDE_COMSTL_STRING_ACCESS) && \
00165       (   defined(PANTHEIOS_FORCE_INCLUDE_COMSTL_STRING_ACCESS) || \
00166           defined(WIN32) || \
00167           defined(WIN64))
00168 #   ifndef COMSTL_INCL_COMSTL_SHIMS_ACCESS_HPP_STRING
00169 #    include <comstl/shims/access/string.hpp>
00170 #   endif /* !COMSTL_INCL_COMSTL_SHIMS_ACCESS_HPP_STRING */
00171 #  endif /* COM */
00172 
00173  /* Include shims for UNIX, if
00174   *
00175   *  - it's not been proscribed, by PANTHEIOS_NO_INCLUDE_UNIXSTL_STRING_ACCESS, and either
00176   *      - it's been explicitly requested, by PANTHEIOS_FORCE_INCLUDE_UNIXSTL_STRING_ACCESS, or
00177   *      - unix, __unix, __unix__ or UNIX is defined
00178   */
00179 #  if !defined(PANTHEIOS_NO_INCLUDE_UNIXSTL_STRING_ACCESS) && \
00180       (   defined(PANTHEIOS_FORCE_INCLUDE_UNIXSTL_STRING_ACCESS) || \
00181           (  defined(unix) || \
00182              defined(__unix) || \
00183              defined(__unix__) || \
00184              defined(UNIX)))
00185 #   ifndef UNIXSTL_INCL_UNIXSTL_SHIMS_ACCESS_HPP_STRING
00186 #    include <unixstl/shims/access/string.hpp>
00187 #   endif /* !UNIXSTL_INCL_UNIXSTL_SHIMS_ACCESS_HPP_STRING */
00188 #  endif /* UNIX */
00189 
00190  /* Include shims for Windows, if
00191   *
00192   *  - it's not been proscribed, by PANTHEIOS_NO_INCLUDE_WINSTL_STRING_ACCESS, and either
00193   *      - it's been explicitly requested, by PANTHEIOS_FORCE_INCLUDE_WINSTL_STRING_ACCESS, or
00194   *      - WIN32/WIN64 is defined
00195   */
00196 #  if !defined(PANTHEIOS_NO_INCLUDE_WINSTL_STRING_ACCESS) && \
00197       (   defined(PANTHEIOS_FORCE_INCLUDE_WINSTL_STRING_ACCESS) || \
00198           defined(WIN32) || \
00199           defined(WIN64))
00200 #   ifndef WINSTL_INCL_WINSTL_SHIMS_ACCESS_HPP_STRING
00201 #    include <winstl/shims/access/string.hpp>
00202 #   endif /* !WINSTL_INCL_WINSTL_SHIMS_ACCESS_HPP_STRING */
00203 #   ifndef WINSTL_INCL_WINSTL_SHIMS_ACCESS_STRING_HPP_TIME
00204 #    include <winstl/shims/access/string/time.hpp>
00205 #   endif /* !WINSTL_INCL_WINSTL_SHIMS_ACCESS_STRING_HPP_TIME */
00206 #  endif /* Win */
00207 
00208 # endif /* !PANTHEIOS_NO_INCLUDE_STLSOFT_STRING_ACCESS */
00209 #endif /* PANTHEIOS_CUSTOM_SHIM_INCLUDE */
00210 
00211 /* /////////////////////////////////////////////////////////////////////////
00212  * GCC bug
00213  */
00214 
00215 /* NOTE: We must include <pantheios/inserters.hpp> here, as GCC is a bit
00216  * thick about its two-phase name lookup when resolving shim functions for
00217  * the Pantheios inserter types integer, pointer and real.
00218  */
00219 
00220 #if defined(STLSOFT_COMPILER_IS_GCC) && \
00221     __GNUC__ < 4
00222 //# include <pantheios/inserters.hpp>
00223 #endif /* compiler */
00224 
00225 /* /////////////////////////////////////////////////////////////////////////
00226  * Namespace
00227  */
00228 
00229 #if !defined(PANTHEIOS_NO_NAMESPACE)
00230 namespace pantheios
00231 {
00232 #endif /* !PANTHEIOS_NO_NAMESPACE */
00233 
00234 /* /////////////////////////////////////////////////////////////////////////
00235  * C++ API components
00236  *
00237  * To suppress all generated functions, define the preprocessor symbol
00238  *  PANTHEIOS_NO_GENERATED_FUNCTIONS
00239  *
00240  * To suppress all log() generated functions, define the preprocessor
00241  * symbol
00242  *  PANTHEIOS_NO_LOG_FUNCTIONS
00243  *
00244  * To suppress all log-specific generated functions (i.e. log_DEBUG(),
00245  * log_CRITICAL(), etc.), define the preprocessor symbol
00246  * <code>PANTHEIOS_NO_LOG_SEV_FUNCTIONS</code>. Note: if the symbol
00247  * <code>PANTHEIOS_NO_STOCK_LEVELS</code> is defined, then
00248  * <code>PANTHEIOS_NO_LOG_SEV_FUNCTIONS</code> will be defined
00249  * automatically.
00250  */
00251 
00252 #ifdef PANTHEIOS_NO_STOCK_LEVELS
00253 # ifndef PANTHEIOS_NO_LOG_SEV_FUNCTIONS
00254 #  define PANTHEIOS_NO_LOG_SEV_FUNCTIONS
00255 # endif /* !PANTHEIOS_NO_LOG_SEV_FUNCTIONS */
00256 #endif /* PANTHEIOS_NO_STOCK_LEVELS */
00257 
00258 #ifdef PANTHEIOS_INVOKE_SHIM_PAIR_
00259 # undef PANTHEIOS_INVOKE_SHIM_PAIR_
00260 #endif /* PANTHEIOS_INVOKE_SHIM_PAIR_ */
00261 
00262 #ifdef PANTHEIOS_VALIDATE_TYPE_NOT_FUNDAMENTAL_
00263 # undef PANTHEIOS_VALIDATE_TYPE_NOT_FUNDAMENTAL_
00264 #endif /* PANTHEIOS_VALIDATE_TYPE_NOT_FUNDAMENTAL_ */
00265 
00266 /* /////////////////////////////////////////////////////////////////////////
00267  * Compiler compatibility
00268  */
00269 
00270 /* The Digital Mars and GCC compilers both exhibit strange behaviour (bugs?)
00271  * with respect to the invocation of shims.
00272  *
00273  * - DMC++ requires explicit qualification, even in the presence of a
00274  *    (local) using declaration
00275  * - GCC requires a local using declaration and *must not* have explicit
00276  *    qualification.
00277  *
00278  * - all other compilers work fine without any using declaration and with
00279  *    explicit qualification.
00280  *
00281  * As currently defined, we follow the GCC way (which works for all other
00282  * compilers, except DMC++), and explicitly qualify for DMC++.
00283  *
00284  */
00285 
00286 #ifndef PANTHEIOS_DOCUMENTATION_SKIP_SECTION
00287 
00288 # ifdef PANTHEIOS_INVOKE_c_str_data_
00289 #  undef PANTHEIOS_INVOKE_c_str_data_
00290 # endif /* PANTHEIOS_INVOKE_c_str_data_ */
00291 # ifdef PANTHEIOS_INVOKE_c_str_len_
00292 #  undef PANTHEIOS_INVOKE_c_str_len_
00293 # endif /* PANTHEIOS_INVOKE_c_str_len_ */
00294 # ifdef PANTHEIOS_INVOKE_c_str_ptr_
00295 #  undef PANTHEIOS_INVOKE_c_str_ptr_
00296 # endif /* PANTHEIOS_INVOKE_c_str_ptr_ */
00297 # ifdef PANTHEIOS_INVOKE_SHIM_PAIR_
00298 #  undef PANTHEIOS_INVOKE_SHIM_PAIR_
00299 # endif /* PANTHEIOS_INVOKE_SHIM_PAIR_ */
00300 # ifdef PANTHEIOS_c_str_data_name_
00301 #  undef PANTHEIOS_c_str_data_name_
00302 # endif /* PANTHEIOS_c_str_data_name_ */
00303 
00304 # ifdef PANTHEIOS_USE_WIDE_STRINGS
00305 #  define PANTHEIOS_c_str_data_name_                    c_str_data_w
00306 #  define PANTHEIOS_c_str_len_name_                     c_str_len_w
00307 #  define PANTHEIOS_c_str_ptr_name_                     c_str_ptr_w
00308 # else /* ? PANTHEIOS_USE_WIDE_STRINGS */               
00309 #  define PANTHEIOS_c_str_data_name_                    c_str_data_a
00310 #  define PANTHEIOS_c_str_len_name_                     c_str_len_a
00311 #  define PANTHEIOS_c_str_ptr_name_                     c_str_ptr_a
00312 # endif /* PANTHEIOS_USE_WIDE_STRINGS */                
00313                                                         
00314 # if defined(STLSOFT_COMPILER_IS_DMC)                   
00315 #  define PANTHEIOS_DECLARE_SHIM_PAIR_()                ((void)0)
00316 #  define PANTHEIOS_INVOKE_SHIM_PAIR_(x)                stlsoft::PANTHEIOS_c_str_len_name_(x), stlsoft::PANTHEIOS_c_str_data_name_(x)
00317 # elif defined(STLSOFT_COMPILER_IS_GCC)                 
00318 #  define PANTHEIOS_DECLARE_SHIM_PAIR_()                using ::stlsoft::PANTHEIOS_c_str_data_name_; using ::stlsoft::PANTHEIOS_c_str_len_name_
00319 #  define PANTHEIOS_INVOKE_SHIM_PAIR_(x)                PANTHEIOS_c_str_len_name_(x), PANTHEIOS_c_str_data_name_(x)
00320 # else /* ? compiler */                                 
00321 #  define PANTHEIOS_DECLARE_SHIM_PAIR_()                using ::stlsoft::PANTHEIOS_c_str_data_name_; using ::stlsoft::PANTHEIOS_c_str_len_name_
00322 #  define PANTHEIOS_INVOKE_SHIM_PAIR_(x)                PANTHEIOS_c_str_len_name_(x), PANTHEIOS_c_str_data_name_(x)
00323 # endif /* compiler */
00324 
00325 # define PANTHEIOS_VALIDATE_TYPE_NOT_FUNDAMENTAL_(t)    STLSOFT_STATIC_ASSERT(0 == stlsoft::is_fundamental_type<t>::value)
00326 
00327 #endif /* !PANTHEIOS_DOCUMENTATION_SKIP_SECTION */
00328 
00329 #ifndef PANTHEIOS_NO_GENERATED_FUNCTIONS
00330 # ifndef PANTHEIOS_DOCUMENTATION_SKIP_SECTION
00331 namespace internal
00332 {
00333 #  include "./internal/generated/log_dispatch_functions.h"
00334 #  include "./internal/generated/log_dispatch_functions.hpp"
00335 } /* namespace internal */
00336 # endif /* !PANTHEIOS_DOCUMENTATION_SKIP_SECTION */
00337 # if !defined(PANTHEIOS_NO_LOG_FUNCTIONS)
00338 #  include "./internal/generated/log_functions.hpp"     // log(s), log(s, s) etc etc
00339 # endif /* !PANTHEIOS_NO_LOG_FUNCTIONS */
00340 # if !defined(PANTHEIOS_NO_LOG_SEV_FUNCTIONS)
00341 #  include "./internal/generated/log_sev_functions.hpp" // log_ALERT() overloads, log_ERROR() overloads, etc.
00342 # endif /* !PANTHEIOS_NO_LOG_SEV_FUNCTIONS */
00343 #endif /* !PANTHEIOS_NO_GENERATED_FUNCTIONS */
00344 
00345 #undef PANTHEIOS_INVOKE_SHIM_PAIR_
00346 
00347 /* /////////////////////////////////////////////////////////////////////////
00348  * Namespace
00349  */
00350 
00351 #if !defined(PANTHEIOS_NO_NAMESPACE)
00352 } /* namespace pantheios */
00353 #endif /* !PANTHEIOS_NO_NAMESPACE */
00354 
00355 /* /////////////////////////////////////////////////////////////////////////
00356  * Auto-initialisation
00357  *
00358  * Except when making a DLL, this is automatic, unless PANTHEIOS_NO_AUTO_INIT
00359  * is defined.
00360  *
00361  * To force it for a DLL, define PANTHEIOS_FORCE_AUTO_INIT
00362  */
00363 
00364 #if defined(__DLL__) /* Borland, with -WD */ || \
00365     defined(_WINDLL) /* VC++, defined by user/wizard */ || \
00366     defined(_USRDLL) /* VC++, defined by user/wizard */
00367 # define PANTHEIOS_NO_AUTO_INIT
00368 #endif /* dynamic library */
00369 
00370 #if defined(PANTHEIOS_FORCE_AUTO_INIT) || \
00371     !defined(PANTHEIOS_NO_AUTO_INIT)
00372 # include "./internal/initialiser.hpp"    // Schwarz counter initialisation
00373 #endif /* PANTHEIOS_FORCE_AUTO_INIT || !PANTHEIOS_NO_AUTO_INIT */
00374 
00375 /* /////////////////////////////////////////////////////////////////////////
00376  * Inclusion
00377  */
00378 
00379 #ifdef STLSOFT_PPF_pragma_once_SUPPORT
00380 # pragma once
00381 #endif /* STLSOFT_PPF_pragma_once_SUPPORT */
00382 
00383 /* ////////////////////////////////////////////////////////////////////// */
00384 
00385 #endif /* !PANTHEIOS_INCL_PANTHEIOS_HPP_PANTHEIOS */
00386 
00387 /* ///////////////////////////// end of file //////////////////////////// */

pantheios Library documentation © Matthew Wilson & Synesis Software, 2006-2011 SourceForge.net Logo