| 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 |
|
#ifndef _GEDCOMPARSER_DATEMANAGEMENT_DATE_HH_ |
| 24 |
|
#define _GEDCOMPARSER_DATEMANAGEMENT_DATE_HH_ |
| 25 |
|
|
| 26 |
|
#include <string> |
| 27 |
|
|
| 28 |
|
/// |
| 29 |
|
namespace GEDCOMParser |
| 30 |
|
{ |
| 31 |
|
/// |
| 32 |
|
namespace DateManagement |
| 33 |
|
{ |
| 34 |
|
/** @memo Implements the GEDCOM 5.5 DATE primitive element |
| 35 |
|
The GEDCOM 5.5 specifications are extensed to manage french years with roman notation. The specification is now : |
| 36 |
|
DATE_FREN: = {Size=4:35} |
| 37 |
|
[ <YEAR_FREN> | <MONTH_FREN> <YEAR_FREN> | <DAY> <MONTH_FREN> <YEAR_FREN> | <YEAR> | <MONTH_FREN> <YEAR> | <DAY> <MONTH_FREN> <YEAR> ] |
| 38 |
|
YEAR_FREN: = |
| 39 |
|
[ AN | an | <NULL> ] ROMAN_NUMBER_YEAR |
| 40 |
|
ROMAN_NUMBER_YEAR:= |
| 41 |
|
[ I | II | III | IV | V | VI | VII | VIII | IX | X | XI | XII | XIII | XIV | i | ii | iii | iv | v | vi | vii | viii | ix | x | xi | xii | xiii | xiv] |
| 42 |
|
For more details about French Republican calendar check \URL[Genealogy in France: Republican Calendar]{http://www.francogene.com/search-fr/calrep.html} |
| 43 |
|
*/ |
| 44 |
|
class Date |
| 45 |
|
{ |
| 46 |
|
public: |
| 47 |
|
/// @memo Implements the GEDCOM 5.5 CALENDARS enumeration (typedef'd to enumCalendars) |
| 48 |
|
enum _enumCalendars |
| 49 |
|
{ |
| 50 |
|
/// |
| 51 |
|
e_Gregorian, |
| 52 |
|
/// |
| 53 |
|
e_Julian, |
| 54 |
|
/// |
| 55 |
|
e_French, |
| 56 |
|
/// |
| 57 |
|
e_Hebrew, |
| 58 |
|
/// |
| 59 |
|
e_Future, |
| 60 |
|
/// |
| 61 |
|
e_Unknown |
| 62 |
|
}; |
| 63 |
|
/// |
| 64 |
|
typedef enum _enumCalendars enumCalendars; |
| 65 |
|
/// @memo Implements the GEDCOM 5.5 DATE PRECISIONS enumeration (typedef'd to enumPrecisionDateTypes) |
| 66 |
|
enum _enumPrecisionDateTypes |
| 67 |
|
{ |
| 68 |
|
/// |
| 69 |
|
e_PrecisionNull, |
| 70 |
|
/// |
| 71 |
|
e_Exact, |
| 72 |
|
/// |
| 73 |
|
e_About, |
| 74 |
|
/// |
| 75 |
|
e_Calculated, |
| 76 |
|
/// |
| 77 |
|
e_Estimated |
| 78 |
|
}; |
| 79 |
|
/// |
| 80 |
|
typedef enum _enumPrecisionDateTypes enumPrecisionDateTypes; |
| 81 |
|
/// @memo Implements the months enumeration (typedef'd to enumMonths) |
| 82 |
|
enum _enumMonths |
| 83 |
|
{ |
| 84 |
|
/// |
| 85 |
|
e_MonthNull, |
| 86 |
|
/// |
| 87 |
|
e_Jan, |
| 88 |
|
/// |
| 89 |
|
e_Feb, |
| 90 |
|
/// |
| 91 |
|
e_Mar, |
| 92 |
|
/// |
| 93 |
|
e_Apr, |
| 94 |
|
/// |
| 95 |
|
e_May, |
| 96 |
|
/// |
| 97 |
|
e_Jun, |
| 98 |
|
/// |
| 99 |
|
e_Jul, |
| 100 |
|
/// |
| 101 |
|
e_Aug, |
| 102 |
|
/// |
| 103 |
|
e_Sep, |
| 104 |
|
/// |
| 105 |
|
e_Oct, |
| 106 |
|
/// |
| 107 |
|
e_Nov, |
| 108 |
|
/// |
| 109 |
|
e_Dec, |
| 110 |
|
/// |
| 111 |
|
e_Hebr_Tsh, |
| 112 |
|
/// |
| 113 |
|
e_Hebr_Csh, |
| 114 |
|
/// |
| 115 |
|
e_Hebr_Ksl, |
| 116 |
|
/// |
| 117 |
|
e_Hebr_Tvt, |
| 118 |
|
/// |
| 119 |
|
e_Hebr_Shv, |
| 120 |
|
/// |
| 121 |
|
e_Hebr_Adr, |
| 122 |
|
/// |
| 123 |
|
e_Hebr_Ads, |
| 124 |
|
/// |
| 125 |
|
e_Hebr_Nsn, |
| 126 |
|
/// |
| 127 |
|
e_Hebr_Iyr, |
| 128 |
|
/// |
| 129 |
|
e_Hebr_Svn, |
| 130 |
|
/// |
| 131 |
|
e_Hebr_Tmz, |
| 132 |
|
/// |
| 133 |
|
e_Hebr_Aav, |
| 134 |
|
/// |
| 135 |
|
e_Hebr_Ell, |
| 136 |
|
/// |
| 137 |
|
e_Fren_Vend, |
| 138 |
|
/// |
| 139 |
|
e_Fren_Brum, |
| 140 |
|
/// |
| 141 |
|
e_Fren_Frim, |
| 142 |
|
/// |
| 143 |
|
e_Fren_Nivo, |
| 144 |
|
/// |
| 145 |
|
e_Fren_Pluv, |
| 146 |
|
/// |
| 147 |
|
e_Fren_Vent, |
| 148 |
|
/// |
| 149 |
|
e_Fren_Germ, |
| 150 |
|
/// |
| 151 |
|
e_Fren_Flor, |
| 152 |
|
/// |
| 153 |
|
e_Fren_Prai, |
| 154 |
|
/// |
| 155 |
|
e_Fren_Mess, |
| 156 |
|
/// |
| 157 |
|
e_Fren_Ther, |
| 158 |
|
/// |
| 159 |
|
e_Fren_Fruc, |
| 160 |
|
/// |
| 161 |
|
e_Fren_Comp |
| 162 |
|
}; |
| 163 |
|
/// |
| 164 |
|
typedef enum _enumMonths enumMonths; |
| 165 |
|
/// @memo Store the format of the French year : decimal digit number (1794) or roman (VII) (typedef'd to enumFrenchYearFormat) |
| 166 |
|
enum _enumFrenchYearFormat |
| 167 |
|
{ |
| 168 |
|
/// |
| 169 |
|
e_FrenchYearFormat_Null, |
| 170 |
|
/// |
| 171 |
|
e_FrenchYearFormat_Decimal, |
| 172 |
|
/// |
| 173 |
|
e_FrenchYearFormat_Roman |
| 174 |
|
}; |
| 175 |
|
/// |
| 176 |
|
typedef enum _enumFrenchYearFormat enumFrenchYearFormat; |
| 177 |
|
Date(void) : |
| 178 |
|
_calendar(e_Gregorian), |
| 179 |
|
_day(""), |
| 180 |
|
_month(e_MonthNull), |
| 181 |
|
_year(""), |
| 182 |
|
_precision(e_PrecisionNull), |
| 183 |
|
_french_year_format(e_FrenchYearFormat_Null), |
| 184 |
|
_before_christ(false) |
| 185 |
|
{}; |
| 186 |
|
Date(Date const &d) : |
| 187 |
|
_calendar(d._calendar), |
| 188 |
|
_day(d._day), |
| 189 |
|
_month(d._month), |
| 190 |
|
_year(d._year), |
| 191 |
|
_precision(d._precision), |
| 192 |
|
_french_year_format(d._french_year_format), |
| 193 |
|
_before_christ(d._before_christ) |
| 194 |
|
{ |
| 195 |
|
}; |
| 196 |
|
///@name Accessors (set) |
| 197 |
|
//@{ |
| 198 |
|
/// |
| 199 |
|
void setCalendar(enumCalendars cal); |
| 200 |
|
/// |
| 201 |
|
void setDay(std::string const &day); |
| 202 |
|
/// |
| 203 |
|
void setMonth(enumMonths month); |
| 204 |
|
/// |
| 205 |
|
void setYear(std::string const &year); |
| 206 |
|
/// |
| 207 |
|
void setPrecision(enumPrecisionDateTypes prec); |
| 208 |
|
/// |
| 209 |
|
void setFrenchYearFormat(enumFrenchYearFormat format); |
| 210 |
|
/// |
| 211 |
|
void setBeforeChrist(bool val); |
| 212 |
|
//@} |
| 213 |
|
|
| 214 |
|
///@name Accessors (get) |
| 215 |
|
//@{ |
| 216 |
|
/// |
| 217 |
|
std::string const getDisplayValue(void) const; |
| 218 |
|
//@} |
| 219 |
|
private: |
| 220 |
|
enumCalendars _calendar; |
| 221 |
|
std::string _day; |
| 222 |
|
enumMonths _month; |
| 223 |
|
std::string _year; |
| 224 |
|
enumPrecisionDateTypes _precision; |
| 225 |
|
enumFrenchYearFormat _french_year_format; |
| 226 |
|
bool _before_christ; |
| 227 |
|
}; |
| 228 |
|
}; |
| 229 |
|
}; |
| 230 |
|
|
| 231 |
|
#endif |