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:     23rd July 2010
00008  *
00009  * Home:        http://www.pantheios.org/
00010  *
00011  * Copyright (c) 2005-2010, 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      8
00064 # define PANTHEIOS_VER_PANTHEIOS_HPP_PANTHEIOS_REVISION   2
00065 # define PANTHEIOS_VER_PANTHEIOS_HPP_PANTHEIOS_EDIT       100
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 /* Now select various headers to bring in string access shims */
00082 #ifndef STLSOFT_INCL_STLSOFT_SHIMS_ACCESS_STRING_H_FWD
00083 # include <stlsoft/shims/access/string/fwd.h>
00084 #endif /* !STLSOFT_INCL_STLSOFT_SHIMS_ACCESS_STRING_H_FWD */
00085 
00086 /* Backwards-compatibility */
00087 #ifndef PANTHEIOS_DOCUMENTATION_SKIP_SECTION
00088 # if defined(PANTHEIOS_NO_INCLUDE_STLSOFT_SHIM_ACCESS_SHIMS) && \
00089      !defined(PANTHEIOS_NO_INCLUDE_STLSOFT_STRING_ACCESS)
00090 #  ifdef STLSOFT_CF_PRAGMA_MESSAGE_SUPPORT
00091 #   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.")
00092 #  endif /* STLSOFT_CF_PRAGMA_MESSAGE_SUPPORT */
00093 #  define PANTHEIOS_NO_INCLUDE_STLSOFT_STRING_ACCESS
00094 # endif /* PANTHEIOS_NO_INCLUDE_STLSOFT_SHIM_ACCESS_SHIMS && !PANTHEIOS_NO_INCLUDE_STLSOFT_STRING_ACCESS */
00095 #endif /* !PANTHEIOS_DOCUMENTATION_SKIP_SECTION */
00096 
00097 
00098 
00099 #ifdef PANTHEIOS_CUSTOM_SHIM_INCLUDE
00100 # include PANTHEIOS_CUSTOM_SHIM_INCLUDE
00101 #else /* ? PANTHEIOS_CUSTOM_SHIM_INCLUDE */
00102 # if !defined(PANTHEIOS_NO_INCLUDE_STLSOFT_STRING_ACCESS)
00103 #  ifndef STLSOFT_INCL_STLSOFT_SHIMS_ACCESS_HPP_STRING
00104 #   include <stlsoft/shims/access/string.hpp>
00105 #  endif /* !STLSOFT_INCL_STLSOFT_SHIMS_ACCESS_HPP_STRING */
00106 #  ifndef STLSOFT_INCL_STLSOFT_SHIMS_ACCESS_STRING_STD_HPP_TIME
00107 #   include <stlsoft/shims/access/string/std/time.hpp>
00108 #  endif /* !STLSOFT_INCL_STLSOFT_SHIMS_ACCESS_STRING_STD_HPP_TIME */
00109 
00110 
00111 # ifdef PANTHEIOS_NO_INCLUDE_OS_AND_3PTYLIB_STRING_ACCESS
00112 #  define PANTHEIOS_NO_INCLUDE_ACESTL_STRING_ACCESS
00113 #  define PANTHEIOS_NO_INCLUDE_ATLSTL_STRING_ACCESS
00114 #  define PANTHEIOS_NO_INCLUDE_COMSTL_STRING_ACCESS
00115 #  define PANTHEIOS_NO_INCLUDE_MFCSTL_STRING_ACCESS
00116 #  define PANTHEIOS_NO_INCLUDE_PLATFORMSTL_STRING_ACCESS
00117 #  define PANTHEIOS_NO_INCLUDE_UNIXSTL_STRING_ACCESS
00118 #  define PANTHEIOS_NO_INCLUDE_WINSTL_STRING_ACCESS
00119 #  define PANTHEIOS_NO_INCLUDE_WTLSTL_STRING_ACCESS
00120 # endif /* PANTHEIOS_NO_INCLUDE_OS_AND_3PTYLIB_STRING_ACCESS */
00121 
00122  /* Include shims for MFC, if
00123   *
00124   *  - it's not been proscribed, by PANTHEIOS_NO_INCLUDE_MFCSTL_STRING_ACCESS, and either
00125   *      - it's been explicitly requested, by PANTHEIOS_FORCE_INCLUDE_MFCSTL_STRING_ACCESS, or
00126   *      - _AFX and _MFC_VER are defined
00127   */
00128 #   if !defined(PANTHEIOS_NO_INCLUDE_MFCSTL_STRING_ACCESS) && \
00129        (   defined(PANTHEIOS_FORCE_INCLUDE_MFCSTL_STRING_ACCESS) || \
00130            defined(_AFXDLL) || \
00131            (   defined(_AFX) && \
00132                defined(_MFC_VER)))
00133 #   ifndef MFCSTL_INCL_MFCSTL_SHIMS_ACCESS_HPP_STRING
00134 #    include <mfcstl/shims/access/string.hpp>
00135 #   endif /* !MFCSTL_INCL_MFCSTL_SHIMS_ACCESS_HPP_STRING */
00136 #  endif /* MFC */
00137 
00138  /* Include shims for ATL, if
00139   *
00140   *  - it's not been proscribed, by PANTHEIOS_NO_INCLUDE_ATLSTL_STRING_ACCESS, and either
00141   *      - it's been explicitly requested, by PANTHEIOS_FORCE_INCLUDE_ATLSTL_STRING_ACCESS, or
00142   *      - _ATL and _ATL_VER are defined
00143   */
00144 #   if !defined(PANTHEIOS_NO_INCLUDE_ATLSTL_STRING_ACCESS) && \
00145        (   defined(PANTHEIOS_FORCE_INCLUDE_ATLSTL_STRING_ACCESS) || \
00146            (   defined(_ATL) && \
00147                defined(_ATL_VER)))
00148 #   ifndef ATLSTL_INCL_ATLSTL_SHIMS_ACCESS_HPP_STRING
00149 #    include <atlstl/shims/access/string.hpp>
00150 #   endif /* !ATLSTL_INCL_ATLSTL_SHIMS_ACCESS_HPP_STRING */
00151 #  endif /* ATL */
00152 
00153  /* Include shims for COM, if
00154   *
00155   *  - it's not been proscribed, by PANTHEIOS_NO_INCLUDE_COMSTL_STRING_ACCESS, and either
00156   *      - it's been explicitly requested, by PANTHEIOS_FORCE_INCLUDE_COMSTL_STRING_ACCESS, or
00157   *      - WIN32/WIN64 is defined
00158   */
00159 #   if !defined(PANTHEIOS_NO_INCLUDE_COMSTL_STRING_ACCESS) && \
00160        (   defined(PANTHEIOS_FORCE_INCLUDE_COMSTL_STRING_ACCESS) || \
00161            defined(WIN32) || \
00162            defined(WIN64))
00163 #   ifndef COMSTL_INCL_COMSTL_SHIMS_ACCESS_HPP_STRING
00164 #    include <comstl/shims/access/string.hpp>
00165 #   endif /* !COMSTL_INCL_COMSTL_SHIMS_ACCESS_HPP_STRING */
00166 #  endif /* COM */
00167 
00168  /* Include shims for UNIX, if
00169   *
00170   *  - it's not been proscribed, by PANTHEIOS_NO_INCLUDE_UNIXSTL_STRING_ACCESS, and either
00171   *      - it's been explicitly requested, by PANTHEIOS_FORCE_INCLUDE_UNIXSTL_STRING_ACCESS, or
00172   *      - unix, __unix, __unix__ or UNIX is defined
00173   */
00174 #   if !defined(PANTHEIOS_NO_INCLUDE_UNIXSTL_STRING_ACCESS) && \
00175        (   defined(PANTHEIOS_FORCE_INCLUDE_UNIXSTL_STRING_ACCESS) || \
00176            (  defined(unix) || \
00177               defined(__unix) || \
00178               defined(__unix__) || \
00179               defined(UNIX)))
00180 #   ifndef UNIXSTL_INCL_UNIXSTL_SHIMS_ACCESS_HPP_STRING
00181 #    include <unixstl/shims/access/string.hpp>
00182 #   endif /* !UNIXSTL_INCL_UNIXSTL_SHIMS_ACCESS_HPP_STRING */
00183 #  endif /* UNIX */
00184 
00185  /* Include shims for Windows, if
00186   *
00187   *  - it's not been proscribed, by PANTHEIOS_NO_INCLUDE_WINSTL_STRING_ACCESS, and either
00188   *      - it's been explicitly requested, by PANTHEIOS_FORCE_INCLUDE_WINSTL_STRING_ACCESS, or
00189   *      - WIN32/WIN64 is defined
00190   */
00191 #   if !defined(PANTHEIOS_NO_INCLUDE_WINSTL_STRING_ACCESS) && \
00192        (   defined(PANTHEIOS_FORCE_INCLUDE_WINSTL_STRING_ACCESS) || \
00193            defined(WIN32) || \
00194            defined(WIN64))
00195 #   ifndef WINSTL_INCL_WINSTL_SHIMS_ACCESS_HPP_STRING
00196 #    include <winstl/shims/access/string.hpp>
00197 #   endif /* !WINSTL_INCL_WINSTL_SHIMS_ACCESS_HPP_STRING */
00198 #   ifndef WINSTL_INCL_WINSTL_SHIMS_ACCESS_STRING_HPP_TIME
00199 #    include <winstl/shims/access/string/time.hpp>
00200 #   endif /* !WINSTL_INCL_WINSTL_SHIMS_ACCESS_STRING_HPP_TIME */
00201 #  endif /* Win */
00202 
00203 # endif /* !PANTHEIOS_NO_INCLUDE_STLSOFT_STRING_ACCESS */
00204 #endif /* PANTHEIOS_CUSTOM_SHIM_INCLUDE */
00205 
00206 /* /////////////////////////////////////////////////////////////////////////
00207  * GCC bug
00208  */
00209 
00210 /* NOTE: We must include <pantheios/inserters.hpp> here, as GCC is a bit
00211  * thick about its two-phase name lookup when resolving shim functions for
00212  * the Pantheios inserter types integer, pointer and real.
00213  */
00214 
00215 #if defined(STLSOFT_COMPILER_IS_GCC) && \
00216     __GNUC__ < 4
00217 //# include <pantheios/inserters.hpp>
00218 #endif /* compiler */
00219 
00220 /* /////////////////////////////////////////////////////////////////////////
00221  * Namespace
00222  */
00223 
00224 #if !defined(PANTHEIOS_NO_NAMESPACE)
00225 namespace pantheios
00226 {
00227 #endif /* !PANTHEIOS_NO_NAMESPACE */
00228 
00229 /* /////////////////////////////////////////////////////////////////////////
00230  * C++ API components
00231  *
00232  * To suppress all generated functions, define the preprocessor symbol
00233  *  PANTHEIOS_NO_GENERATED_FUNCTIONS
00234  *
00235  * To suppress all log() generated functions, define the preprocessor
00236  * symbol
00237  *  PANTHEIOS_NO_LOG_FUNCTIONS
00238  *
00239  * To suppress all log-specific generated functions (i.e. log_DEBUG(),
00240  * log_CRITICAL(), etc.), define the preprocessor symbol
00241  * <code>PANTHEIOS_NO_LOG_SEV_FUNCTIONS</code>. Note: if the symbol
00242  * <code>PANTHEIOS_NO_STOCK_LEVELS</code> is defined, then
00243  * <code>PANTHEIOS_NO_LOG_SEV_FUNCTIONS</code> will be defined
00244  * automatically.
00245  */
00246 
00247 #ifdef PANTHEIOS_NO_STOCK_LEVELS
00248 # ifndef PANTHEIOS_NO_LOG_SEV_FUNCTIONS
00249 #  define PANTHEIOS_NO_LOG_SEV_FUNCTIONS
00250 # endif /* !PANTHEIOS_NO_LOG_SEV_FUNCTIONS */
00251 #endif /* PANTHEIOS_NO_STOCK_LEVELS */
00252 
00253 #ifdef PANTHEIOS_INVOKE_SHIM_PAIR_
00254 # undef PANTHEIOS_INVOKE_SHIM_PAIR_
00255 #endif /* PANTHEIOS_INVOKE_SHIM_PAIR_ */
00256 
00257 /* /////////////////////////////////////////////////////////////////////////
00258  * Compiler compatibility
00259  */
00260 
00261 /* The Digital Mars and GCC compilers both exhibit strange behaviour (bugs?)
00262  * with respect to the invocation of shims.
00263  *
00264  * - DMC++ requires explicit qualification, even in the presence of a
00265  *    (local) using declaration
00266  * - GCC requires a local using declaration and *must not* have explicit
00267  *    qualification.
00268  *
00269  * - all other compilers work fine without any using declaration and with
00270  *    explicit qualification.
00271  *
00272  * As currently defined, we follow the GCC way (which works for all other
00273  * compilers, except DMC++), and explicitly qualify for DMC++.
00274  *
00275  */
00276 
00277 #ifndef PANTHEIOS_DOCUMENTATION_SKIP_SECTION
00278 
00279 # ifdef PANTHEIOS_INVOKE_c_str_data_
00280 #  undef PANTHEIOS_INVOKE_c_str_data_
00281 # endif /* PANTHEIOS_INVOKE_c_str_data_ */
00282 # ifdef PANTHEIOS_INVOKE_c_str_len_
00283 #  undef PANTHEIOS_INVOKE_c_str_len_
00284 # endif /* PANTHEIOS_INVOKE_c_str_len_ */
00285 # ifdef PANTHEIOS_INVOKE_c_str_ptr_
00286 #  undef PANTHEIOS_INVOKE_c_str_ptr_
00287 # endif /* PANTHEIOS_INVOKE_c_str_ptr_ */
00288 # ifdef PANTHEIOS_INVOKE_SHIM_PAIR_
00289 #  undef PANTHEIOS_INVOKE_SHIM_PAIR_
00290 # endif /* PANTHEIOS_INVOKE_SHIM_PAIR_ */
00291 # ifdef PANTHEIOS_c_str_data_name_
00292 #  undef PANTHEIOS_c_str_data_name_
00293 # endif /* PANTHEIOS_c_str_data_name_ */
00294 
00295 # ifdef PANTHEIOS_USE_WIDE_STRINGS
00296 #  define PANTHEIOS_c_str_data_name_            c_str_data_w
00297 #  define PANTHEIOS_c_str_len_name_             c_str_len_w
00298 #  define PANTHEIOS_c_str_ptr_name_             c_str_ptr_w
00299 # else /* ? PANTHEIOS_USE_WIDE_STRINGS */
00300 #  define PANTHEIOS_c_str_data_name_            c_str_data_a
00301 #  define PANTHEIOS_c_str_len_name_             c_str_len_a
00302 #  define PANTHEIOS_c_str_ptr_name_             c_str_ptr_a
00303 # endif /* PANTHEIOS_USE_WIDE_STRINGS */
00304 
00305 # if defined(STLSOFT_COMPILER_IS_DMC)
00306 #  define PANTHEIOS_DECLARE_SHIM_PAIR_()        ((void)0)
00307 #  define PANTHEIOS_INVOKE_SHIM_PAIR_(x)        stlsoft::PANTHEIOS_c_str_len_name_(x), stlsoft::PANTHEIOS_c_str_data_name_(x)
00308 # elif defined(STLSOFT_COMPILER_IS_GCC)
00309 #  define PANTHEIOS_DECLARE_SHIM_PAIR_()        using ::stlsoft::PANTHEIOS_c_str_data_name_; using ::stlsoft::PANTHEIOS_c_str_len_name_
00310 #  define PANTHEIOS_INVOKE_SHIM_PAIR_(x)        PANTHEIOS_c_str_len_name_(x), PANTHEIOS_c_str_data_name_(x)
00311 # else /* ? compiler */
00312 #  define PANTHEIOS_DECLARE_SHIM_PAIR_()        using ::stlsoft::PANTHEIOS_c_str_data_name_; using ::stlsoft::PANTHEIOS_c_str_len_name_
00313 #  define PANTHEIOS_INVOKE_SHIM_PAIR_(x)        PANTHEIOS_c_str_len_name_(x), PANTHEIOS_c_str_data_name_(x)
00314 # endif /* compiler */
00315 #endif /* !PANTHEIOS_DOCUMENTATION_SKIP_SECTION */
00316 
00317 #ifndef PANTHEIOS_NO_GENERATED_FUNCTIONS
00318 # ifndef PANTHEIOS_DOCUMENTATION_SKIP_SECTION
00319 namespace internal
00320 {
00321 #  include "./internal/generated/log_dispatch_functions.h"
00322 #  include "./internal/generated/log_dispatch_functions.hpp"
00323 } /* namespace internal */
00324 # endif /* !PANTHEIOS_DOCUMENTATION_SKIP_SECTION */
00325 # if !defined(PANTHEIOS_NO_LOG_FUNCTIONS)
00326 #  include "./internal/generated/log_functions.hpp"     // log(s), log(s, s) etc etc
00327 # endif /* !PANTHEIOS_NO_LOG_FUNCTIONS */
00328 # if !defined(PANTHEIOS_NO_LOG_SEV_FUNCTIONS)
00329 #  include "./internal/generated/log_sev_functions.hpp" // log_ALERT() overloads, log_ERROR() overloads, etc.
00330 # endif /* !PANTHEIOS_NO_LOG_SEV_FUNCTIONS */
00331 #endif /* !PANTHEIOS_NO_GENERATED_FUNCTIONS */
00332 
00333 #undef PANTHEIOS_INVOKE_SHIM_PAIR_
00334 
00335 /* /////////////////////////////////////////////////////////////////////////
00336  * Namespace
00337  */
00338 
00339 #if !defined(PANTHEIOS_NO_NAMESPACE)
00340 } /* namespace pantheios */
00341 #endif /* !PANTHEIOS_NO_NAMESPACE */
00342 
00343 /* /////////////////////////////////////////////////////////////////////////
00344  * Auto-initialisation
00345  *
00346  * Except when making a DLL, this is automatic, unless PANTHEIOS_NO_AUTO_INIT
00347  * is defined.
00348  *
00349  * To force it for a DLL, define PANTHEIOS_FORCE_AUTO_INIT
00350  */
00351 
00352 #if defined(__DLL__) /* Borland, with -WD */ || \
00353     defined(_WINDLL) /* VC++, defined by user/wizard */ || \
00354     defined(_USRDLL) /* VC++, defined by user/wizard */
00355 # define PANTHEIOS_NO_AUTO_INIT
00356 #endif /* dynamic library */
00357 
00358 #if defined(PANTHEIOS_FORCE_AUTO_INIT) || \
00359     !defined(PANTHEIOS_NO_AUTO_INIT)
00360 # include "./internal/initialiser.hpp"    // Schwarz counter initialisation
00361 #endif /* PANTHEIOS_FORCE_AUTO_INIT || !PANTHEIOS_NO_AUTO_INIT */
00362 
00363 /* /////////////////////////////////////////////////////////////////////////
00364  * Inclusion
00365  */
00366 
00367 #ifdef STLSOFT_PPF_pragma_once_SUPPORT
00368 # pragma once
00369 #endif /* STLSOFT_PPF_pragma_once_SUPPORT */
00370 
00371 /* ////////////////////////////////////////////////////////////////////// */
00372 
00373 #endif /* !PANTHEIOS_INCL_PANTHEIOS_HPP_PANTHEIOS */
00374 
00375 /* ///////////////////////////// end of file //////////////////////////// */

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