| 1 |
/* |
| 2 |
* VacationList.cpp - TaskJuggler |
| 3 |
* |
| 4 |
* SPDX-FileCopyrightText: 2001, 2002, 2003, 2004 Chris Schlaeger <[email protected]> |
| 5 |
* |
| 6 |
* This program is free software; you can redistribute it and/or modify |
| 7 |
* it under the terms of version 2 of the GNU General Public License as |
| 8 |
* published by the Free Software Foundation. |
| 9 |
* |
| 10 |
* $Id$ |
| 11 |
*/ |
| 12 |
|
| 13 |
// clazy:excludeall=qstring-arg |
| 14 |
#include "VacationList.h" |
| 15 |
|
| 16 |
namespace TJ |
| 17 |
{ |
| 18 |
|
| 19 |
VacationList::~VacationList() |
| 20 |
{ |
| 21 |
while(!isEmpty()) { |
| 22 |
delete takeFirst(); |
| 23 |
} |
| 24 |
} |
| 25 |
|
| 26 |
void |
| 27 |
VacationList::inSort(VacationInterval* vi) |
| 28 |
{ |
| 29 |
//TODO |
| 30 |
append(vi); |
| 31 |
} |
| 32 |
|
| 33 |
void |
| 34 |
VacationList::add(const QString& name, const Interval& i) |
| 35 |
{ |
| 36 |
inSort(new VacationInterval(name, i)); |
| 37 |
} |
| 38 |
|
| 39 |
void |
| 40 |
VacationList::add(VacationInterval* vi) |
| 41 |
{ |
| 42 |
inSort(vi); |
| 43 |
} |
| 44 |
|
| 45 |
|
| 46 |
bool |
| 47 |
VacationList::isVacation(time_t date) const |
| 48 |
{ |
| 49 |
for (VacationList::Iterator vli(*this); vli.hasNext();) |
| 50 |
if (vli.next()->contains(date)) |
| 51 |
return true; |
| 52 |
|
| 53 |
return false; |
| 54 |
} |
| 55 |
|
| 56 |
QString |
| 57 |
VacationList::vacationName(time_t date) const |
| 58 |
{ |
| 59 |
for (VacationList::Iterator vli(*this); vli.hasNext();) { |
| 60 |
VacationInterval *v = vli.next(); |
| 61 |
if (v->contains(date)) |
| 62 |
return v->getName(); |
| 63 |
} |
| 64 |
return QString(); |
| 65 |
} |
| 66 |
|
| 67 |
} // namespace TJ |