00001 
00002 
00003 
00004 
00005 
00006 
00007 
00008 
00009 
00010 
00011 
00012 
00013 
00014 
00015 
00016 
00017 
00018 
00019 
00020 
00021 
00022 
00023 
00024 
00025 
00026 
00027 
00028 
00029 
00030 
00031 
00032 
00033 
00034 
00035 
00036 
00037 
00038 
00039 
00040 
00048 #ifndef WINSTL_INCL_WINSTL_UTIL_HPP_STRUCT_INITIALISERS
00049 #define WINSTL_INCL_WINSTL_UTIL_HPP_STRUCT_INITIALISERS
00050 
00051 #ifndef STLSOFT_DOCUMENTATION_SKIP_SECTION
00052 # define WINSTL_VER_WINSTL_UTIL_HPP_STRUCT_INITIALISERS_MAJOR       4
00053 # define WINSTL_VER_WINSTL_UTIL_HPP_STRUCT_INITIALISERS_MINOR       0
00054 # define WINSTL_VER_WINSTL_UTIL_HPP_STRUCT_INITIALISERS_REVISION    4
00055 # define WINSTL_VER_WINSTL_UTIL_HPP_STRUCT_INITIALISERS_EDIT        220
00056 #endif 
00057 
00058 
00059 
00060 
00061 
00062 #ifndef WINSTL_INCL_WINSTL_H_WINSTL
00063 # include <winstl/winstl.h>
00064 #endif 
00065 
00066 
00067 
00068 
00069 
00070 #ifndef _WINSTL_NO_NAMESPACE
00071 # if defined(_STLSOFT_NO_NAMESPACE) || \
00072      defined(STLSOFT_DOCUMENTATION_SKIP_SECTION)
00073 
00074 namespace winstl
00075 {
00076 # else
00077 
00078 
00079 namespace stlsoft
00080 {
00081 
00082 namespace winstl_project
00083 {
00084 
00085 # endif 
00086 #endif 
00087 
00088 
00089 
00090 
00091 
00096 template <ss_typename_param_k T>
00097 inline void zero_struct(T &t)
00098 {
00099     ::ZeroMemory(&t, sizeof(T));
00100 }
00101 
00102 template <ss_typename_param_k T>
00103 struct init_traits;
00104 
00105 
00106 #ifndef STLSOFT_DOCUMENTATION_SKIP_SECTION
00107 
00108 struct struct_has
00109 {
00110     struct no_init_member_type
00111     {};
00112 
00113     struct cb_member_type
00114     {};
00115 
00116     struct cBytes_member_type
00117     {};
00118 
00119     struct cbSize_member_type
00120     {};
00121 
00122     struct dwLength_member_type
00123     {};
00124 
00125     struct dwOSVersionInfoSize_member_type
00126     {};
00127 
00128     struct dwSize_member_type
00129     {};
00130 
00131     struct nLength_member_type
00132     {};
00133 
00134     struct uSize_member_type
00135     {};
00136 
00137 
00138     template <ss_typename_param_k T>
00139     static void init(T &t, no_init_member_type)
00140     {
00141         zero_struct(t);
00142     }
00143 
00144     template <ss_typename_param_k T>
00145     static void init(T &t, cb_member_type)
00146     {
00147         zero_struct(t);
00148         t.cb        =   sizeof(T);
00149     }
00150 
00151     template <ss_typename_param_k T>
00152     static void init(T &t, cBytes_member_type)
00153     {
00154         zero_struct(t);
00155         t.cBytes    =   sizeof(T);
00156     }
00157 
00158     template <ss_typename_param_k T>
00159     static void init(T &t, cbSize_member_type)
00160     {
00161         zero_struct(t);
00162         t.cbSize    =   sizeof(T);
00163     }
00164 
00165     template <ss_typename_param_k T>
00166     static void init(T &t, dwLength_member_type)
00167     {
00168         zero_struct(t);
00169         t.dwLength  =   sizeof(T);
00170     }
00171 
00172     template <ss_typename_param_k T>
00173     static void init(T &t, dwOSVersionInfoSize_member_type)
00174     {
00175         zero_struct(t);
00176         t.dwOSVersionInfoSize   =   sizeof(T);
00177     }
00178 
00179     template <ss_typename_param_k T>
00180     static void init(T &t, dwSize_member_type)
00181     {
00182         zero_struct(t);
00183         t.dwSize    =   sizeof(T);
00184     }
00185 
00186     template <ss_typename_param_k T>
00187     static void init(T &t, nLength_member_type)
00188     {
00189         zero_struct(t);
00190         t.nLength   =   sizeof(T);
00191     }
00192 
00193     template <ss_typename_param_k T>
00194     static void init(T &t, uSize_member_type)
00195     {
00196         zero_struct(t);
00197         t.uSize    =   sizeof(T);
00198     }
00199 };
00200 
00201 #endif 
00202 
00203 
00209 template <ss_typename_param_k T>
00210 inline void init_struct(T &t)
00211 {
00212     typedef ss_typename_type_k init_traits<T>::type     discriminator_t;
00213 
00214     struct_has::init(t, discriminator_t());
00215 }
00216 
00217 
00218 
00219 #ifndef STLSOFT_DOCUMENTATION_SKIP_SECTION
00220 
00221 # define WINSTL_The_structure_(S, t)                \
00222                                                     \
00223     STLSOFT_TEMPLATE_SPECIALISATION                 \
00224     struct init_traits<S>                           \
00225     {                                               \
00226         typedef struct_##t  type;                   \
00227     }
00228 
00229 
00230 
00231 WINSTL_The_structure_(PROCESS_INFORMATION, has::no_init_member_type);
00232 WINSTL_The_structure_(OVERLAPPED, has::no_init_member_type);
00233 WINSTL_The_structure_(FILETIME, has::no_init_member_type);
00234 WINSTL_The_structure_(SYSTEMTIME, has::no_init_member_type);
00235 WINSTL_The_structure_(COMMPROP, has::no_init_member_type);
00236 WINSTL_The_structure_(COMSTAT, has::no_init_member_type);
00237 WINSTL_The_structure_(COMMTIMEOUTS, has::no_init_member_type);
00238 WINSTL_The_structure_(SYSTEM_INFO, has::no_init_member_type);
00239 WINSTL_The_structure_(EXCEPTION_DEBUG_INFO, has::no_init_member_type);
00240 WINSTL_The_structure_(CREATE_THREAD_DEBUG_INFO, has::no_init_member_type);
00241 WINSTL_The_structure_(CREATE_PROCESS_DEBUG_INFO, has::no_init_member_type);
00242 WINSTL_The_structure_(EXIT_THREAD_DEBUG_INFO, has::no_init_member_type);
00243 WINSTL_The_structure_(LOAD_DLL_DEBUG_INFO, has::no_init_member_type);
00244 WINSTL_The_structure_(UNLOAD_DLL_DEBUG_INFO, has::no_init_member_type);
00245 WINSTL_The_structure_(OUTPUT_DEBUG_STRING_INFO, has::no_init_member_type);
00246 WINSTL_The_structure_(RIP_INFO, has::no_init_member_type);
00247 WINSTL_The_structure_(DEBUG_EVENT, has::no_init_member_type);
00248 WINSTL_The_structure_(PROCESS_HEAP_ENTRY, has::no_init_member_type);
00249 WINSTL_The_structure_(BY_HANDLE_FILE_INFORMATION, has::no_init_member_type);
00250 WINSTL_The_structure_(TIME_ZONE_INFORMATION, has::no_init_member_type);
00251 WINSTL_The_structure_(WIN32_STREAM_ID, has::no_init_member_type);
00252 WINSTL_The_structure_(WIN32_FIND_DATAA, has::no_init_member_type);
00253 WINSTL_The_structure_(WIN32_FIND_DATAW, has::no_init_member_type);
00254 WINSTL_The_structure_(WIN32_FILE_ATTRIBUTE_DATA, has::no_init_member_type);
00255 WINSTL_The_structure_(SYSTEM_POWER_STATUS, has::no_init_member_type);
00256 #ifdef WINTRUST_H
00257 WINSTL_The_structure_(WIN_CERTIFICATE, has::no_init_member_type);
00258 WINSTL_The_structure_(WIN_TRUST_ACTDATA_CONTEXT_WITH_SUBJECT, has::no_init_member_type);
00259 WINSTL_The_structure_(WIN_TRUST_ACTDATA_SUBJECT_ONLY, has::no_init_member_type);
00260 WINSTL_The_structure_(WIN_TRUST_SUBJECT_FILE, has::no_init_member_type);
00261 WINSTL_The_structure_(WIN_TRUST_SUBJECT_FILE_AND_DISPLAY, has::no_init_member_type);
00262 WINSTL_The_structure_(WIN_SPUB_TRUSTED_PUBLISHER_DATA, has::no_init_member_type);
00263 #endif 
00264 
00265 
00266 WINSTL_The_structure_(STARTUPINFOA, has::cb_member_type);
00267 WINSTL_The_structure_(STARTUPINFOW, has::cb_member_type);
00268 
00269 WINSTL_The_structure_(OFSTRUCT, has::cBytes_member_type);
00270 
00271 WINSTL_The_structure_(MEMORYSTATUS, has::dwLength_member_type);
00272 
00273 WINSTL_The_structure_(OSVERSIONINFOA, has::dwOSVersionInfoSize_member_type);
00274 WINSTL_The_structure_(OSVERSIONINFOW, has::dwOSVersionInfoSize_member_type);
00275 #if !defined(STLSOFT_COMPILER_IS_DMC) && \
00276     (   !defined(STLSOFT_COMPILER_IS_MSVC) || \
00277         _MSC_VER >= 1200)
00278 WINSTL_The_structure_(OSVERSIONINFOEXA, has::dwOSVersionInfoSize_member_type);
00279 WINSTL_The_structure_(OSVERSIONINFOEXW, has::dwOSVersionInfoSize_member_type);
00280 #endif 
00281 
00282 WINSTL_The_structure_(COMMCONFIG, has::dwSize_member_type);
00283 
00284 WINSTL_The_structure_(SECURITY_ATTRIBUTES, has::nLength_member_type);
00285 
00286 inline void init_struct(DCB &dcb)
00287 {
00288     zero_struct(dcb);
00289     dcb.DCBlength = sizeof(dcb);
00290 }
00291 
00292 
00293 
00294 #if defined(_INC_SHELLAPI) || \
00295     defined(_SHELLAPI_H) || \
00296     !defined(WIN32_LEAN_AND_MEAN)
00297 
00298 WINSTL_The_structure_(SHFILEOPSTRUCTA, has::no_init_member_type);
00299 WINSTL_The_structure_(SHFILEOPSTRUCTW, has::no_init_member_type);
00300 #if !defined(STLSOFT_COMPILER_IS_GCC)
00301 WINSTL_The_structure_(SHNAMEMAPPINGA, has::no_init_member_type);
00302 WINSTL_The_structure_(SHNAMEMAPPINGW, has::no_init_member_type);
00303 #endif 
00304 WINSTL_The_structure_(SHFILEINFOA, has::no_init_member_type);
00305 WINSTL_The_structure_(SHFILEINFOW, has::no_init_member_type);
00306 
00307 
00308 #if !defined(STLSOFT_COMPILER_IS_DMC) && \
00309     !defined(STLSOFT_COMPILER_IS_GCC) && \
00310     (   !defined(STLSOFT_COMPILER_IS_MSVC) || \
00311         _MSC_VER >= 1200) && \
00312     defined(WINVER) && \
00313     WINVER >= 0x0400
00314 WINSTL_The_structure_(DRAGINFOA, has::uSize_member_type);
00315 WINSTL_The_structure_(DRAGINFOW, has::uSize_member_type);
00316 #endif 
00317 
00318 WINSTL_The_structure_(APPBARDATA, has::cbSize_member_type);
00319 WINSTL_The_structure_(SHELLEXECUTEINFOA, has::cbSize_member_type);
00320 WINSTL_The_structure_(SHELLEXECUTEINFOW, has::cbSize_member_type);
00321 #if !defined(STLSOFT_COMPILER_IS_DMC) && \
00322     (   !defined(STLSOFT_COMPILER_IS_GCC) || \
00323         __GNUC__ > 3 || \
00324         (   __GNUC__ == 3 && \
00325             __GNUC_MINOR__ > 2)) && \
00326     (   !defined(STLSOFT_COMPILER_IS_MSVC) || \
00327         _MSC_VER >= 1200)
00328 WINSTL_The_structure_(SHQUERYRBINFO, has::cbSize_member_type);
00329 #endif 
00330 WINSTL_The_structure_(NOTIFYICONDATAA, has::cbSize_member_type);
00331 WINSTL_The_structure_(NOTIFYICONDATAW, has::cbSize_member_type);
00332 
00333 #endif 
00334 
00335 #endif 
00336 
00338 
00339 
00340 #ifdef STLSOFT_UNITTEST
00341 # include "./unittest/struct_initialisers_unittest_.h"
00342 #endif 
00343 
00344 
00345 
00346 #ifndef _WINSTL_NO_NAMESPACE
00347 # if defined(_STLSOFT_NO_NAMESPACE) || \
00348      defined(STLSOFT_DOCUMENTATION_SKIP_SECTION)
00349 } 
00350 # else
00351 } 
00352 } 
00353 # endif 
00354 #endif 
00355 
00356 
00357 
00358 #endif 
00359 
00360