summaryrefslogtreecommitdiffstats
path: root/clang-tools-extra/clang-tidy-vs/ClangTidy/ForwardingPropertyDescriptor.cs
blob: 22b08fbb5433c7c0fee6a41a48d571dd6a05571f (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace LLVM.ClangTidy
{
    /// <summary>
    /// A decorator of sorts.  Accepts a PropertyDescriptor to its constructor
    /// and forwards all calls to the underlying PropertyDescriptor.  In this way
    /// we can inherit from ForwardingPropertyDescriptor and override only the
    /// few methods we need to customize the behavior of, while allowing the
    /// underlying PropertyDescriptor to do the real work.
    /// </summary>
    public abstract class ForwardingPropertyDescriptor : PropertyDescriptor
    {
        private readonly PropertyDescriptor root;
        protected PropertyDescriptor Root { get { return root; } }
        protected ForwardingPropertyDescriptor(PropertyDescriptor root)
            : base(root)
        {
            this.root = root;
        }

        public override void AddValueChanged(object component, EventHandler handler)
        {
            root.AddValueChanged(component, handler);
        }

        public override AttributeCollection Attributes
        {
            get
            {
                return root.Attributes;
            }
        }

        public override bool CanResetValue(object component)
        {
            return root.CanResetValue(component);
        }

        public override string Category
        {
            get
            {
                return root.Category;
            }
        }

        public override Type ComponentType
        {
            get
            {
                return root.ComponentType;
            }
        }

        public override TypeConverter Converter
        {
            get
            {
                return root.Converter;
            }
        }

        public override string Description
        {
            get
            {
                return root.Description;
            }
        }

        public override bool DesignTimeOnly
        {
            get
            {
                return root.DesignTimeOnly;
            }
        }

        public override string DisplayName
        {
            get
            {
                return root.DisplayName;
            }
        }

        public override bool Equals(object obj)
        {
            return root.Equals(obj);
        }

        public override PropertyDescriptorCollection GetChildProperties(object instance, Attribute[] filter)
        {
            return root.GetChildProperties(instance, filter);
        }

        public override object GetEditor(Type editorBaseType)
        {
            return root.GetEditor(editorBaseType);
        }

        public override int GetHashCode()
        {
            return root.GetHashCode();
        }

        public override object GetValue(object component)
        {
            return root.GetValue(component);
        }

        public override bool IsBrowsable
        {
            get
            {
                return root.IsBrowsable;
            }
        }

        public override bool IsLocalizable
        {
            get
            {
                return root.IsLocalizable;
            }
        }

        public override bool IsReadOnly
        {
            get
            {
                return root.IsReadOnly;
            }
        }

        public override string Name
        {
            get
            {
                return root.Name;
            }
        }

        public override Type PropertyType
        {
            get
            {
                return root.PropertyType;
            }
        }

        public override void RemoveValueChanged(object component, EventHandler handler)
        {
            root.RemoveValueChanged(component, handler);
        }

        public override void ResetValue(object component)
        {
            root.ResetValue(component);
        }

        public override void SetValue(object component, object value)
        {
            root.SetValue(component, value);
        }

        public override bool ShouldSerializeValue(object component)
        {
            return root.ShouldSerializeValue(component);
        }

        public override bool SupportsChangeEvents
        {
            get
            {
                return root.SupportsChangeEvents;
            }
        }

        public override string ToString()
        {
            return root.ToString();
        }
    }
}
OpenPOWER on IntegriCloud