本文整理汇总了C++中Date::Before方法的典型用法代码示例。如果您正苦于以下问题:C++ Date::Before方法的具体用法?C++ Date::Before怎么用?C++ Date::Before使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Date
的用法示例。
在下文中一共展示了Date::Before方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: ManageOldLogs
void Computer::ManageOldLogs ()
{
//
// Delete any logs older than a certain age
//
for ( int i = logbank.logs.Size () - 1; i >= 0; --i ) {
if ( logbank.logs.ValidIndex (i) ) {
AccessLog *al = logbank.logs.GetData (i);
if ( al ) {
Date testdate;
testdate.SetDate ( &(al->date) );
testdate.AdvanceMinute ( TIME_TOEXPIRELOGS );
if ( testdate.Before ( &(game->GetWorld ()->date) ) ) {
delete logbank.logs.GetData (i);
logbank.logs.RemoveData (i);
if ( logbank.internallogs.ValidIndex ( i ) ) {
delete logbank.internallogs.GetData (i);
logbank.internallogs.RemoveData (i);
}
}
}
}
}
//
// Pack the new log structures together
//
int nextlog = 0;
for ( int il = 0; il < logbank.logs.Size (); ++il ) {
if ( il > nextlog ) nextlog = il;
if ( !logbank.logs.ValidIndex (il) ) {
// This is a blank spot
// Look for the next available log to fill this space
bool found = false;
for ( ; nextlog < logbank.logs.Size (); ++nextlog ) {
if ( logbank.logs.ValidIndex (nextlog) ) {
logbank.logs.PutData ( logbank.logs.GetData (nextlog), il );
logbank.logs.RemoveData (nextlog);
if ( logbank.internallogs.ValidIndex(nextlog) ) {
logbank.internallogs.PutData ( logbank.internallogs.GetData (nextlog), il );
logbank.internallogs.RemoveData (nextlog);
}
++nextlog;
found = true;
break;
}
}
if ( !found ) {
// There are no more valid logs -
// So resize the DArray since this is now the max size
// Then quit
logbank.logs.SetSize ( il );
logbank.internallogs.SetSize ( il );
break;
}
}
}
}