| 1 |
|
/** |
| 2 |
|
Copyright 2002 Cyril Picard |
| 3 |
|
|
| 4 |
|
This file is part of the GEDCOMParser library |
| 5 |
|
(developed within the Genealogy Free Software Tools project). |
| 6 |
|
|
| 7 |
|
The GEDCOMParser library is free software; you can redistribute it and/or modify |
| 8 |
|
it under the terms of the GNU General Public License as published by |
| 9 |
|
the Free Software Foundation; either version 2 of the License, or |
| 10 |
|
(at your option) any later version. |
| 11 |
|
|
| 12 |
|
The GEDCOMParser library is distributed in the hope that it will be useful, |
| 13 |
|
but WITHOUT ANY WARRANTY; without even the implied warranty of |
| 14 |
|
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
| 15 |
|
GNU General Public License for more details. |
| 16 |
|
|
| 17 |
|
You should have received a copy of the GNU General Public License |
| 18 |
|
along with the GEDCOMParser library ; if not, write to the Free Software |
| 19 |
|
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA |
| 20 |
|
|
| 21 |
|
**/ |
| 22 |
|
|
| 23 |
|
#include "GEDCOMParser/DateManagement/Period.hh" |
| 24 |
|
#ifdef HAVE_CONFIG_H |
| 25 |
|
#include "config.h" |
| 26 |
|
#endif // HAVE_CONFIG_H |
| 27 |
|
|
| 28 |
|
#include "gettext.h" |
| 29 |
|
#define _(String) dgettext(PACKAGE, String) |
| 30 |
|
|
| 31 |
|
void GEDCOMParser::DateManagement::Period::setDateFrom(GEDCOMParser::DateManagement::Date const &from) |
| 32 |
|
{ |
| 33 |
|
_date_from = new GEDCOMParser::DateManagement::Date(from); |
| 34 |
|
return; |
| 35 |
|
} |
| 36 |
|
|
| 37 |
|
void GEDCOMParser::DateManagement::Period::setDateTo(GEDCOMParser::DateManagement::Date const &to) |
| 38 |
|
{ |
| 39 |
|
if ((_date_to != 0) && (_date_to != &to)) |
| 40 |
|
{ |
| 41 |
|
delete _date_to; _date_to = 0; |
| 42 |
|
} |
| 43 |
|
if (_date_to != &to) |
| 44 |
|
{ |
| 45 |
|
_date_to = new GEDCOMParser::DateManagement::Date(to); |
| 46 |
|
} |
| 47 |
|
return; |
| 48 |
|
} |
| 49 |
|
|
| 50 |
|
std::string const GEDCOMParser::DateManagement::Period::getDisplayValue(void) const |
| 51 |
|
{ |
| 52 |
|
std::string res; |
| 53 |
|
if (_date_from != 0) |
| 54 |
|
{ |
| 55 |
|
res = _("From ") + _date_from->getDisplayValue(); |
| 56 |
|
} |
| 57 |
|
if (_date_to != 0) |
| 58 |
|
{ |
| 59 |
|
if (res != "") |
| 60 |
|
{ |
| 61 |
|
res = res + _(" to ") + _date_to->getDisplayValue(); |
| 62 |
|
} |
| 63 |
|
else |
| 64 |
|
{ |
| 65 |
|
res = res + _("To ") + _date_to->getDisplayValue(); |
| 66 |
|
} |
| 67 |
|
} |
| 68 |
|
return res; |
| 69 |
|
} |