Paradox Game Engine  v1.0.0 beta06
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Events Macros Pages
ContentBase.cs
Go to the documentation of this file.
1 // Copyright (c) 2014 Silicon Studio Corp. (http://siliconstudio.co.jp)
2 // This file is distributed under GPL v3. See LICENSE.md for details.
3 using System;
4 
5 using SiliconStudio.Core.Reflection;
6 using SiliconStudio.Quantum.References;
7 
8 namespace SiliconStudio.Quantum.Contents
9 {
10  /// <summary>
11  /// A base abstract implementation of the <see cref="IContent"/> interface.
12  /// </summary>
13  public abstract class ContentBase : IContent
14  {
15  private readonly IReference reference;
16 
17  protected ContentBase(Type type, ITypeDescriptor descriptor, bool isPrimitive, IReference reference)
18  {
19  if (type == null) throw new ArgumentNullException("type");
20  if (descriptor == null) throw new ArgumentNullException("descriptor");
21  this.reference = reference;
22  Descriptor = descriptor;
23  Type = type;
24  IsPrimitive = isPrimitive;
25  SerializeFlags = ViewModelContentSerializeFlags.SerializeValue;
26  }
27 
28  /// <inheritdoc/>
29  public Type Type { get; set; }
30 
31  /// <inheritdoc/>
32  public abstract object Value { get; set; }
33 
34  /// <inheritdoc/>
35  public bool IsPrimitive { get; private set; }
36 
37  /// <inheritdoc/>
38  public ITypeDescriptor Descriptor { get; private set; }
39 
40  /// <inheritdoc/>
41  public bool IsReference { get { return Reference != null; } }
42 
43  /// <inheritdoc/>
44  public IReference Reference { get { return reference; } }
45 
46  /// <inheritdoc/>
47  public virtual ViewModelContentState LoadState { get; set; }
48 
49  /// <inheritdoc/>
50  public ViewModelContentFlags Flags { get; set; }
51 
52  /// <inheritdoc/>
53  public ViewModelContentSerializeFlags SerializeFlags { get; set; }
54 
55  /// <inheritdoc/>
56  public override string ToString()
57  {
58  return "[" + GetType().Name + "]: " + Value;
59  }
60  }
61 }
A base abstract implementation of the IContent interface.
Definition: ContentBase.cs:13
Content of a IModelNode.
Definition: IContent.cs:13
Flags
Enumeration of the new Assimp's flags.
ViewModelContentSerializeFlags
Flags applying to IContent.
Provides access members of a type.
ContentBase(Type type, ITypeDescriptor descriptor, bool isPrimitive, IReference reference)
Definition: ContentBase.cs:17