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
00047 #ifndef WINSTL_INCL_WINSTL_TIME_H_COMPARISON_FUNCTIONS
00048 #define WINSTL_INCL_WINSTL_TIME_H_COMPARISON_FUNCTIONS
00049
00050 #ifndef STLSOFT_DOCUMENTATION_SKIP_SECTION
00051 # define WINSTL_VER_WINSTL_TIME_H_COMPARISON_FUNCTIONS_MAJOR 4
00052 # define WINSTL_VER_WINSTL_TIME_H_COMPARISON_FUNCTIONS_MINOR 0
00053 # define WINSTL_VER_WINSTL_TIME_H_COMPARISON_FUNCTIONS_REVISION 5
00054 # define WINSTL_VER_WINSTL_TIME_H_COMPARISON_FUNCTIONS_EDIT 47
00055 #endif
00056
00057
00058
00059
00060
00061 #ifndef WINSTL_INCL_WINSTL_H_WINSTL
00062 # include <winstl/winstl.h>
00063 #endif
00064
00065
00066
00067
00068
00069 #if !defined(_WINSTL_NO_NAMESPACE) && \
00070 !defined(STLSOFT_DOCUMENTATION_SKIP_SECTION)
00071 # if defined(_STLSOFT_NO_NAMESPACE)
00072
00073 namespace winstl
00074 {
00075 # else
00076
00077
00078 namespace stlsoft
00079 {
00080
00081 namespace winstl_project
00082 {
00083
00084 # endif
00085 #endif
00086
00087
00088
00089
00090
00095 STLSOFT_INLINE ws_sint_t winstl__compare_FILETIMEs(FILETIME const* lhs, FILETIME const* rhs)
00096 {
00097 WINSTL_ASSERT(NULL != lhs);
00098 WINSTL_ASSERT(NULL != rhs);
00099
00100 if(lhs->dwHighDateTime < rhs->dwHighDateTime)
00101 {
00102 return -1;
00103 }
00104 else if(rhs->dwHighDateTime < lhs->dwHighDateTime)
00105 {
00106 return +1;
00107 }
00108 else
00109 {
00110 if(lhs->dwLowDateTime < rhs->dwLowDateTime)
00111 {
00112 return -1;
00113 }
00114 else if(rhs->dwLowDateTime < lhs->dwLowDateTime)
00115 {
00116 return +1;
00117 }
00118 else
00119 {
00120 return 0;
00121 }
00122 }
00123 }
00124
00129 STLSOFT_INLINE ws_sint_t winstl__compare_FILETIME_with_SYSTEMTIME(FILETIME const* lhs, SYSTEMTIME const* rhs)
00130 {
00131 FILETIME ft2;
00132
00133 WINSTL_ASSERT(NULL != lhs);
00134 WINSTL_ASSERT(NULL != rhs);
00135
00136 if(!STLSOFT_NS_GLOBAL(SystemTimeToFileTime)(rhs, &ft2))
00137 {
00138 return -1;
00139 }
00140
00141 return winstl__compare_FILETIMEs(lhs, &ft2);
00142 }
00143
00148 STLSOFT_INLINE ws_sint_t winstl__compare_SYSTEMTIME_with_FILETIME(SYSTEMTIME const* lhs, FILETIME const* rhs)
00149 {
00150 FILETIME ft1;
00151
00152 WINSTL_ASSERT(NULL != lhs);
00153 WINSTL_ASSERT(NULL != rhs);
00154
00155 if(!STLSOFT_NS_GLOBAL(SystemTimeToFileTime)(lhs, &ft1))
00156 {
00157 return +1;
00158 }
00159
00160 return winstl__compare_FILETIMEs(&ft1, rhs);
00161 }
00162
00167 STLSOFT_INLINE ws_sint_t winstl__compare_SYSTEMTIMEs(SYSTEMTIME const* lhs, SYSTEMTIME const* rhs)
00168 {
00169 FILETIME ft1;
00170 FILETIME ft2;
00171
00172 WINSTL_ASSERT(NULL != lhs);
00173 WINSTL_ASSERT(NULL != rhs);
00174
00175 if(!STLSOFT_NS_GLOBAL(SystemTimeToFileTime)(lhs, &ft1))
00176 {
00177 return +1;
00178 }
00179 if(!STLSOFT_NS_GLOBAL(SystemTimeToFileTime)(rhs, &ft2))
00180 {
00181 return -1;
00182 }
00183
00184 return winstl__compare_FILETIMEs(&ft1, &ft2);
00185 }
00186
00187
00188
00189
00190
00191 #ifdef STLSOFT_DOCUMENTATION_SKIP_SECTION
00192 namespace winstl
00193 {
00194 #endif
00195
00196
00197
00198
00199
00200 #ifdef __cplusplus
00201
00206 inline ws_sint_t compare(FILETIME const& lhs, FILETIME const& rhs)
00207 {
00208 return winstl__compare_FILETIMEs(&lhs, &rhs);
00209 }
00210
00215 inline ws_sint_t compare(FILETIME const& lhs, SYSTEMTIME const& rhs)
00216 {
00217 return winstl__compare_FILETIME_with_SYSTEMTIME(&lhs, &rhs);
00218 }
00219
00224 inline ws_sint_t compare(SYSTEMTIME const& lhs, FILETIME const& rhs)
00225 {
00226 return winstl__compare_SYSTEMTIME_with_FILETIME(&lhs, &rhs);
00227 }
00228
00233 inline ws_sint_t compare(SYSTEMTIME const& lhs, SYSTEMTIME const& rhs)
00234 {
00235 return winstl__compare_SYSTEMTIMEs(&lhs, &rhs);
00236 }
00237
00238
00239
00240
00241
00242
00243
00248 inline ws_bool_t operator ==(FILETIME const& lhs, FILETIME const& rhs)
00249 {
00250 return 0 == compare(lhs, rhs);
00251 }
00252
00257 inline ws_bool_t operator ==(FILETIME const& lhs, SYSTEMTIME const& rhs)
00258 {
00259 return 0 == compare(lhs, rhs);
00260 }
00261
00266 inline ws_bool_t operator ==(SYSTEMTIME const& lhs, FILETIME const& rhs)
00267 {
00268 return 0 == compare(lhs, rhs);
00269 }
00270
00275 inline ws_bool_t operator ==(SYSTEMTIME const& lhs, SYSTEMTIME const& rhs)
00276 {
00277 return 0 == compare(lhs, rhs);
00278 }
00279
00280
00281
00286 inline ws_bool_t operator !=(FILETIME const& lhs, FILETIME const& rhs)
00287 {
00288 return 0 != compare(lhs, rhs);
00289 }
00290
00295 inline ws_bool_t operator !=(FILETIME const& lhs, SYSTEMTIME const& rhs)
00296 {
00297 return 0 != compare(lhs, rhs);
00298 }
00299
00304 inline ws_bool_t operator !=(SYSTEMTIME const& lhs, FILETIME const& rhs)
00305 {
00306 return 0 != compare(lhs, rhs);
00307 }
00308
00313 inline ws_bool_t operator !=(SYSTEMTIME const& lhs, SYSTEMTIME const& rhs)
00314 {
00315 return 0 != compare(lhs, rhs);
00316 }
00317
00318
00319
00324 inline ws_bool_t operator <(FILETIME const& lhs, FILETIME const& rhs)
00325 {
00326 return 0 > compare(lhs, rhs);
00327 }
00328
00333 inline ws_bool_t operator <(FILETIME const& lhs, SYSTEMTIME const& rhs)
00334 {
00335 return 0 > compare(lhs, rhs);
00336 }
00337
00342 inline ws_bool_t operator <(SYSTEMTIME const& lhs, FILETIME const& rhs)
00343 {
00344 return 0 > compare(lhs, rhs);
00345 }
00346
00351 inline ws_bool_t operator <(SYSTEMTIME const& lhs, SYSTEMTIME const& rhs)
00352 {
00353 return 0 > compare(lhs, rhs);
00354 }
00355
00356
00357
00362 inline ws_bool_t operator >(FILETIME const& lhs, FILETIME const& rhs)
00363 {
00364 return 0 < compare(lhs, rhs);
00365 }
00366
00371 inline ws_bool_t operator >(FILETIME const& lhs, SYSTEMTIME const& rhs)
00372 {
00373 return 0 < compare(lhs, rhs);
00374 }
00375
00380 inline ws_bool_t operator >(SYSTEMTIME const& lhs, FILETIME const& rhs)
00381 {
00382 return 0 < compare(lhs, rhs);
00383 }
00384
00389 inline ws_bool_t operator >(SYSTEMTIME const& lhs, SYSTEMTIME const& rhs)
00390 {
00391 return 0 < compare(lhs, rhs);
00392 }
00393
00394
00395
00400 inline ws_bool_t operator <=(FILETIME const& lhs, FILETIME const& rhs)
00401 {
00402 return 0 >= compare(lhs, rhs);
00403 }
00404
00409 inline ws_bool_t operator <=(FILETIME const& lhs, SYSTEMTIME const& rhs)
00410 {
00411 return 0 >= compare(lhs, rhs);
00412 }
00413
00418 inline ws_bool_t operator <=(SYSTEMTIME const& lhs, FILETIME const& rhs)
00419 {
00420 return 0 >= compare(lhs, rhs);
00421 }
00422
00427 inline ws_bool_t operator <=(SYSTEMTIME const& lhs, SYSTEMTIME const& rhs)
00428 {
00429 return 0 >= compare(lhs, rhs);
00430 }
00431
00432
00433
00438 inline ws_bool_t operator >=(FILETIME const& lhs, FILETIME const& rhs)
00439 {
00440 return 0 <= compare(lhs, rhs);
00441 }
00442
00447 inline ws_bool_t operator >=(FILETIME const& lhs, SYSTEMTIME const& rhs)
00448 {
00449 return 0 <= compare(lhs, rhs);
00450 }
00451
00456 inline ws_bool_t operator >=(SYSTEMTIME const& lhs, FILETIME const& rhs)
00457 {
00458 return 0 <= compare(lhs, rhs);
00459 }
00460
00465 inline ws_bool_t operator >=(SYSTEMTIME const& lhs, SYSTEMTIME const& rhs)
00466 {
00467 return 0 <= compare(lhs, rhs);
00468 }
00469
00470 #endif
00471
00472
00473
00474
00475
00476 #ifdef STLSOFT_UNITTEST
00477 # include "./unittest/comparison_functions_unittest_.h"
00478 #endif
00479
00480
00481
00482 #ifndef _WINSTL_NO_NAMESPACE
00483 # if defined(_STLSOFT_NO_NAMESPACE) || \
00484 defined(STLSOFT_DOCUMENTATION_SKIP_SECTION)
00485 }
00486 # else
00487 }
00488 }
00489 # endif
00490 #endif
00491
00492
00493
00494 #endif
00495
00496