xref: /webtrees/app/Gedcom.php (revision 5c7ad0344fcade138718fdab5f17d83b0f992412)
1<?php
2/**
3 * webtrees: online genealogy
4 * Copyright (C) 2018 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    const EOL = "\r\n";
27
28    // 255 less the EOL character.
29    const LINE_LENGTH = 253;
30
31    // Gedcom tags which indicate the start of life.
32    const BIRTH_EVENTS = ['BIRT', 'CHR', 'BAPM', 'ADOP'];
33
34    // Gedcom tags which indicate the end of life.
35    const DEATH_EVENTS = ['DEAT', 'BURI', 'CREM'];
36
37    // Gedcom tags which indicate the start of a relationship.
38    const MARRIAGE_EVENTS = ['MARR', '_NMR'];
39
40    // Gedcom tags which indicate the end of a relationship.
41    const DIVORCE_EVENTS = ['DIV', 'ANUL', '_SEPR'];
42
43    // Regular expression to match a GEDCOM tag.
44    const REGEX_TAG = '[_A-Z][_A-Z0-9]*';
45
46    // Regular expression to match a GEDCOM XREF.
47    const REGEX_XREF = '[A-Za-z0-9:_-]+';
48
49    // UTF-8 encoded files may begin with an optional byte-order-mark (U+FEFF).
50    const UTF8_BOM = "\xEF\xBB\xBF";
51}
52