Class DataTypeUtilities


  • public class DataTypeUtilities
    extends java.lang.Object
    • Constructor Detail

      • DataTypeUtilities

        public DataTypeUtilities()
    • Method Detail

      • getContainedDataTypes

        public static java.util.Collection<DataType> getContainedDataTypes​(DataType rootDataType)
      • isSecondPartOfFirst

        public static boolean isSecondPartOfFirst​(DataType firstDataType,
                                                  DataType secondDataType)
        Check to see if the second data type is the same as the first data type or is part of it.
        Note: pointers to the second data type are references and therefore are not considered to be part of the first and won't cause true to be returned. If you pass a pointer to this method for the first or second parameter, it will return false.
        Parameters:
        firstDataType - the data type whose components or base type should be checked to see if the second data type is part of it.
        secondDataType - the data type to be checked for in the first data type.
        Returns:
        true if the second data type is the first data type or is part of it.
      • isSameDataType

        public static boolean isSameDataType​(DataType dataType1,
                                             DataType dataType2)
        Returns true if the two dataTypes have the same sourceArchive and the same UniversalID.
      • isSameOrEquivalentDataType

        public static boolean isSameOrEquivalentDataType​(DataType dataType1,
                                                         DataType dataType2)
        Returns true if the two dataTypes have the same sourceArchive and the same UniversalID OR are equivalent
      • getNameWithoutConflict

        public static java.lang.String getNameWithoutConflict​(DataType dataType,
                                                              boolean includeCategoryPath)
        Get the name of a data type with all conflict naming patterns removed.
        Parameters:
        dataType - data type
        includeCategoryPath - if true the category path will be included with its
        Returns:
        name with without conflict patterns
      • equalsIgnoreConflict

        public static boolean equalsIgnoreConflict​(java.lang.String name1,
                                                   java.lang.String name2)
        Compares two data type name strings to determine if they are equivalent names, ignoring conflict patterns present.
        Parameters:
        name1 - the first name
        name2 - the second name
        Returns:
        true if the names are equivalent when conflict suffixes are ignored.
      • getBaseDataType

        public static DataType getBaseDataType​(DataType dt)
        Get the base data type for the specified data type stripping away pointers and arrays only. A null will be returned for a default pointer.
        Parameters:
        baseDataType - the data type whose base data type is to be determined.
        Returns:
        the base data type.
      • getArrayBaseDataType

        public static DataType getArrayBaseDataType​(Array arrayDt)
      • getName

        public static java.lang.String getName​(Array arrayDt,
                                               boolean showBaseSizeForDynamics)
      • getDisplayName

        public static java.lang.String getDisplayName​(Array arrayDt,
                                                      boolean showBaseSizeForDynamics)
      • getMnemonic

        public static java.lang.String getMnemonic​(Array arrayDt,
                                                   boolean showBaseSizeForDynamics,
                                                   Settings settings)
      • getDataTypeCategoryPath

        public static CategoryPath getDataTypeCategoryPath​(CategoryPath baseCategory,
                                                           Namespace namespace)
        Create a data type category path derived from the specified namespace and rooted from the specified baseCategory
        Parameters:
        baseCategory - category path from which to root the namespace-base path
        namespace - the namespace
        Returns:
        namespace derived category path
      • findDataType

        public static DataType findDataType​(DataTypeManager dataTypeManager,
                                            Namespace namespace,
                                            java.lang.String dtName,
                                            java.lang.Class<? extends DataType> classConstraint)
        Attempt to find the data type whose dtName and specified namespace match a stored data type within the specified dataTypeManager. The best match will be returned. The namespace will be used in checking data type parent categories, however if no type corresponds to the namespace another type whose name matches may be returned.
        Parameters:
        dataTypeManager - data type manager
        namespace - namespace associated with dtName (null indicates no namespace constraint)
        dtName - name of data type
        classConstraint - optional data type interface constraint (e.g., Structure), or null
        Returns:
        best matching data type
      • findNamespaceQualifiedDataType

        public static DataType findNamespaceQualifiedDataType​(DataTypeManager dataTypeManager,
                                                              java.lang.String dtNameWithNamespace,
                                                              java.lang.Class<? extends DataType> classConstraint)
        Attempt to find the data type whose dtNameWithNamespace match a stored data type within the specified dataTypeManager. The best match will be returned. The namespace will be used in checking data type parent categories, however if no type corresponds to the namespace another type whose name matches may be returned. NOTE: name parsing assumes :: delimiter and can be thrown off if name include template information which could contain namespaces.
        Parameters:
        dataTypeManager - data type manager
        namespace - namespace associated with dtName (null indicates no namespace constraint)
        dtNameWithNamespace - name of data type qualified with namespace (e.g., ns1::ns2::dtname)
        classConstraint - optional data type interface constraint (e.g., Structure), or null
        Returns:
        best matching data type
      • getCPrimitiveDataType

        public static DataType getCPrimitiveDataType​(java.lang.String dataTypeName)
        Return the appropriate datatype for a given C primitive datatype name.
        Parameters:
        dataTypeName - the datatype name (e.g. "unsigned int", "long long")
        Returns:
        the appropriate datatype for a given C primitive datatype name.