1 |
/** |
/* |
2 |
Copyright 2002 Cyril Picard |
Copyright 2002 Cyril Picard |
3 |
|
|
4 |
This file is part of the GEDCOMParser library |
This file is part of the GEDCOMParser library |
18 |
along with the GEDCOMParser library ; if not, write to the Free Software |
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 |
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA |
20 |
|
|
21 |
**/ |
*/ |
22 |
|
|
23 |
#ifndef _GEDCOMPARSER_DATEMANAGEMENT_DATE_HH_ |
#ifndef _GEDCOMPARSER_DATEMANAGEMENT_DATE_HH_ |
24 |
#define _GEDCOMPARSER_DATEMANAGEMENT_DATE_HH_ |
#define _GEDCOMPARSER_DATEMANAGEMENT_DATE_HH_ |
25 |
|
|
26 |
#include <string> |
#include <string> |
27 |
|
|
28 |
|
/// |
29 |
namespace GEDCOMParser |
namespace GEDCOMParser |
30 |
{ |
{ |
31 |
|
/// |
32 |
namespace DateManagement |
namespace DateManagement |
33 |
{ |
{ |
|
class Date |
|
34 |
/** @memo Implements the GEDCOM 5.5 DATE primitive element |
/** @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: |
public: |
47 |
/// @memo Implements the GEDCOM 5.5 CALENDARS enumeration (typedef'd to enumCalendars) |
/// @memo Implements the GEDCOM 5.5 CALENDARS enumeration (typedef'd to enumCalendars) |
60 |
/// |
/// |
61 |
e_Unknown |
e_Unknown |
62 |
}; |
}; |
63 |
|
/// |
64 |
typedef enum _enumCalendars enumCalendars; |
typedef enum _enumCalendars enumCalendars; |
65 |
/// @memo Implements the GEDCOM 5.5 DATE PRECISIONS enumeration (typedef'd to enumPrecisionDateTypes) |
/// @memo Implements the GEDCOM 5.5 DATE PRECISIONS enumeration (typedef'd to enumPrecisionDateTypes) |
66 |
enum _enumPrecisionDateTypes |
enum _enumPrecisionDateTypes |
76 |
/// |
/// |
77 |
e_Estimated |
e_Estimated |
78 |
}; |
}; |
79 |
|
/// |
80 |
typedef enum _enumPrecisionDateTypes enumPrecisionDateTypes; |
typedef enum _enumPrecisionDateTypes enumPrecisionDateTypes; |
81 |
/// @memo Implements the months enumeration (typedef'd to enumMonths) |
/// @memo Implements the months enumeration (typedef'd to enumMonths) |
82 |
enum _enumMonths |
enum _enumMonths |
160 |
/// |
/// |
161 |
e_Fren_Comp |
e_Fren_Comp |
162 |
}; |
}; |
163 |
|
/// |
164 |
typedef enum _enumMonths enumMonths; |
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) : |
Date(void) : |
178 |
_calendar(e_Gregorian), |
_calendar(e_Gregorian), |
179 |
_day(""), |
_day(""), |
180 |
_month(e_MonthNull), |
_month(e_MonthNull), |
181 |
_year(""), |
_year(""), |
182 |
_precision(e_PrecisionNull) |
_precision(e_PrecisionNull), |
183 |
|
_french_year_format(e_FrenchYearFormat_Null) |
184 |
{}; |
{}; |
185 |
Date(Date const &d) : |
Date(Date const &d) : |
186 |
_calendar(d._calendar), |
_calendar(d._calendar), |
187 |
_day(d._day), |
_day(d._day), |
188 |
_month(d._month), |
_month(d._month), |
189 |
_year(d._year), |
_year(d._year), |
190 |
_precision(d._precision) |
_precision(d._precision), |
191 |
|
_french_year_format(d._french_year_format) |
192 |
{ |
{ |
193 |
}; |
}; |
194 |
|
///@name Accessors (set) |
195 |
|
//@{ |
196 |
|
/// |
197 |
void setCalendar(enumCalendars cal); |
void setCalendar(enumCalendars cal); |
198 |
|
/// |
199 |
void setDay(std::string const &day); |
void setDay(std::string const &day); |
200 |
|
/// |
201 |
void setMonth(enumMonths month); |
void setMonth(enumMonths month); |
202 |
|
/// |
203 |
void setYear(std::string const &year); |
void setYear(std::string const &year); |
204 |
|
/// |
205 |
void setPrecision(enumPrecisionDateTypes prec); |
void setPrecision(enumPrecisionDateTypes prec); |
206 |
|
/// |
207 |
|
void setFrenchYearFormat(enumFrenchYearFormat format); |
208 |
|
//@} |
209 |
|
|
210 |
|
///@name Accessors (get) |
211 |
|
//@{ |
212 |
|
/// |
213 |
std::string const getDisplayValue(void) const; |
std::string const getDisplayValue(void) const; |
214 |
|
//@} |
215 |
private: |
private: |
216 |
enumCalendars _calendar; |
enumCalendars _calendar; |
217 |
std::string _day; |
std::string _day; |
218 |
enumMonths _month; |
enumMonths _month; |
219 |
std::string _year; |
std::string _year; |
220 |
enumPrecisionDateTypes _precision; |
enumPrecisionDateTypes _precision; |
221 |
|
enumFrenchYearFormat _french_year_format; |
222 |
}; |
}; |
223 |
}; |
}; |
224 |
}; |
}; |