Paradox Game Engine  v1.0.0 beta06
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Events Macros Pages
LanguageAttribute.cs
Go to the documentation of this file.
1 #region License
2 /* **********************************************************************************
3  * Copyright (c) Roman Ivantsov
4  * This source code is subject to terms and conditions of the MIT License
5  * for Irony. A copy of the license can be found in the License.txt file
6  * at the root of this distribution.
7  * By using this source code in any fashion, you are agreeing to be bound by the terms of the
8  * MIT License.
9  * You must not remove this notice from this software.
10  * **********************************************************************************/
11 #endregion
12 
13 using System;
14 using System.Collections.Generic;
15 using System.Linq;
16 using System.Text;
17 
18 namespace Irony.Parsing {
19 
20  [AttributeUsage(AttributeTargets.Class)]
21  public class LanguageAttribute : Attribute {
22  public LanguageAttribute() : this(null) { }
23  public LanguageAttribute(string languageName) : this(languageName, "1.0", string.Empty) { }
24 
25  public LanguageAttribute(string languageName, string version, string description) {
26  _languageName = languageName;
27  _version = version;
28  _description = description;
29  }
30 
31  public string LanguageName {
32  get { return _languageName; }
33  } string _languageName;
34 
35  public string Version {
36  get { return _version; }
37  } string _version;
38 
39  public string Description {
40  get { return _description; }
41  } string _description;
42 
43  public static LanguageAttribute GetValue(Type grammarClass) {
44  object[] attrs = grammarClass.GetCustomAttributes(typeof(LanguageAttribute), true);
45  if (attrs != null && attrs.Length > 0) {
46  LanguageAttribute la = attrs[0] as LanguageAttribute;
47  return la;
48  }
49  return null;
50  }
51 
52  }//class
53 }//namespace
static LanguageAttribute GetValue(Type grammarClass)
LanguageAttribute(string languageName, string version, string description)
LanguageAttribute(string languageName)