1 //
2 // Copyright (c) 2010-2018 Antmicro
3 //
4 // This file is licensed under the MIT License.
5 // Full license text is available in 'licenses/MIT.txt'.
6 //
7 
8 using System;
9 using System.Collections.Generic;
10 using System.Linq;
11 using System.Reflection;
12 
13 namespace Antmicro.Renode.PlatformDescription.Syntax
14 {
15     public class ObjectValue : Value, IInitable
16     {
ObjectValue(StringWithPosition typeName, IEnumerable<Attribute> attributes)17         public ObjectValue(StringWithPosition typeName, IEnumerable<Attribute> attributes)
18         {
19             TypeName = typeName;
20             Attributes = attributes;
21         }
22 
ToString()23         public override string ToString()
24         {
25             return string.Format("[ObjectValue: TypeName={0}]", TypeName);
26         }
27 
Visit()28         public override IEnumerable<object> Visit()
29         {
30             return (Attributes ?? Enumerable.Empty<Attribute>()).Cast<object>().Concat(new[] { TypeName });
31         }
32 
33         public StringWithPosition TypeName { get; private set; }
34         public IEnumerable<Attribute> Attributes { get; private set; }
35         public ConstructorInfo Constructor { get; set; }
36         public Type ObjectValueType { get; set; }
37         public object Object { get; set; }
38     }
39 }
40