Free cookie consent management tool by TermsFeed Policy Generator

source: branches/New Persistence Exploration/Persistence/Persistence/Tokens.cs @ 1338

Last change on this file since 1338 was 1330, checked in by epitzer, 15 years ago

More compact XML Formatting (no empty names, referencable primitives, compact arrays & lists). (#506)

File size: 2.6 KB
Line 
1using System;
2namespace Persistence {
3
4  #region Serialization Tokens
5
6  public interface ISerializationToken {
7  }
8  public class BeginToken : ISerializationToken {
9    public readonly DataMemberAccessor Accessor;
10    public readonly int Id;
11    public BeginToken(DataMemberAccessor accessor, int id) {
12      Accessor = accessor;
13      Id = id;
14    }
15  }
16  public class EndToken : ISerializationToken {
17    public readonly DataMemberAccessor Accessor;
18    public readonly int Id;
19    public EndToken(DataMemberAccessor accessor, int id) {
20      Accessor = accessor;
21      Id = id;
22    }
23  }
24  public class PrimitiveToken : ISerializationToken {
25    public readonly DataMemberAccessor Accessor;
26    public readonly object Data;
27    public readonly int? Id;
28    public PrimitiveToken(DataMemberAccessor accessor, object data, int? id) {
29      Accessor = accessor;
30      Data = data;
31      Id = id;
32    }
33  }
34  public class ReferenceToken : ISerializationToken {
35    public readonly string Name;
36    public readonly int Id;
37    public ReferenceToken(string name, int id) {
38      Name = name;
39      Id = id;
40    }
41  }
42  public class NullReferenceToken : ISerializationToken {
43    public readonly string Name;
44    public NullReferenceToken(string name) {
45      Name = name;
46    }
47  }
48  #endregion
49
50  #region DeSerialization Tokens
51
52  public interface IParseToken { }
53
54  public class CompositeStart : IParseToken {
55    public readonly string Name;
56    public readonly Type Type;
57    public readonly int Id;
58    public CompositeStart(string name, Type type, int id) {
59      Name = name;
60      Type = type;
61      Id = id;
62    }
63  }
64  public class CompositeEnd : IParseToken {
65    public readonly string Name;
66    public readonly Type Type;
67    public readonly int Id;
68    public CompositeEnd(string name, Type type, int id) {
69      Name = name;
70      Type = type;
71      Id = id;
72    }
73  }
74  public class Primitive : IParseToken {
75    public readonly string Name;
76    public readonly Type Type;
77    public readonly string SerializedValue;
78    public readonly int? Id;
79    public Primitive(string name, Type type, string serilaizedValue, int? id) {
80      Name = name;
81      Type = type;
82      SerializedValue = serilaizedValue;
83      Id = id;
84    }
85  }
86  public class Reference : IParseToken {
87    public readonly string Name;
88    public readonly int Id;
89    public Reference(string name, int id) {
90      Name = name;
91      Id = id;
92    }
93  }
94  public class Null : IParseToken {
95    public readonly string Name;
96    public Null(string name) {
97      Name = name;
98    }
99  }
100  #endregion
101
102}
Note: See TracBrowser for help on using the repository browser.