1 /*
2  *  "GEDKeeper", the personal genealogical database editor.
3  *  Copyright (C) 2009-2021 by Sergey V. Zhdanovskih.
4  *
5  *  This file is part of "GEDKeeper".
6  *
7  *  This program 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 3 of the License, or
10  *  (at your option) any later version.
11  *
12  *  This program 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 this program.  If not, see <http://www.gnu.org/licenses/>.
19  */
20 
21 using GDModel.Providers.GEDCOM;
22 
23 namespace GDModel
24 {
25     public enum GDMOrdinanceProcessFlag
26     {
27         opNone,
28         opYes,
29         opNo
30     }
31 
32 
33     public sealed class GDMSubmissionRecord : GDMRecord
34     {
35         private string fFamilyFileName;
36         private string fTempleCode;
37         private int fGenerationsOfAncestors;
38         private int fGenerationsOfDescendants;
39         private GDMOrdinanceProcessFlag fOrdinanceProcessFlag;
40         private GDMPointer fSubmitter;
41 
42         public string FamilyFileName
43         {
44             get { return fFamilyFileName; }
45             set { fFamilyFileName = value; }
46         }
47 
48         public string TempleCode
49         {
50             get { return fTempleCode; }
51             set { fTempleCode = value; }
52         }
53 
54         public int GenerationsOfAncestors
55         {
56             get { return fGenerationsOfAncestors; }
57             set { fGenerationsOfAncestors = value; }
58         }
59 
60         public int GenerationsOfDescendants
61         {
62             get { return fGenerationsOfDescendants; }
63             set { fGenerationsOfDescendants = value; }
64         }
65 
66         public GDMOrdinanceProcessFlag OrdinanceProcessFlag
67         {
68             get { return fOrdinanceProcessFlag; }
69             set { fOrdinanceProcessFlag = value; }
70         }
71 
72         public GDMPointer Submitter
73         {
74             get { return fSubmitter; }
75         }
76 
77 
GDMSubmissionRecord(GDMTree tree)78         public GDMSubmissionRecord(GDMTree tree) : base(tree)
79         {
80             SetName(GEDCOMTagType.SUBN);
81 
82             fFamilyFileName = string.Empty;
83             fTempleCode = string.Empty;
84             fGenerationsOfAncestors = -1;
85             fGenerationsOfDescendants = -1;
86             fOrdinanceProcessFlag = GDMOrdinanceProcessFlag.opNone;
87             fSubmitter = new GDMPointer((int)GEDCOMTagType.SUBM, string.Empty);
88         }
89 
TrimExcess()90         internal override void TrimExcess()
91         {
92             base.TrimExcess();
93 
94             fSubmitter.TrimExcess();
95         }
96 
Clear()97         public override void Clear()
98         {
99             base.Clear();
100 
101             fFamilyFileName = string.Empty;
102             fTempleCode = string.Empty;
103             fGenerationsOfAncestors = -1;
104             fGenerationsOfDescendants = -1;
105             fOrdinanceProcessFlag = GDMOrdinanceProcessFlag.opNone;
106             fSubmitter.Clear();
107         }
108 
IsEmpty()109         public override bool IsEmpty()
110         {
111             return base.IsEmpty() && string.IsNullOrEmpty(fFamilyFileName) && string.IsNullOrEmpty(fTempleCode) &&
112                 (fGenerationsOfAncestors == -1) && (fGenerationsOfDescendants == -1) &&
113                 (fOrdinanceProcessFlag == GDMOrdinanceProcessFlag.opNone) && (fSubmitter.IsEmpty());
114         }
115 
ReplaceXRefs(GDMXRefReplacer map)116         public override void ReplaceXRefs(GDMXRefReplacer map)
117         {
118             base.ReplaceXRefs(map);
119 
120             fSubmitter.ReplaceXRefs(map);
121         }
122     }
123 }
124