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