Free cookie consent management tool by TermsFeed Policy Generator

Ignore:
Timestamp:
04/14/09 14:26:45 (16 years ago)
Author:
epitzer
Message:

More renaming and refactoring. (#548)

Location:
trunk/sources/HeuristicLab.Persistence/3.3
Files:
2 added
4 edited

Legend:

Unmodified
Added
Removed
  • trunk/sources/HeuristicLab.Persistence/3.3/Core/StorableAttribute.cs

    r1455 r1555  
    44
    55namespace HeuristicLab.Persistence.Core {
    6 
    7  
    8   [AttributeUsage(
    9     AttributeTargets.Class,
    10     AllowMultiple=false,
    11     Inherited=false)]
    12   public class EmptyStorableClassAttribute : Attribute {
    13     private static readonly Dictionary<Type, bool> emptyTypeInfo = new Dictionary<Type, bool>();
    14     public static bool IsEmpyStorable(Type type) {     
    15       if (emptyTypeInfo.ContainsKey(type))
    16         return emptyTypeInfo[type];
    17       foreach (var attribute in type.GetCustomAttributes(false)) {
    18         EmptyStorableClassAttribute empty = attribute as EmptyStorableClassAttribute;
    19         if (empty != null) {
    20           emptyTypeInfo.Add(type, true);
    21           return true;
    22         }
    23       }
    24       int nFields = 0;
    25       foreach ( MemberInfo memberInfo in type.GetMembers(BindingFlags.Instance | BindingFlags.Public | BindingFlags.NonPublic) ) {
    26         if (memberInfo.MemberType == MemberTypes.Field ||
    27           memberInfo.MemberType == MemberTypes.Property)
    28           nFields += 1;
    29       }
    30       if (nFields == 0) {
    31         emptyTypeInfo.Add(type, true);
    32         return true;
    33       }
    34       emptyTypeInfo.Add(type, false);
    35       return false;
    36     }
    37   }
    386
    397  [AttributeUsage(
     
    7240    }
    7341
    74     public static Dictionary<string, DataMemberAccessor> GetAutostorableAccessors(object obj) {
     42    public static Dictionary<string, DataMemberAccessor> GetStorableAccessors(object obj) {
    7543      Dictionary<string, DataMemberAccessor> storableAccessors =
    7644        new Dictionary<string, DataMemberAccessor>();
  • trunk/sources/HeuristicLab.Persistence/3.3/Core/TypeStringBuilder.cs

    r1519 r1555  
    44namespace HeuristicLab.Persistence.Core {
    55
    6   public static class TypeStringBuilder {
     6  internal static class TypeStringBuilder {
    77
    8     private static void BuildDeclaringTypeChain(Type type, StringBuilder sb) {
     8    internal static void BuildDeclaringTypeChain(Type type, StringBuilder sb) {
    99      if ( type.DeclaringType != null ) {
    1010        BuildDeclaringTypeChain(type.DeclaringType, sb);
     
    1313    }
    1414
    15     private static void BuildVersionInvariantName(Type type, StringBuilder sb) {
     15    internal static void BuildVersionInvariantName(Type type, StringBuilder sb) {
    1616      sb.Append(type.Namespace).Append('.');
    1717      BuildDeclaringTypeChain(type, sb);
     
    3232    }
    3333
    34     public static string VersionInvariantName(this Type type) {
    35       StringBuilder sb = new StringBuilder();
    36       BuildVersionInvariantName(type, sb);
    37       return sb.ToString();
    38     }
    39   } 
     34  }
    4035 
    4136}
  • trunk/sources/HeuristicLab.Persistence/3.3/Default/Decomposers/StorableDecomposer.cs

    r1553 r1555  
    1515    public bool CanDecompose(Type type) {
    1616      return StorableAttribute.GetStorableMembers(type, false).Count() > 0 ||
    17         EmptyStorableClassAttribute.IsEmpyStorable(type);
     17        EmptyStorableClassAttribute.IsEmptyStorable(type);
    1818
    1919    }
     
    2424
    2525    public IEnumerable<Tag> Decompose(object obj) {
    26       foreach (var mapping in StorableAttribute.GetAutostorableAccessors(obj)) {
     26      foreach (var mapping in StorableAttribute.GetStorableAccessors(obj)) {
    2727        yield return new Tag(mapping.Key, mapping.Value.Get());
    2828      }
     
    3939        memberDict.Add(iter.Current.Name, iter.Current);
    4040      }     
    41       foreach (var mapping in StorableAttribute.GetAutostorableAccessors(instance)) {
     41      foreach (var mapping in StorableAttribute.GetStorableAccessors(instance)) {
    4242        if (memberDict.ContainsKey(mapping.Key)) {
    4343          mapping.Value.Set(memberDict[mapping.Key].Value);         
  • trunk/sources/HeuristicLab.Persistence/3.3/HeuristicLab.Persistence-3.3.csproj

    r1554 r1555  
    9494  <ItemGroup>
    9595    <Compile Include="Core\Configuration.cs" />
     96    <Compile Include="Core\EmptyStorableClassAttribute.cs" />
     97    <Compile Include="Core\TypeExtensions.cs" />
    9698    <Compile Include="Core\TypeMapping.cs" />
    9799    <Compile Include="Core\TypeStringBuilder.cs" />
     
    112114    <Compile Include="Core\DataMemberAccessor.cs" />
    113115    <Compile Include="Default\Xml\Compact\IntList2XmlFormatter.cs" />
    114     <Compile Include="Default\Xml\Primitive\Double2XmlFormatterBase.cs" />
    115     <Compile Include="Default\Xml\Primitive\Decimal2XmlFormatterBase.cs" />
    116     <Compile Include="Default\Xml\Primitive\Float2XmlFormatterBase.cs" />
     116    <Compile Include="Default\Xml\Primitive\Double2XmlFormatter.cs" />
     117    <Compile Include="Default\Xml\Primitive\Decimal2XmlFormatter.cs" />
     118    <Compile Include="Default\Xml\Primitive\Float2XmlFormatter.cs" />
    117119    <Compile Include="Default\Xml\Primitive\UInt2XmlFormatter.cs" />
    118120    <Compile Include="Default\Xml\Primitive\Long2XmlFormatter.cs" />
Note: See TracChangeset for help on using the changeset viewer.