/* * SPDX-License-Identifier: AGPL-3.0-or-later * Copyright (C) 2025 Sergej Görzen * This file is part of xAPI4Unity. */ using System; namespace xAPI4Unity.Editor.Types { /// /// Represents a resolved type, including its system type and its type definition as a string. /// Provides a base implementation for more specialized types (e.g., ranges, tuples, regular expressions). /// public class ResolvedType { /// /// The corresponding of the resolved type. /// public readonly Type Type; /// /// The string representation of the resolved type (e.g., as defined in user input). /// public readonly string Definition; /// /// Indicates whether the type is defined by a regular expression. /// public virtual bool IsRegexExpr => false; /// /// Indicates whether the type is a tuple. /// public virtual bool IsTuple => false; /// /// Indicates whether the type is a range. /// public virtual bool IsRange => false; public virtual bool IsNullable => false; /// /// Initializes a default instance of with an unspecified type (defaults to ). /// public ResolvedType() { Type = typeof(object); Definition = null; } /// /// Initializes a new instance of with a specific type and definition. /// /// The system type of the resolved type. /// The string definition of the resolved type. public ResolvedType(Type type, string definition) { Type = type; Definition = definition; } /// /// Returns the syntax representation of the resolved type. /// By default, this returns the fully qualified name of the type. /// /// A string representing the syntax of the type. public virtual string GetTypeSyntax() => Type.FullName; } }