Free cookie consent management tool by TermsFeed Policy Generator

source: trunk/sources/HeuristicLab.Persistence/3.3/Core/GeneratorBase.cs @ 1566

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

Format white space. (Ctrl-K, Ctrl-D) (#548)

File size: 1.6 KB
Line 
1using System.Collections.Generic;
2using System;
3using System.Text;
4using HeuristicLab.Persistence.Interfaces;
5using HeuristicLab.Persistence.Core;
6using System.IO;
7using ICSharpCode.SharpZipLib.Zip;
8using HeuristicLab.Tracing;
9using log4net;
10using HeuristicLab.Persistence.Core.Tokens;
11
12namespace HeuristicLab.Persistence.Core {
13
14  public abstract class GeneratorBase<T> {
15    public T Format(ISerializationToken token) {
16      Type type = token.GetType();
17      if (type == typeof(BeginToken))
18        return Format((BeginToken)token);
19      if (type == typeof(EndToken))
20        return Format((EndToken)token);
21      if (type == typeof(PrimitiveToken))
22        return Format((PrimitiveToken)token);
23      if (type == typeof(ReferenceToken))
24        return Format((ReferenceToken)token);
25      if (type == typeof(NullReferenceToken))
26        return Format((NullReferenceToken)token);
27      if (type == typeof(MetaInfoBeginToken))
28        return Format((MetaInfoBeginToken)token);
29      if (type == typeof(MetaInfoEndToken))
30        return Format((MetaInfoEndToken)token);
31      throw new ApplicationException("Invalid token of type " + type.FullName);
32    }
33    protected abstract T Format(BeginToken beginToken);
34    protected abstract T Format(EndToken endToken);
35    protected abstract T Format(PrimitiveToken primitiveToken);
36    protected abstract T Format(ReferenceToken referenceToken);
37    protected abstract T Format(NullReferenceToken nullReferenceToken);
38    protected abstract T Format(MetaInfoBeginToken metaInfoBeginToken);
39    protected abstract T Format(MetaInfoEndToken metaInfoEndToken);
40  }
41}
Note: See TracBrowser for help on using the repository browser.