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 System;
22 using GDModel.Providers.GEDCOM;
23 
24 namespace GDModel
25 {
26     public enum GDMLanguageID
27     {
28         Unknown,
29 
30         Afrikaans,
31         Akkadian,       // <extinct>
32         Albanian,
33         Amharic,        // Ethiopia
34         AncientGreek,   // <ancient>
35         AngloSaxon,
36         Arabic,
37         Armenian,
38         Assamese,       // Bangladesh, Bhutan, India
39         Belorusian,
40         Bengali,        // Bangladesh, India
41         Braj,           // India
42         Bulgarian,
43         Burmese,        // Myanmar/Burma
44         Cantonese,      // Chinese
45         Catalan,
46         CatalanSpn,
47         ChurchSlavic,
48         Czech,
49         Danish,
50         Dogri,          // India
51         Dutch,
52         Eblaite,        // <extinct>
53         English,
54         Esperanto,
55         Estonian,
56         Faroese,
57         Finnish,
58         French,
59         Georgian,
60         German,
61         Greek,
62         Gujarati,       // India
63         Hattic,         // <extinct>
64         Hawaiian,
65         Hebrew,         // Israel
66         Hindi,          // India
67         Hittite,        // <extinct>
68         Hungarian,
69         Hurrian,        // <extinct>
70         Icelandic,
71         Indonesian,
72         Italian,
73         Japanese,
74         Kannada,        // India
75         Kazakh,
76         Khmer,          // Cambodia
77         Konkani,        // India
78         Korean,
79         Lahnda,         // Pakistan
80         Lao,            // Laos, Thailand
81         Latin,          // <ancient>
82         Latvian,
83         Lithuanian,
84         Luwian,         // <extinct>
85         Macedonian,
86         Maithili,       // Nepal, India
87         Malayalam,      // India
88         Mandrin,        // Chinese
89         Manipuri,       // India
90         Marathi,        // India
91         Mewari,         // India
92         MitanniAryan,   // <extinct>
93         Navaho,
94         Nepali,         // Nepal
95         Norwegian,
96         Oriya,          // India
97         Pahari,         // Nepal, India, Pakistan
98         Palaic,         // <extinct>
99         Pali,           // India
100         Panjabi,        // India, Pakistan
101         Persian,
102         Polish,
103         Portuguese,
104         Prakrit,        // India
105         Pusto,
106         Rajasthani,     // India
107         Romanian,
108         Russian,
109         Sanskrit,
110         Serb,
111         SerboCroatian,
112         Slovak,
113         Slovene,
114         Spanish,
115         Sumerian,       // <extinct>
116         Swedish,
117         Tagalog,        // Philippines
118         Tamil,          // India
119         Telugu,         // India
120         Thai,
121         Tibetan,
122         Turkish,
123         Ukrainian,
124         Urdu,           // India, Pakistan
125         Vietnamese,
126         Wendic,
127         Yiddish,
128     }
129 
130 
131     /// <summary>
132     ///
133     /// </summary>
134     public sealed class GDMLanguage : GDMTag
135     {
136         private GDMLanguageID fValue;
137 
138         public GDMLanguageID Value
139         {
140             get { return fValue; }
141             set { fValue = value; }
142         }
143 
Clear()144         public override void Clear()
145         {
146             base.Clear();
147             fValue = GDMLanguageID.Unknown;
148         }
149 
IsEmpty()150         public override bool IsEmpty()
151         {
152             return base.IsEmpty() && (fValue == GDMLanguageID.Unknown);
153         }
154 
Assign(GDMTag source)155         public override void Assign(GDMTag source)
156         {
157             GDMLanguage srcLang = (source as GDMLanguage);
158             if (srcLang == null)
159                 throw new ArgumentException(@"Argument is null or wrong type", "source");
160 
161             base.Assign(source);
162 
163             fValue = srcLang.fValue;
164         }
165 
ParseString(string strValue)166         public override string ParseString(string strValue)
167         {
168             fValue = GEDCOMUtils.GetLanguageVal(strValue);
169             return string.Empty;
170         }
171 
GetStringValue()172         protected override string GetStringValue()
173         {
174             return GEDCOMUtils.GetLanguageStr(fValue);
175         }
176 
GDMLanguage()177         public GDMLanguage()
178         {
179             SetName(GEDCOMTagType.LANG);
180         }
181 
GDMLanguage(int tagId, string tagValue)182         public GDMLanguage(int tagId, string tagValue) : this()
183         {
184             SetNameValue(tagId, tagValue);
185         }
186     }
187 }
188