STLSoft - ... Robust, Lightweight, Cross-platform, Template Software ... ATLSTL - Template Software for the Active Template Library COMSTL - The Standard Template Library meets the Component Object Model .netSTL - Standard Template Library meets the Microsoft.NET Common Language Runtime InetSTL - The Standard Template Library meets WinInet MFCSTL - Template Software for the Microsoft Foundation Classes UNIXSTL - Template Software for the UNIX Operating System WinSTL - where the Standard Template Library meets the Win32 API

Main Page   Modules   Namespace List   Class Hierarchy   Alphabetical List   Compound List   File List   Namespace Members   Compound Members   File Members   Related Pages  

inetstl.h

Go to the documentation of this file.
00001 /* 
00002  * File:        inetstl.h
00003  *
00004  * Purpose:     Root header for the InetSTL libraries. Performs various compiler
00005  *              and platform discriminations, and definitions of types.
00006  *
00007  * Created:     24th April 2004
00008  * Updated:     11th September 2004
00009  *
00010  * Home:        http://stlsoft.org/
00011  *
00012  * Copyright (c) 2004, 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 INETSTL_INCL_H_INETSTL
00043 #define INETSTL_INCL_H_INETSTL
00044 
00045 /* File version */
00046 #ifndef __STLSOFT_DOCUMENTATION_SKIP_SECTION
00047 # define INETSTL_VER_H_INETSTL_MAJOR      2
00048 # define INETSTL_VER_H_INETSTL_MINOR      0
00049 # define INETSTL_VER_H_INETSTL_REVISION   1
00050 # define INETSTL_VER_H_INETSTL_EDIT       10
00051 #endif /* !__STLSOFT_DOCUMENTATION_SKIP_SECTION */
00052 
00101 /* 
00102  * InetSTL version
00103  *
00104  * The libraries version information is comprised of major, minor and revision
00105  * components.
00106  *
00107  * The major version is denoted by the _INETSTL_VER_MAJOR preprocessor symbol.
00108  * A changes to the major version component implies that a dramatic change has
00109  * occurred in the libraries, such that considerable changes to source dependent
00110  * on previous versions would need to be effected.
00111  *
00112  * The minor version is denoted by the _INETSTL_VER_MINOR preprocessor symbol.
00113  * Changes to the minor version component imply that a significant change has
00114  * occurred to the libraries, either in the addition of new functionality or in
00115  * the destructive change to one or more components such that recomplilation and
00116  * code change may be necessitated.
00117  *
00118  * The revision version is denoted by the _INETSTL_VER_REVISIO preprocessor
00119  * symbol. Changes to the revision version component imply that a bug has been
00120  * fixed. Dependent code should be recompiled in order to pick up the changes.
00121  *
00122  * In addition to the individual version symbols - _INETSTL_VER_MAJOR,
00123  * _INETSTL_VER_MINOR and _INETSTL_VER_REVISION - a composite symbol _INETSTL_VER
00124  * is defined, where the upper 8 bits are 0, bits 16-23 represent the major
00125  * component,  bits 8-15 represent the minor component, and bits 0-7 represent
00126  * the revision component.
00127  *
00128  * Each release of the libraries will bear a different version, and that version
00129  * will also have its own symbol: Version 1.0.1 specifies _INETSTL_VER_1_0_1.
00130  *
00131  * Thus the symbol _INETSTL_VER may be compared meaningfully with a specific
00132  * version symbol, e.g. #if _INETSTL_VER >= _INETSTL_VER_1_0_1
00133  */
00134 
00137 
00140 
00143 
00146 
00147 #define _INETSTL_VER_MAJOR       1
00148 #define _INETSTL_VER_MINOR       0
00149 #define _INETSTL_VER_REVISION    2
00150 #ifndef __STLSOFT_DOCUMENTATION_SKIP_SECTION
00151 # define _INETSTL_VER_1_0_1      0x00010001  
00152 # define _INETSTL_VER_1_0_2      0x00010002  
00153 #endif /* !__STLSOFT_DOCUMENTATION_SKIP_SECTION */
00154 
00155 #define _INETSTL_VER             _INETSTL_VER_1_0_2
00156 
00157 /* 
00158  * Includes
00159  */
00160 
00161 /* Strict */
00162 #ifndef __STLSOFT_DOCUMENTATION_SKIP_SECTION
00163 # ifndef STRICT
00164 #  if defined(_INETSTL_STRICT) || \
00165       (   !defined(_INETSTL_NO_STRICT) && \
00166           !defined(NO_STRICT))
00167 #   define STRICT 1
00168 #  endif /* !NO_STRICT && !_INETSTL_NO_STRICT */
00169 # endif /* STRICT */
00170 #endif /* !__STLSOFT_DOCUMENTATION_SKIP_SECTION */
00171 
00172 #ifndef STLSOFT_INCL_H_STLSOFT
00173 # include "stlsoft.h"   // STLSoft root header
00174 #endif /* !STLSOFT_INCL_H_STLSOFT */
00175 //#if defined(__STLSOFT_COMPILER_IS_BORLAND)
00176 # include <windows.h>
00177 //#endif /* compiler */
00178 #include <wininet.h>    // Windows base header
00179 
00180 /* 
00181  * STLSoft version compatibility
00182  */
00183 
00184 #if !defined(_STLSOFT_VER_1_7_1) || \
00185     _STLSOFT_VER < _STLSOFT_VER_1_7_1
00186 # error This version of the InetSTL libraries requires STLSoft version 1.7.1 or later
00187 #endif /* _STLSOFT_VER < _STLSOFT_VER_1_5_1 */
00188 
00189 /* 
00190  * Sanity checks
00191  *
00192  * Win32    -   must be compiled in context of Win32 API
00193  * MBCS     -   none of the libraries' code is written to support MBCS
00194  */
00195 
00196 /* Must be Win32 api. */
00197 #if !defined(WIN32) && \
00198     !defined(_WIN32)
00199 # error The InetSTL libraries is currently only compatible with the Win32 API
00200 #endif /* !WIN32 && !_WIN32 */
00201 
00202 /* Should not be MBCS. */
00203 #ifdef _MBCS
00204 # ifdef _INETSTL_STRICT
00205 #  error The InetSTL libraries are not compatible with variable length character representation schemes such as MBCS
00206 # else
00207 #  ifdef _STLSOFT_COMPILE_VERBOSE
00208 #   pragma message("The InetSTL libraries are not compatible with variable length character representation schemes such as MBCS")
00209 #  endif /* _STLSOFT_COMPILE_VERBOSE */
00210 # endif /* _INETSTL_STRICT */
00211 #endif /* _MBCS */
00212 
00213 /* 
00214  * Compiler compatibility
00215  *
00216  * Currently the only compilers supported by the InetSTL libraries are
00217  *
00218  * Borland C++ 5.5, 5.51, 5.6
00219  * Digital Mars C/C++ 8.26 - 8.32
00220  * Metrowerks 2.4 & 3.0 (CodeWarrior 7.0 & 8.0)
00221  * Intel C/C++ 6.0 & 7.0
00222  * Visual C++ 4.2, 5.0, 6.0, 7.0
00223  * Watcom C/C++ 11.0
00224  */
00225 
00226 #if defined(__STLSOFT_COMPILER_IS_BORLAND)
00227 /* Borland C++ */
00228 # if __BORLANDC__ < 0x0550
00229 #  error Versions of Borland C++ prior to 5.5 are not supported by the InetSTL libraries
00230 # endif /* __BORLANDC__ */
00231 
00232 #elif defined(__STLSOFT_COMPILER_IS_COMO)
00233 /* Comeau C++ */
00234 # if __COMO_VERSION__ < 4300
00235 #  error Versions of Comeau C++ prior to 4.3 are not supported by the InetSTL libraries
00236 # endif /* __COMO_VERSION__ */
00237 
00238 #elif defined(__STLSOFT_COMPILER_IS_DMC)
00239 /* Digital Mars C/C++ */
00240 # if __DMC__ < 0x0826
00241 #  error Versions of Digital Mars C/C++ prior to 8.26 are not supported by the InetSTL libraries
00242 # endif /* __DMC__ */
00243 
00244 #elif defined(__STLSOFT_COMPILER_IS_GCC)
00245 /* GNU C/C++ */
00246 # if __GNUC__ < 2 || \
00247      (  __GNUC__ == 2 && \
00248         __GNUC_MINOR__ < 95)
00249 #  error Versions of GNU C/C++ prior to 2.95 are not supported by the InetSTL libraries
00250 # endif /* __GNUC__ */
00251 
00252 #elif defined(__STLSOFT_COMPILER_IS_INTEL)
00253 /* Intel C++ */
00254 # if (__INTEL_COMPILER < 600)
00255 #  error Versions of Intel C++ prior to 6.0 are not supported by the InetSTL libraries
00256 # endif /* __INTEL_COMPILER */
00257 
00258 #elif defined(__STLSOFT_COMPILER_IS_MWERKS)
00259 /* Metrowerks C++ */
00260 # if (__MWERKS__ & 0xFF00) < 0x2400
00261 #  error Versions of Metrowerks CodeWarrior C++ prior to 7.0 are not supported by the InetSTL libraries
00262 # endif /* __MWERKS__ */
00263 
00264 #elif defined(__STLSOFT_COMPILER_IS_MSVC)
00265 /* Visual C++ */
00266 # if _MSC_VER < 1020
00267 #  error Versions of Visual C++ prior to 4.2 are not supported by the InetSTL libraries
00268 # endif /* _MSC_VER */
00269 
00270 #elif defined(__STLSOFT_COMPILER_IS_VECTORC)
00271 /* VectorC C/C++ */
00272 
00273 #elif defined(__STLSOFT_COMPILER_IS_WATCOM)
00274 /* Watcom C/C++ */
00275 # if (__WATCOMC__ < 1200)
00276 #  error Versions of Watcom C/C++ prior to 12.0 are not supported by the InetSTL libraries
00277 # endif /* __WATCOMC__ */
00278 
00279 #else
00280 /* No recognised compiler */
00281 # ifdef _STLSOFT_FORCE_ANY_COMPILER
00282 #  define _INETSTL_COMPILER_IS_UNKNOWN
00283 #  ifdef _STLSOFT_COMPILE_VERBOSE
00284 #   pragma message("Compiler is unknown to InetSTL")
00285 #  endif /* _STLSOFT_COMPILE_VERBOSE */
00286 # else
00287 #  error Currently only Borland C++, Digital Mars C/C++, Intel C/C++, Metrowerks CodeWarrior and Visual C++ compilers are supported by the InetSTL libraries
00288 # endif /* _STLSOFT_FORCE_ANY_COMPILER */
00289 #endif /* compiler */
00290 
00291 /* 
00292  * Debugging
00293  *
00294  * The macro inetstl_assert provides standard debug-mode assert functionality.
00295  */
00296 
00300 #define inetstl_assert(expr)                stlsoft_assert(expr)
00301 
00306 #define inetstl_message_assert(msg, expr)   stlsoft_message_assert(msg, expr)
00307 
00311 #define inetstl_static_assert(expr)         stlsoft_static_assert(expr)
00312 
00313 /* 
00314  * Namespace
00315  *
00316  * The InetSTL components are contained within the inetstl namespace. This is
00317  * usually an alias for stlsoft::inetstl_project,
00318  *
00319  * When compilers support namespaces they are defined by default. They can be
00320  * undefined using a cascasing system, as follows:
00321  *
00322  * If _STLSOFT_NO_NAMESPACES is defined, then _INETSTL_NO_NAMESPACES is defined.
00323  *
00324  * If _INETSTL_NO_NAMESPACES is defined, then _INETSTL_NO_NAMESPACE is defined.
00325  *
00326  * If _INETSTL_NO_NAMESPACE is defined, then the InetSTL constructs are defined
00327  * in the global scope.
00328  *
00329  * If _STLSOFT_NO_NAMESPACES, _INETSTL_NO_NAMESPACES and _INETSTL_NO_NAMESPACE are
00330  * all undefined but the symbol _STLSOFT_NO_NAMESPACE is defined (whence the
00331  * namespace stlsoft does not exist), then the InetSTL constructs are defined
00332  * within the inetstl namespace. The definition matrix is as follows:
00333  *
00334  * _STLSOFT_NO_NAMESPACE    _INETSTL_NO_NAMESPACE    inetstl definition
00335  * ---------------------    --------------------    -----------------
00336  *  not defined              not defined             = stlsoft::inetstl_project
00337  *  not defined              defined                 not defined
00338  *  defined                  not defined             inetstl
00339  *  defined                  defined                 not defined
00340  *
00341  *
00342  *
00343  * The macro inetstl_ns_qual() macro can be used to refer to elements in the
00344  * InetSTL libraries irrespective of whether they are in the
00345  * stlsoft::inetstl_project (or inetstl) namespace or in the global namespace.
00346  *
00347  * Furthermore, some compilers do not support the standard library in the std
00348  * namespace, so the inetstl_ns_qual_std() macro can be used to refer to elements
00349  * in the InetSTL libraries irrespective of whether they are in the std namespace
00350  * or in the global namespace.
00351  */
00352 
00353 /* No STLSoft namespaces means no InetSTL namespaces */
00354 #ifdef _STLSOFT_NO_NAMESPACES
00355 # define _INETSTL_NO_NAMESPACES
00356 #endif /* _STLSOFT_NO_NAMESPACES */
00357 
00358 /* No InetSTL namespaces means no inetstl namespace */
00359 #ifdef _INETSTL_NO_NAMESPACES
00360 # define _INETSTL_NO_NAMESPACE
00361 #endif /* _INETSTL_NO_NAMESPACES */
00362 
00363 #ifndef _INETSTL_NO_NAMESPACE
00364 # if defined(_STLSOFT_NO_NAMESPACE) || \
00365      defined(__STLSOFT_DOCUMENTATION_SKIP_SECTION)
00366 /* There is no stlsoft namespace, so must define ::inetstl */
00369 namespace inetstl
00370 {
00371 # else
00372 /* Define stlsoft::inetstl_project */
00373 
00374 namespace stlsoft
00375 {
00376 
00377 namespace inetstl_project
00378 {
00379 
00380 # endif /* _STLSOFT_NO_NAMESPACE */
00381 #else
00382 stlsoft_ns_using(move_lhs_from_rhs)
00383 #endif /* !_INETSTL_NO_NAMESPACE */
00384 
00387 
00390 
00391 #ifndef _INETSTL_NO_NAMESPACE
00392 # define inetstl_ns_qual(x)          ::inetstl::x
00393 # define inetstl_ns_using(x)         using ::inetstl::x;
00394 #else
00395 # define inetstl_ns_qual(x)          x
00396 # define inetstl_ns_using(x)
00397 #endif /* !_INETSTL_NO_NAMESPACE */
00398 
00401 
00404 
00405 #ifdef __STLSOFT_CF_std_NAMESPACE
00406 # define inetstl_ns_qual_std(x)      ::std::x
00407 # define inetstl_ns_using_std(x)     using ::std::x;
00408 #else
00409 # define inetstl_ns_qual_std(x)      x
00410 # define inetstl_ns_using_std(x)
00411 #endif /* !__STLSOFT_CF_std_NAMESPACE */
00412 
00413 /* 
00414  * Typedefs
00415  *
00416  * The InetSTL uses a number of typedefs to aid in compiler-independence in the
00417  * libraries' main code.
00418  */
00419 
00420 typedef stlsoft_ns_qual(ss_char_a_t)        is_char_a_t;    
00421 typedef stlsoft_ns_qual(ss_char_w_t)        is_char_w_t;    
00422 typedef stlsoft_ns_qual(ss_sint8_t)         is_sint8_t;     
00423 typedef stlsoft_ns_qual(ss_uint8_t)         is_uint8_t;     
00424 typedef stlsoft_ns_qual(ss_int16_t)         is_int16_t;     
00425 typedef stlsoft_ns_qual(ss_sint16_t)        is_sint16_t;    
00426 typedef stlsoft_ns_qual(ss_uint16_t)        is_uint16_t;    
00427 typedef stlsoft_ns_qual(ss_int32_t)         is_int32_t;     
00428 typedef stlsoft_ns_qual(ss_sint32_t)        is_sint32_t;    
00429 typedef stlsoft_ns_qual(ss_uint32_t)        is_uint32_t;    
00430 #ifdef STLSOFT_CF_64BIT_INT_SUPPORT
00431  typedef stlsoft_ns_qual(ss_int64_t)        is_int64_t;     
00432  typedef stlsoft_ns_qual(ss_sint64_t)       is_sint64_t;    
00433  typedef stlsoft_ns_qual(ss_uint64_t)       is_uint64_t;    
00434 #endif /* STLSOFT_CF_64BIT_INT_SUPPORT */
00435 typedef stlsoft_ns_qual(ss_int_t)           is_int_t;       
00436 typedef stlsoft_ns_qual(ss_sint_t)          is_sint_t;      
00437 typedef stlsoft_ns_qual(ss_uint_t)          is_uint_t;      
00438 typedef stlsoft_ns_qual(ss_long_t)          is_long_t;      
00439 typedef stlsoft_ns_qual(ss_byte_t)          is_byte_t;      
00440 typedef stlsoft_ns_qual(ss_bool_t)          is_bool_t;      
00441 typedef DWORD                               is_dword_t;     
00442 typedef stlsoft_ns_qual(ss_size_t)          is_size_t;      
00443 typedef stlsoft_ns_qual(ss_ptrdiff_t)       is_ptrdiff_t;   
00444 typedef stlsoft_ns_qual(ss_streampos_t)     is_streampos_t; 
00445 typedef stlsoft_ns_qual(ss_streamoff_t)     is_streamoff_t; 
00446 
00447 #ifndef _INETSTL_NO_NAMESPACE
00448 typedef is_char_a_t         char_a_t;           
00449 typedef is_char_w_t         char_w_t;           
00450 //typedef is_int8_t           int8_t;             //!< 8-bit integer
00451 typedef is_sint8_t          sint8_t;            
00452 typedef is_uint8_t          uint8_t;            
00453 typedef is_int16_t          int16_t;            
00454 typedef is_sint16_t         sint16_t;           
00455 typedef is_uint16_t         uint16_t;           
00456 typedef is_int32_t          int32_t;            
00457 typedef is_sint32_t         sint32_t;           
00458 typedef is_uint32_t         uint32_t;           
00459 # ifdef STLSOFT_CF_64BIT_INT_SUPPORT
00460  typedef is_int64_t         int64_t;            
00461  typedef is_sint64_t        sint64_t;           
00462  typedef is_uint64_t        uint64_t;           
00463 # endif /* STLSOFT_CF_64BIT_INT_SUPPORT */
00464 //typedef is_short_t          short_t;            //!< short integer
00465 typedef is_int_t            int_t;              
00466 typedef is_sint_t           sint_t;             
00467 typedef is_uint_t           uint_t;             
00468 typedef is_long_t           long_t;             
00469 typedef is_byte_t           byte_t;             
00470 typedef is_bool_t           bool_t;             
00471 typedef is_dword_t          dword_t;            
00472 # if !defined(__STLSOFT_COMPILER_IS_DMC)
00473 typedef is_size_t           size_t;             
00474 typedef is_ptrdiff_t        ptrdiff_t;          
00475 typedef is_streampos_t      streampos_t;        
00476 typedef is_streamoff_t      streamoff_t;        
00477 # endif /* compiler */
00478 #endif /* !_INETSTL_NO_NAMESPACE */
00479 
00480 #ifndef __STLSOFT_DOCUMENTATION_SKIP_SECTION
00481 /* 
00482  * Values
00483  *
00484  * Since the boolean type may not be supported natively on all compilers, the
00485  * values of true and false may also not be provided. Hence the values of
00486  * is_true_v and is_false_v are defined, and are used in all code.
00487  */
00488 
00489 #define is_true_v       ss_true_v
00490 #define is_false_v      ss_false_v
00491 
00492 #endif /* !__STLSOFT_DOCUMENTATION_SKIP_SECTION */
00493 /* 
00494  * Code modification macros
00495  */
00496 
00497 #ifndef __STLSOFT_DOCUMENTATION_SKIP_SECTION
00498 /* Exception signatures. */
00499 # define inetstl_throw_0()                               stlsoft_throw_0()
00500 # define inetstl_throw_1(x1)                             stlsoft_throw_1(x1)
00501 # define inetstl_throw_2(x1, x2)                         stlsoft_throw_2(x1, x2)
00502 # define inetstl_throw_3(x1, x2, x3)                     stlsoft_throw_3(x1, x2, x3)
00503 # define inetstl_throw_4(x1, x2, x3, x4)                 stlsoft_throw_4(x1, x2, x3, x4)
00504 # define inetstl_throw_5(x1, x2, x3, x4, x5)             stlsoft_throw_5(x1, x2, x3, x4, x5)
00505 # define inetstl_throw_6(x1, x2, x3, x4, x5, x6)         stlsoft_throw_6(x1, x2, x3, x4, x5, x6)
00506 # define inetstl_throw_7(x1, x2, x3, x4, x5, x6, x7)     stlsoft_throw_7(x1, x2, x3, x4, x5, x6, x7)
00507 # define inetstl_throw_8(x1, x2, x3, x4, x5, x6, x7, x8) stlsoft_throw_8(x1, x2, x3, x4, x5, x6, x7, x8)
00508 #endif /* !__STLSOFT_DOCUMENTATION_SKIP_SECTION */
00509 
00511 #define inetstl_num_elements(ar)                         stlsoft_num_elements(ar)
00512 
00514 #define inetstl_destroy_instance(t, _type, p)            stlsoft_destroy_instance(t, _type, p)
00515 
00517 #define inetstl_gen_opaque(_htype)                       stlsoft_gen_opaque(_htype)
00518 
00519 /* 
00520 
00521 #ifndef _INETSTL_NO_NAMESPACE
00522 # if defined(_STLSOFT_NO_NAMESPACE) || \
00523      defined(__STLSOFT_DOCUMENTATION_SKIP_SECTION)
00524 } // namespace inetstl
00525 # else
00526 } // namespace inetstl_project
00527 } // namespace stlsoft
00528 namespace inetstl = ::stlsoft::inetstl_project;
00529 # endif /* _STLSOFT_NO_NAMESPACE */
00530 #endif /* !_INETSTL_NO_NAMESPACE */
00531 
00532 /* 
00533 
00534 #endif /* INETSTL_INCL_H_INETSTL */
00535 
00536 /* 

STLSoft Libraries documentation © Synesis Software Pty Ltd, 2001-2004