~ubuntu-branches/ubuntu/trusty/mono-addins/trusty-proposed

« back to all changes in this revision

Viewing changes to Mono.Addins/Mono.Addins/ExtensionAttributeAttribute.cs

  • Committer: Bazaar Package Importer
  • Author(s): Jo Shields
  • Date: 2011-04-25 11:11:33 UTC
  • mfrom: (4.1.5 sid)
  • Revision ID: james.westby@ubuntu.com-20110425111133-t05u5p7o5fxx70fu
Tags: 0.6-2
Upload to Unstable

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
// 
 
2
// ExtensionAttributeAttribute.cs
 
3
//  
 
4
// Author:
 
5
//       Lluis Sanchez Gual <lluis@novell.com>
 
6
// 
 
7
// Copyright (c) 2010 Novell, Inc (http://www.novell.com)
 
8
// 
 
9
// Permission is hereby granted, free of charge, to any person obtaining a copy
 
10
// of this software and associated documentation files (the "Software"), to deal
 
11
// in the Software without restriction, including without limitation the rights
 
12
// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
 
13
// copies of the Software, and to permit persons to whom the Software is
 
14
// furnished to do so, subject to the following conditions:
 
15
// 
 
16
// The above copyright notice and this permission notice shall be included in
 
17
// all copies or substantial portions of the Software.
 
18
// 
 
19
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
 
20
// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
 
21
// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
 
22
// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
 
23
// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
 
24
// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
 
25
// THE SOFTWARE.
 
26
 
 
27
using System;
 
28
 
 
29
namespace Mono.Addins
 
30
{
 
31
        /// <summary>
 
32
        /// Assigns an attribute value to an extension
 
33
        /// </summary>
 
34
        /// <remarks>
 
35
        /// This attribute can be used together with the [Extenion] attribute to specify
 
36
        /// a value for an attribute of the extension.
 
37
        /// </remarks>
 
38
        public class ExtensionAttributeAttribute: Attribute
 
39
        {
 
40
                Type targetType;
 
41
                string targetTypeName;
 
42
                string name;
 
43
                string val;
 
44
                string path;
 
45
                
 
46
                /// <summary>
 
47
                /// Initializes a new instance of the <see cref="Mono.Addins.ExtensionAttributeAttribute"/> class.
 
48
                /// </summary>
 
49
                /// <param name='name'>
 
50
                /// Name of the attribute
 
51
                /// </param>
 
52
                /// <param name='value'>
 
53
                /// Value of the attribute
 
54
                /// </param>
 
55
                public ExtensionAttributeAttribute (string name, string value)
 
56
                {
 
57
                        Name = name;
 
58
                        Value = value;
 
59
                }
 
60
                
 
61
                /// <summary>
 
62
                /// Initializes a new instance of the <see cref="Mono.Addins.ExtensionAttributeAttribute"/> class.
 
63
                /// </summary>
 
64
                /// <param name='type'>
 
65
                /// Type of the extension for which the attribute value is being set
 
66
                /// </param>
 
67
                /// <param name='name'>
 
68
                /// Name of the attribute
 
69
                /// </param>
 
70
                /// <param name='value'>
 
71
                /// Value of the attribute
 
72
                /// </param>
 
73
                public ExtensionAttributeAttribute (Type type, string name, string value)
 
74
                {
 
75
                        Name = name;
 
76
                        Value = value;
 
77
                        Type = type;
 
78
                }
 
79
                
 
80
                /// <summary>
 
81
                /// Initializes a new instance of the <see cref="Mono.Addins.ExtensionAttributeAttribute"/> class.
 
82
                /// </summary>
 
83
                /// <param name='path'>
 
84
                /// Path of the extension for which the attribute value is being set
 
85
                /// </param>
 
86
                /// <param name='name'>
 
87
                /// Name of the attribute
 
88
                /// </param>
 
89
                /// <param name='value'>
 
90
                /// Value of the attribute
 
91
                /// </param>
 
92
                public ExtensionAttributeAttribute (string path, string name, string value)
 
93
                {
 
94
                        Name = name;
 
95
                        Value = value;
 
96
                        Path = path;
 
97
                }
 
98
                
 
99
                /// <summary>
 
100
                /// Name of the attribute
 
101
                /// </summary>
 
102
                public string Name {
 
103
                        get { return this.name; }
 
104
                        set { this.name = value; }
 
105
                }
 
106
 
 
107
                /// <summary>
 
108
                /// Value of the attribute
 
109
                /// </summary>
 
110
                public string Value {
 
111
                        get { return this.val; }
 
112
                        set { this.val = value; }
 
113
                }
 
114
 
 
115
                /// <summary>
 
116
                /// Path of the extension for which the attribute value is being set
 
117
                /// </summary>
 
118
                public string Path {
 
119
                        get { return this.path; }
 
120
                        set { this.path = value; }
 
121
                }
 
122
 
 
123
                /// <summary>
 
124
                /// Type of the extension for which the attribute value is being set
 
125
                /// </summary>
 
126
                public Type Type {
 
127
                        get { return targetType; }
 
128
                        set { targetType = value; targetTypeName = targetType.FullName; }
 
129
                }
 
130
                
 
131
                internal string TypeName {
 
132
                        get { return targetTypeName ?? string.Empty; }
 
133
                        set { targetTypeName = value; }
 
134
                }
 
135
        }
 
136
}
 
137