Zachary Turner | 1122be8 | 2016-09-07 18:28:55 +0000 | [diff] [blame] | 1 | using System;
|
| 2 | using System.Collections.Generic;
|
| 3 | using System.ComponentModel;
|
| 4 | using System.Linq;
|
| 5 | using System.Text;
|
| 6 | using System.Threading.Tasks;
|
| 7 |
|
| 8 | namespace LLVM.ClangTidy
|
| 9 | {
|
| 10 | /// <summary>
|
| 11 | /// A decorator of sorts. Accepts a PropertyDescriptor to its constructor
|
| 12 | /// and forwards all calls to the underlying PropertyDescriptor. In this way
|
| 13 | /// we can inherit from ForwardingPropertyDescriptor and override only the
|
| 14 | /// few methods we need to customize the behavior of, while allowing the
|
| 15 | /// underlying PropertyDescriptor to do the real work.
|
| 16 | /// </summary>
|
| 17 | public abstract class ForwardingPropertyDescriptor : PropertyDescriptor
|
| 18 | {
|
| 19 | private readonly PropertyDescriptor root;
|
| 20 | protected PropertyDescriptor Root { get { return root; } }
|
| 21 | protected ForwardingPropertyDescriptor(PropertyDescriptor root)
|
| 22 | : base(root)
|
| 23 | {
|
| 24 | this.root = root;
|
| 25 | }
|
| 26 |
|
| 27 | public override void AddValueChanged(object component, EventHandler handler)
|
| 28 | {
|
| 29 | root.AddValueChanged(component, handler);
|
| 30 | }
|
| 31 |
|
| 32 | public override AttributeCollection Attributes
|
| 33 | {
|
| 34 | get
|
| 35 | {
|
| 36 | return root.Attributes;
|
| 37 | }
|
| 38 | }
|
| 39 |
|
| 40 | public override bool CanResetValue(object component)
|
| 41 | {
|
| 42 | return root.CanResetValue(component);
|
| 43 | }
|
| 44 |
|
| 45 | public override string Category
|
| 46 | {
|
| 47 | get
|
| 48 | {
|
| 49 | return root.Category;
|
| 50 | }
|
| 51 | }
|
| 52 |
|
| 53 | public override Type ComponentType
|
| 54 | {
|
| 55 | get
|
| 56 | {
|
| 57 | return root.ComponentType;
|
| 58 | }
|
| 59 | }
|
| 60 |
|
| 61 | public override TypeConverter Converter
|
| 62 | {
|
| 63 | get
|
| 64 | {
|
| 65 | return root.Converter;
|
| 66 | }
|
| 67 | }
|
| 68 |
|
| 69 | public override string Description
|
| 70 | {
|
| 71 | get
|
| 72 | {
|
| 73 | return root.Description;
|
| 74 | }
|
| 75 | }
|
| 76 |
|
| 77 | public override bool DesignTimeOnly
|
| 78 | {
|
| 79 | get
|
| 80 | {
|
| 81 | return root.DesignTimeOnly;
|
| 82 | }
|
| 83 | }
|
| 84 |
|
| 85 | public override string DisplayName
|
| 86 | {
|
| 87 | get
|
| 88 | {
|
| 89 | return root.DisplayName;
|
| 90 | }
|
| 91 | }
|
| 92 |
|
| 93 | public override bool Equals(object obj)
|
| 94 | {
|
| 95 | return root.Equals(obj);
|
| 96 | }
|
| 97 |
|
| 98 | public override PropertyDescriptorCollection GetChildProperties(object instance, Attribute[] filter)
|
| 99 | {
|
| 100 | return root.GetChildProperties(instance, filter);
|
| 101 | }
|
| 102 |
|
| 103 | public override object GetEditor(Type editorBaseType)
|
| 104 | {
|
| 105 | return root.GetEditor(editorBaseType);
|
| 106 | }
|
| 107 |
|
| 108 | public override int GetHashCode()
|
| 109 | {
|
| 110 | return root.GetHashCode();
|
| 111 | }
|
| 112 |
|
| 113 | public override object GetValue(object component)
|
| 114 | {
|
| 115 | return root.GetValue(component);
|
| 116 | }
|
| 117 |
|
| 118 | public override bool IsBrowsable
|
| 119 | {
|
| 120 | get
|
| 121 | {
|
| 122 | return root.IsBrowsable;
|
| 123 | }
|
| 124 | }
|
| 125 |
|
| 126 | public override bool IsLocalizable
|
| 127 | {
|
| 128 | get
|
| 129 | {
|
| 130 | return root.IsLocalizable;
|
| 131 | }
|
| 132 | }
|
| 133 |
|
| 134 | public override bool IsReadOnly
|
| 135 | {
|
| 136 | get
|
| 137 | {
|
| 138 | return root.IsReadOnly;
|
| 139 | }
|
| 140 | }
|
| 141 |
|
| 142 | public override string Name
|
| 143 | {
|
| 144 | get
|
| 145 | {
|
| 146 | return root.Name;
|
| 147 | }
|
| 148 | }
|
| 149 |
|
| 150 | public override Type PropertyType
|
| 151 | {
|
| 152 | get
|
| 153 | {
|
| 154 | return root.PropertyType;
|
| 155 | }
|
| 156 | }
|
| 157 |
|
| 158 | public override void RemoveValueChanged(object component, EventHandler handler)
|
| 159 | {
|
| 160 | root.RemoveValueChanged(component, handler);
|
| 161 | }
|
| 162 |
|
| 163 | public override void ResetValue(object component)
|
| 164 | {
|
| 165 | root.ResetValue(component);
|
| 166 | }
|
| 167 |
|
| 168 | public override void SetValue(object component, object value)
|
| 169 | {
|
| 170 | root.SetValue(component, value);
|
| 171 | }
|
| 172 |
|
| 173 | public override bool ShouldSerializeValue(object component)
|
| 174 | {
|
| 175 | return root.ShouldSerializeValue(component);
|
| 176 | }
|
| 177 |
|
| 178 | public override bool SupportsChangeEvents
|
| 179 | {
|
| 180 | get
|
| 181 | {
|
| 182 | return root.SupportsChangeEvents;
|
| 183 | }
|
| 184 | }
|
| 185 |
|
| 186 | public override string ToString()
|
| 187 | {
|
| 188 | return root.ToString();
|
| 189 | }
|
| 190 | }
|
| 191 | }
|