Paradox Game Engine  v1.0.0 beta06
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Events Macros Pages
DataConverterAttribute.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 namespace SiliconStudio.Core.Serialization.Converters
6 {
7  /// <summary>
8  /// Generates Data and DataConverter types.
9  /// </summary>
10  [AttributeUsage(AttributeTargets.Class | AttributeTargets.Struct, AllowMultiple = false)]
12  {
13  /// <summary>
14  /// Gets or sets a value indicating whether there is a separate data type to create (default true).
15  /// </summary>
16  /// <value>
17  /// <c>true</c> if [data type]; otherwise, <c>false</c>.
18  /// </value>
19  public bool DataType { get; set; }
20 
21  /// <summary>
22  /// Auto-generate data type and converter.
23  /// </summary>
24  public bool AutoGenerate { get; set; }
25 
26  /// <summary>
27  /// This type needs to be embedded in a ContentReference when another Data type refers to it.
28  /// </summary>
29  public bool ContentReference { get; set; }
30 
31  /// <summary>
32  /// Gets or sets a value indicating whether ConvertToData will be written by the user.
33  /// </summary>
34  /// <value>
35  /// <c>true</c> if ConvertToData will be written by the user; otherwise, <c>false</c>.
36  /// </value>
37  public bool CustomConvertToData { get; set; }
38 
39  /// <summary>
40  /// Gets or sets a value indicating whether ConvertFromData will be written by the user.
41  /// </summary>
42  /// <value>
43  /// <c>true</c> if ConvertFromData will be written by the user; otherwise, <c>false</c>.
44  /// </value>
45  public bool CustomConvertFromData { get; set; }
46 
47  /// <summary>
48  /// Gets or sets the name of the data type.
49  /// </summary>
50  /// <value>
51  /// The name of the data type.
52  /// </value>
53  public string DataTypeName { get; set; }
54 
56  {
57  DataType = true;
58  }
59  }
60 
61  [AttributeUsage(AttributeTargets.Class | AttributeTargets.Struct, AllowMultiple = false)]
62  public class DataAdditionalConverterAttribute : Attribute
63  {
64  /// <summary>
65  /// Auto-generate data converter.
66  /// </summary>
67  public bool AutoGenerate { get; set; }
68 
69  public Type BaseType { get; set; }
70 
71  public DataAdditionalConverterAttribute(Type baseType)
72  {
73  this.BaseType = baseType;
74  }
75  }
76 }