xref: /webtrees/app/Gedcom.php (revision 3976b4703df669696105ed6b024b96d433c8fbdb)
1<?php
2
3/**
4 * webtrees: online genealogy
5 * Copyright (C) 2019 webtrees development team
6 * This program is free software: you can redistribute it and/or modify
7 * it under the terms of the GNU General Public License as published by
8 * the Free Software Foundation, either version 3 of the License, or
9 * (at your option) any later version.
10 * This program is distributed in the hope that it will be useful,
11 * but WITHOUT ANY WARRANTY; without even the implied warranty of
12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 * GNU General Public License for more details.
14 * You should have received a copy of the GNU General Public License
15 * along with this program. If not, see <http://www.gnu.org/licenses/>.
16 */
17declare(strict_types=1);
18
19namespace Fisharebest\Webtrees;
20
21/**
22 * GEDCOM 5.5.1 specification
23 */
24class Gedcom
25{
26    // Use MSDOS style line endings, for maximum compatibility.
27    public const EOL = "\r\n";
28
29    // 255 less the EOL character.
30    public const LINE_LENGTH = 253;
31
32    // Gedcom tags which indicate the start of life.
33    public const BIRTH_EVENTS = ['BIRT', 'CHR', 'BAPM', 'ADOP'];
34
35    // Gedcom tags which indicate the end of life.
36    public const DEATH_EVENTS = ['DEAT', 'BURI', 'CREM'];
37
38    // Gedcom tags which indicate the start of a relationship.
39    public const MARRIAGE_EVENTS = ['MARR', '_NMR'];
40
41    // Gedcom tags which indicate the end of a relationship.
42    public const DIVORCE_EVENTS = ['DIV', 'ANUL', '_SEPR'];
43
44    // Regular expression to match a GEDCOM tag.
45    public const REGEX_TAG = '[_A-Z][_A-Z0-9]*';
46
47    // Regular expression to match a GEDCOM XREF.
48    public const REGEX_XREF = '[A-Za-z0-9:_-]+';
49
50    // UTF-8 encoded files may begin with an optional byte-order-mark (U+FEFF).
51    public const UTF8_BOM = "\xEF\xBB\xBF";
52
53    // Separates parts of a place name.
54    public const PLACE_SEPARATOR = ', ';
55
56    // Regex to match a (badly formed) GEDCOM place separator.
57    public const PLACE_SEPARATOR_REGEX = ' *, *';
58}
59