Google
Web alhem.net

stlhelper.h

Go to the documentation of this file.
00001 
00002 //
00003 // Author: Oskar Wieland (oskar.wieland@gmx.de)
00004 //         You can modifiy and distribute this file freely.
00005 //
00006 // Creation: 31.05.2000
00007 //
00008 // Purpose: Declarations for using STL without warning noise.
00009 //
00010 // Usage: Include this file and define at least one of the STL_USING_xxx
00011 //        macros. Currently supported data types from the STL:
00012 //
00013 //        // defines for using the STL
00014 //        #define STL_USING_ALL
00015 //        #define STL_USING_MAP
00016 //        #define STL_USING_VECTOR
00017 //        #define STL_USING_LIST
00018 //        #define STL_USING_STRING
00019 //        #define STL_USING_STREAM
00020 //        #define STL_USING_ASSERT
00021 //        #define STL_USING_MEMORY
00022 //        #define STL_USING_STACK
00023 //
00024 // Sample:
00025 //        #define STL_USING_ALL
00026 //        #include "STL.h"
00027 //
00029 
00031 // include guards
00033 
00034 /*
00035 #ifndef STLHELPER_INCLUDED_
00036 #define STLHELPER_INCLUDED_
00037 
00038 #if _MSC_VER > 1000
00039 #pragma once
00040 #endif
00041 */
00042 
00043 
00045 // handy define to include all stuff
00047 
00048 #ifdef STL_USING_ALL
00049 
00050 #define STL_USING_MAP
00051 #define STL_USING_VECTOR
00052 #define STL_USING_LIST
00053 #define STL_USING_STRING
00054 #define STL_USING_STREAM
00055 #define STL_USING_ASSERT
00056 #define STL_USING_MEMORY
00057 #define STL_USING_STACK
00058 
00059 #endif
00060 
00061 // dirty
00062 #pragma warning(disable: 4514)  // unreferenced inline/local function has been removed
00063 
00064 
00066 // STL neccessary declaration for map
00068 
00069 #ifdef STL_USING_MAP
00070 
00071 #pragma warning(push)
00072 
00073 #include <yvals.h> // warning numbers get enabled in yvals.h 
00074 #pragma warning(disable: 4503)
00075 
00076 #pragma warning(disable: 4018)  // signed/unsigned mismatch
00077 #pragma warning(disable: 4100)  // unreferenced formal parameter
00078 #pragma warning(disable: 4245)  // conversion from 'type1' to 'type2', signed/unsigned mismatch
00079 #pragma warning(disable: 4512)  // 'class' : assignment operator could not be generated
00080 #pragma warning(disable: 4663)  // C++ language change: to explicitly specialize class template 'vector'
00081 #pragma warning(disable: 4710)  // 'function' : function not inlined
00082 #pragma warning(disable: 4786)  // identifier was truncated to 'number' characters in the debug information
00083 
00084 // BUG: C4786 Warning Is Not Disabled with #pragma Warning
00085 // STATUS: Microsoft has confirmed this to be a bug in the Microsoft product. This warning can be ignored.
00086 // This occured only in the <map> container.
00087 
00088 #include <map>
00089 
00090 #pragma warning(pop)
00091 
00092 #endif
00093 
00094 
00096 // STL neccessary declaration for vector
00098 
00099 #ifdef STL_USING_VECTOR
00100 
00101 #pragma warning(push)
00102 
00103 #include <yvals.h> // warning numbers get enabled in yvals.h 
00104 #pragma warning(disable: 4503)
00105 
00106 #pragma warning(disable: 4018)  // signed/unsigned mismatch
00107 #pragma warning(disable: 4100)  // unreferenced formal parameter
00108 #pragma warning(disable: 4245)  // conversion from 'type1' to 'type2', signed/unsigned mismatch
00109 #pragma warning(disable: 4663)  // C++ language change: to explicitly specialize class template 'vector'
00110 #pragma warning(disable: 4702)  // unreachable code
00111 #pragma warning(disable: 4710)  // 'function' : function not inlined
00112 #pragma warning(disable: 4786)  // identifier was truncated to 'number' characters in the debug information
00113 
00114 #include <vector>
00115 
00116 #pragma warning(pop)
00117 
00118 #endif
00119 
00120 
00122 // STL neccessary declaration for list
00124 
00125 #ifdef STL_USING_LIST
00126 
00127 #pragma warning(push)
00128 
00129 #include <yvals.h> // warning numbers get enabled in yvals.h 
00130 #pragma warning(disable: 4503)
00131 
00132 #pragma warning(disable: 4100)  // unreferenced formal parameter
00133 #pragma warning(disable: 4284)  // return type for 'identifier::operator ->' is not a UDT or reference 
00134 // to a UDT. Will produce errors if applied using infix notation
00135 #pragma warning(disable: 4710)  // 'function' : function not inlined
00136 #pragma warning(disable: 4786)  // identifier was truncated to 'number' characters in the debug information
00137 #pragma warning(disable: 4245)  // conversion from 'type1' to 'type2', signed/unsigned mismatch
00138 
00139 #include <list>
00140 
00141 #pragma warning(pop)
00142 
00143 #endif
00144 
00145 
00147 // STL neccessary declaration for string
00149 
00150 #ifdef STL_USING_STRING
00151 
00152 #pragma warning(push)
00153 
00154 #include <yvals.h> // warning numbers get enabled in yvals.h 
00155 #pragma warning(disable: 4503)
00156 
00157 #pragma warning(disable: 4018)  // signed/unsigned mismatch
00158 #pragma warning(disable: 4100)  // unreferenced formal parameter
00159 #pragma warning(disable: 4146)  // unary minus operator applied to unsigned type, result still unsigned
00160 #pragma warning(disable: 4244)  // 'conversion' conversion from 'type1' to 'type2', possible loss of data
00161 #pragma warning(disable: 4245)  // conversion from 'type1' to 'type2', signed/unsigned mismatch
00162 #pragma warning(disable: 4511)  // 'class' : copy constructor could not be generated
00163 #pragma warning(disable: 4512)  // 'class' : assignment operator could not be generated
00164 #pragma warning(disable: 4663)  // C++ language change: to explicitly specialize class template 'vector'
00165 #pragma warning(disable: 4710)  // 'function' : function not inlined
00166 #pragma warning(disable: 4786)  // identifier was truncated to 'number' characters in the debug information
00167 
00168 #include <string>
00169 
00170 #pragma warning(pop)
00171 
00172 #pragma warning(disable: 4503)
00173 #pragma warning(disable: 4514)  // unreferenced inline/local function has been removed
00174 #pragma warning(disable: 4710)  // 'function' : function not inlined
00175 #pragma warning(disable: 4786)  // identifier was truncated to 'number' characters in the debug information
00176 
00177 #endif
00178 
00179 
00181 // STL neccessary declaration for streams
00183 
00184 #ifdef STL_USING_STREAM
00185 
00186 #pragma warning(push)
00187 
00188 #include <yvals.h> // warning numbers get enabled in yvals.h 
00189 #pragma warning(disable: 4503)
00190 
00191 #pragma warning(disable: 4097)  // typedef-name 'identifier1' used as synonym for class-name 'identifier2'
00192 #pragma warning(disable: 4127)  // conditional expression is constant
00193 
00194 #include <sstream>
00195 #include <fstream>
00196 
00197 #pragma warning(pop)
00198 
00199 #endif
00200 
00201 
00203 // STL neccessary declaration for memory
00205 
00206 #ifdef STL_USING_MEMORY
00207 
00208 // The STL library provides a type called auto_ptr for managing pointers.  
00209 // This template class acts as a stack variable for dynamically allocated 
00210 // memory.  When the variable goes out of scope, its destructor gets called.  
00211 // In its de-structor, it calls delete on the contained pointer, making sure 
00212 // that the memory is returned to the heap.
00213 
00214 #pragma warning(push)
00215 
00216 #include <yvals.h> // warning numbers get enabled in yvals.h 
00217 #pragma warning(disable: 4503)
00218 
00219 #pragma warning(disable: 4018)  // signed/unsigned mismatch
00220 #pragma warning(disable: 4100)  // unreferenced formal parameter
00221 #pragma warning(disable: 4245)  // conversion from 'type1' to 'type2', signed/unsigned mismatch
00222 #pragma warning(disable: 4710)  // 'function' : function not inlined
00223 #pragma warning(disable: 4786)  // identifier was truncated to 'number' characters in the debug information
00224 
00225 #include <memory>
00226 
00227 #pragma warning(pop)
00228 
00229 #endif
00230 
00231 
00233 // STL neccessary declaration for stack
00235 
00236 #ifdef STL_USING_STACK
00237 
00238 #pragma warning(push)
00239 
00240 #include <yvals.h> // warning numbers get enabled in yvals.h 
00241 #pragma warning(disable: 4503)
00242 
00243 #pragma warning(disable: 4018)  // signed/unsigned mismatch
00244 #pragma warning(disable: 4100)  // unreferenced formal parameter
00245 #pragma warning(disable: 4245)  // conversion from 'type1' to 'type2', signed/unsigned mismatch
00246 #pragma warning(disable: 4710)  // 'function' : function not inlined
00247 #pragma warning(disable: 4786)  // identifier was truncated to 'number' characters in the debug information
00248 
00249 #include <stack>
00250 
00251 #pragma warning(pop)
00252 
00253 #endif
00254 
00255 
00257 // STL neccessary declaration for assert
00259 
00260 #ifdef STL_USING_ASSERT
00261 
00262 // avoid macro redefinition when using MFC
00263 #ifndef ASSERT
00264 
00265 #include <cassert>
00266 
00267 // macros for tracking down errors
00268 #ifdef _DEBUG
00269 
00270 #define ASSERT( exp )           assert( exp )
00271 #define VERIFY( exp )           assert( exp )
00272 #define TRACE                   ::OutputDebugString
00273 
00274 #else
00275 
00276 #define ASSERT( exp )           ((void)0)
00277 #define VERIFY( exp )           ((void)(exp))
00278 #define TRACE                   1 ? (void)0 : ::OutputDebugString
00279 
00280 #endif  // _DEBUG
00281 
00282 #endif  // ASSERT
00283 
00284 // additional macros 
00285 #define ASSERT_BREAK( exp )             { ASSERT(exp); if( !(exp) ) break; }
00286 #define ASSERT_CONTINUE( exp )          { ASSERT(exp); if( !(exp) ) continue; }
00287 #define ASSERT_RETURN( exp )            { ASSERT(exp); if( !(exp) ) return; }
00288 #define ASSERT_RETURN_NULL( exp )       { ASSERT(exp); if( !(exp) ) return 0; }
00289 #define ASSERT_RETURN_FALSE( exp )      { ASSERT(exp); if( !(exp) ) return false; }
00290 
00291 #endif  // STL_USING_ASSERT
00292 
00293 
00295 // verify proper use of macros
00297 
00298 #if defined STL_USING_MAP || defined STL_USING_VECTOR || defined STL_USING_LIST || \
00299     defined STL_USING_STRING || defined STL_USING_STREAM || defined STL_USING_ASSERT || \
00300     defined STL_USING_MEMORY || defined STL_USING_STACK
00301 
00302 #else
00303 #pragma message( w_"Warning: You included <STL.H> without using any STL features!" )
00304 #endif
00305 
00306 //#endif  // STLHELPER_INCLUDED_
00307 

Generated for cgi++ by doxygen 1.3.7

Page, code, and content Copyright (C) 2004 by Anders Hedström