Google
Web alhem.net
Main Page | Namespace List | Class Hierarchy | Alphabetical List | Class List | File List | Namespace Members | Class Members | File Members

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 #ifndef STLHELPER_INCLUDED_ 00035 #define STLHELPER_INCLUDED_ 00036 00037 #if _MSC_VER > 1000 00038 #pragma once 00039 #endif 00040 00041 00043 // handy define to include all stuff 00045 00046 #ifdef STL_USING_ALL 00047 00048 #define STL_USING_MAP 00049 #define STL_USING_VECTOR 00050 #define STL_USING_LIST 00051 #define STL_USING_STRING 00052 #define STL_USING_STREAM 00053 #define STL_USING_ASSERT 00054 #define STL_USING_MEMORY 00055 #define STL_USING_STACK 00056 00057 #endif 00058 00059 00061 // STL neccessary declaration for map 00063 00064 #ifdef STL_USING_MAP 00065 00066 #pragma warning(push) 00067 00068 #include <yvals.h> // warning numbers get enabled in yvals.h 00069 00070 #pragma warning(disable: 4018) // signed/unsigned mismatch 00071 #pragma warning(disable: 4100) // unreferenced formal parameter 00072 #pragma warning(disable: 4245) // conversion from 'type1' to 'type2', signed/unsigned mismatch 00073 #pragma warning(disable: 4512) // 'class' : assignment operator could not be generated 00074 #pragma warning(disable: 4663) // C++ language change: to explicitly specialize class template 'vector' 00075 #pragma warning(disable: 4710) // 'function' : function not inlined 00076 #pragma warning(disable: 4786) // identifier was truncated to 'number' characters in the debug information 00077 00078 // BUG: C4786 Warning Is Not Disabled with #pragma Warning 00079 // STATUS: Microsoft has confirmed this to be a bug in the Microsoft product. This warning can be ignored. 00080 // This occured only in the <map> container. 00081 00082 #include <map> 00083 00084 #pragma warning(pop) 00085 00086 #endif 00087 00088 00090 // STL neccessary declaration for vector 00092 00093 #ifdef STL_USING_VECTOR 00094 00095 #pragma warning(push) 00096 00097 #include <yvals.h> // warning numbers get enabled in yvals.h 00098 00099 #pragma warning(disable: 4018) // signed/unsigned mismatch 00100 #pragma warning(disable: 4100) // unreferenced formal parameter 00101 #pragma warning(disable: 4245) // conversion from 'type1' to 'type2', signed/unsigned mismatch 00102 #pragma warning(disable: 4663) // C++ language change: to explicitly specialize class template 'vector' 00103 #pragma warning(disable: 4702) // unreachable code 00104 #pragma warning(disable: 4710) // 'function' : function not inlined 00105 #pragma warning(disable: 4786) // identifier was truncated to 'number' characters in the debug information 00106 00107 #include <vector> 00108 00109 #pragma warning(pop) 00110 00111 #endif 00112 00113 00115 // STL neccessary declaration for list 00117 00118 #ifdef STL_USING_LIST 00119 00120 #pragma warning(push) 00121 00122 #include <yvals.h> // warning numbers get enabled in yvals.h 00123 00124 #pragma warning(disable: 4100) // unreferenced formal parameter 00125 #pragma warning(disable: 4284) // return type for 'identifier::operator ->' is not a UDT or reference 00126 // to a UDT. Will produce errors if applied using infix notation 00127 #pragma warning(disable: 4710) // 'function' : function not inlined 00128 #pragma warning(disable: 4786) // identifier was truncated to 'number' characters in the debug information 00129 00130 #include <list> 00131 00132 #pragma warning(pop) 00133 00134 #endif 00135 00136 00138 // STL neccessary declaration for string 00140 00141 #ifdef STL_USING_STRING 00142 00143 #pragma warning(push) 00144 00145 #include <yvals.h> // warning numbers get enabled in yvals.h 00146 00147 #pragma warning(disable: 4018) // signed/unsigned mismatch 00148 #pragma warning(disable: 4100) // unreferenced formal parameter 00149 #pragma warning(disable: 4146) // unary minus operator applied to unsigned type, result still unsigned 00150 #pragma warning(disable: 4244) // 'conversion' conversion from 'type1' to 'type2', possible loss of data 00151 #pragma warning(disable: 4245) // conversion from 'type1' to 'type2', signed/unsigned mismatch 00152 #pragma warning(disable: 4511) // 'class' : copy constructor could not be generated 00153 #pragma warning(disable: 4512) // 'class' : assignment operator could not be generated 00154 #pragma warning(disable: 4663) // C++ language change: to explicitly specialize class template 'vector' 00155 #pragma warning(disable: 4710) // 'function' : function not inlined 00156 #pragma warning(disable: 4786) // identifier was truncated to 'number' characters in the debug information 00157 00158 #include <string> 00159 00160 #pragma warning(pop) 00161 00162 #pragma warning(disable: 4514) // unreferenced inline/local function has been removed 00163 #pragma warning(disable: 4710) // 'function' : function not inlined 00164 #pragma warning(disable: 4786) // identifier was truncated to 'number' characters in the debug information 00165 00166 #endif 00167 00168 00170 // STL neccessary declaration for streams 00172 00173 #ifdef STL_USING_STREAM 00174 00175 #pragma warning(push) 00176 00177 #include <yvals.h> // warning numbers get enabled in yvals.h 00178 00179 #pragma warning(disable: 4097) // typedef-name 'identifier1' used as synonym for class-name 'identifier2' 00180 #pragma warning(disable: 4127) // conditional expression is constant 00181 00182 #include <sstream> 00183 #include <fstream> 00184 00185 #pragma warning(pop) 00186 00187 #endif 00188 00189 00191 // STL neccessary declaration for memory 00193 00194 #ifdef STL_USING_MEMORY 00195 00196 // The STL library provides a type called auto_ptr for managing pointers. 00197 // This template class acts as a stack variable for dynamically allocated 00198 // memory. When the variable goes out of scope, its destructor gets called. 00199 // In its de-structor, it calls delete on the contained pointer, making sure 00200 // that the memory is returned to the heap. 00201 00202 #pragma warning(push) 00203 00204 #include <yvals.h> // warning numbers get enabled in yvals.h 00205 00206 #pragma warning(disable: 4018) // signed/unsigned mismatch 00207 #pragma warning(disable: 4100) // unreferenced formal parameter 00208 #pragma warning(disable: 4245) // conversion from 'type1' to 'type2', signed/unsigned mismatch 00209 #pragma warning(disable: 4710) // 'function' : function not inlined 00210 #pragma warning(disable: 4786) // identifier was truncated to 'number' characters in the debug information 00211 00212 #include <memory> 00213 00214 #pragma warning(pop) 00215 00216 #endif 00217 00218 00220 // STL neccessary declaration for stack 00222 00223 #ifdef STL_USING_STACK 00224 00225 #pragma warning(push) 00226 00227 #include <yvals.h> // warning numbers get enabled in yvals.h 00228 00229 #pragma warning(disable: 4018) // signed/unsigned mismatch 00230 #pragma warning(disable: 4100) // unreferenced formal parameter 00231 #pragma warning(disable: 4245) // conversion from 'type1' to 'type2', signed/unsigned mismatch 00232 #pragma warning(disable: 4710) // 'function' : function not inlined 00233 #pragma warning(disable: 4786) // identifier was truncated to 'number' characters in the debug information 00234 00235 #include <stack> 00236 00237 #pragma warning(pop) 00238 00239 #endif 00240 00241 00243 // STL neccessary declaration for assert 00245 00246 #ifdef STL_USING_ASSERT 00247 00248 // avoid macro redefinition when using MFC 00249 #ifndef ASSERT 00250 00251 #include <cassert> 00252 00253 // macros for tracking down errors 00254 #ifdef _DEBUG 00255 00256 #define ASSERT( exp ) assert( exp ) 00257 #define VERIFY( exp ) assert( exp ) 00258 #define TRACE ::OutputDebugString 00259 00260 #else 00261 00262 #define ASSERT( exp ) ((void)0) 00263 #define VERIFY( exp ) ((void)(exp)) 00264 #define TRACE 1 ? (void)0 : ::OutputDebugString 00265 00266 #endif // _DEBUG 00267 00268 #endif // ASSERT 00269 00270 // additional macros 00271 #define ASSERT_BREAK( exp ) { ASSERT(exp); if( !(exp) ) break; } 00272 #define ASSERT_CONTINUE( exp ) { ASSERT(exp); if( !(exp) ) continue; } 00273 #define ASSERT_RETURN( exp ) { ASSERT(exp); if( !(exp) ) return; } 00274 #define ASSERT_RETURN_NULL( exp ) { ASSERT(exp); if( !(exp) ) return 0; } 00275 #define ASSERT_RETURN_FALSE( exp ) { ASSERT(exp); if( !(exp) ) return false; } 00276 00277 #endif // STL_USING_ASSERT 00278 00279 00281 // verify proper use of macros 00283 00284 #if defined STL_USING_MAP || defined STL_USING_VECTOR || defined STL_USING_LIST || \ 00285 defined STL_USING_STRING || defined STL_USING_STREAM || defined STL_USING_ASSERT || \ 00286 defined STL_USING_MEMORY || defined STL_USING_STACK 00287 using std::string; 00288 using std::vector; 00289 using std::vector<string>; 00290 using std::vector<string>::iterator; 00291 #else 00292 #pragma message( "Warning: You included <STL.H> without using any STL features!" ) 00293 #endif 00294 00295 #endif // STLHELPER_INCLUDED_ 00296

Generated for My SDL C++ Gui by doxygen 1.3.6

www.TV-friendship.com
The matchmaking service with an all new twist.

Quantum 'Teleportation'
Some thoughts
Page, code, and content Copyright (C) 2004 by Anders Hedström