Free cookie consent management tool by TermsFeed Policy Generator

Ignore:
Timestamp:
04/14/09 14:15:22 (15 years ago)
Author:
epitzer
Message:

XML formatters for all primitive numeric types. (#548)

Location:
trunk/sources/HeuristicLab.Persistence/3.3/Default
Files:
12 added
1 deleted
3 edited

Legend:

Unmodified
Added
Removed
  • trunk/sources/HeuristicLab.Persistence/3.3/Default/ViewOnly/ViewOnlyFormat.cs

    r1553 r1554  
    4545  public class Type2ViewFormatter : ValueType2ViewFormatter {
    4646    public override Type Type { get { return typeof(Type); } }
     47  }
     48
     49  public class Float2ViewFormatter : ValueType2ViewFormatter {
     50    public override Type Type { get { return typeof(float); } }
    4751  }
    4852
  • trunk/sources/HeuristicLab.Persistence/3.3/Default/Xml/Primitive/Double2XmlFormatter.cs

    r1454 r1554  
    11using System;
    2 using System.Globalization;
    32using HeuristicLab.Persistence.Core;
    43using HeuristicLab.Persistence.Interfaces;
     4using System.Reflection;
     5using System.Globalization;
    56
    6 namespace HeuristicLab.Persistence.Default.Xml.Primitive {
    7 
     7namespace HeuristicLab.Persistence.Default.Xml.Primitive { 
     8   
    89  [EmptyStorableClass]
    9   public class Double2XmlFormatter : IFormatter {   
    10 
    11     public Type Type { get { return typeof(double); } }
    12     public IFormat Format { get { return XmlFormat.Instance; } }
    13 
    14     public object DoFormat(object o) {
    15       return ((double)o).ToString("r", CultureInfo.InvariantCulture);     
    16     }
    17 
    18     public object Parse(object o) {
    19       return double.Parse((string)o, CultureInfo.InvariantCulture);
    20     }
    21 
    22   }
     10  public class Double2XmlFormatter : DecimalNumber2XmlFormatterBase<double> { }
    2311 
    2412}
  • trunk/sources/HeuristicLab.Persistence/3.3/Default/Xml/Primitive/Int2XmlFormatter.cs

    r1454 r1554  
    22using HeuristicLab.Persistence.Core;
    33using HeuristicLab.Persistence.Interfaces;
     4using System.Reflection;
     5using System.Globalization;
    46
    5 namespace HeuristicLab.Persistence.Default.Xml.Primitive {
     7namespace HeuristicLab.Persistence.Default.Xml.Primitive { 
    68
    79  [EmptyStorableClass]
    8   public class Int2XmlFormatter : IFormatter {
    9 
    10     public Type Type { get { return typeof(int); } }
    11     public IFormat Format { get { return XmlFormat.Instance; } }
    12 
    13     public object DoFormat(object o) {
    14       return ((int)o).ToString();
    15     }
    16 
    17     public object Parse(object o) {
    18       return int.Parse((string)o);
    19     }
    20 
    21   }
     10  public class Int2XmlFormatter : SimpleNumber2XmlFormatterBase<int> { }
    2211 
    2312}
Note: See TracChangeset for help on using the changeset viewer.