| @ -0,0 +1,65 @@ | ||||
| using System; | ||||
| using System.Collections.Generic; | ||||
| using System.Linq; | ||||
|  | ||||
| namespace UnrealSharpScriptGenerator.Model; | ||||
|  | ||||
| public record struct SpecialStructInfo | ||||
| { | ||||
|     public HashSet<string> SkippedTypes { get; init; } | ||||
|      | ||||
|     public Dictionary<string, BlittableStructInfo> BlittableTypes { get; init; } | ||||
|      | ||||
|     public Dictionary<string, NativelyTranslatableStructInfo> NativelyCopyableTypes { get; init; } | ||||
|  | ||||
|     public bool Equals(SpecialStructInfo other) | ||||
|     { | ||||
|         if (BlittableTypes.Count != other.BlittableTypes.Count || NativelyCopyableTypes.Count != other.NativelyCopyableTypes.Count) | ||||
|         { | ||||
|             return false; | ||||
|         } | ||||
|  | ||||
|         foreach (var (key, value) in BlittableTypes) | ||||
|         { | ||||
|             if (!other.BlittableTypes.TryGetValue(key, out var otherValue) || value != otherValue) | ||||
|             { | ||||
|                 return false; | ||||
|             } | ||||
|         } | ||||
|          | ||||
|         foreach (var (key, value) in NativelyCopyableTypes) | ||||
|         { | ||||
|             if (!other.NativelyCopyableTypes.TryGetValue(key, out var otherValue) || value != otherValue) | ||||
|             { | ||||
|                 return false; | ||||
|             } | ||||
|         } | ||||
|          | ||||
|         return true; | ||||
|     } | ||||
|  | ||||
|     public override int GetHashCode() | ||||
|     { | ||||
|         return HashCode.Combine(BlittableTypes, NativelyCopyableTypes); | ||||
|     } | ||||
| } | ||||
|  | ||||
| public record SpecialTypeInfo | ||||
| { | ||||
|     public SpecialStructInfo Structs { get; init; } = new() | ||||
|     { | ||||
|         SkippedTypes = [], | ||||
|         BlittableTypes = new Dictionary<string, BlittableStructInfo>(), | ||||
|         NativelyCopyableTypes = new Dictionary<string, NativelyTranslatableStructInfo>() | ||||
|     }; | ||||
|  | ||||
|     public virtual bool Equals(SpecialTypeInfo? other) | ||||
|     { | ||||
|         return other is not null && Structs.Equals(other.Structs); | ||||
|     } | ||||
|      | ||||
|     public override int GetHashCode() | ||||
|     { | ||||
|         return HashCode.Combine(Structs); | ||||
|     } | ||||
| } | ||||
| @ -0,0 +1,19 @@ | ||||
| using System.Collections.Immutable; | ||||
|  | ||||
| namespace UnrealSharpScriptGenerator.Model; | ||||
|  | ||||
| public record struct BlittableStructInfo(string Name, string? ManagedType = null); | ||||
|  | ||||
| public record struct NativelyTranslatableStructInfo(string Name, bool HasDestructor); | ||||
|  | ||||
| public struct StructTranslationInfo() | ||||
| { | ||||
|     public ImmutableArray<string> CustomTypes { get; init; } = []; | ||||
|     public ImmutableArray<BlittableStructInfo> BlittableTypes { get; init; } = []; | ||||
|     public ImmutableArray<NativelyTranslatableStructInfo> NativelyTranslatableTypes { get; init; } = []; | ||||
| } | ||||
|  | ||||
| public record TypeTranslationManifest | ||||
| { | ||||
|     public StructTranslationInfo Structs { get; init; } | ||||
| } | ||||
		Reference in New Issue
	
	Block a user