Esempio n. 1
0
        /// <summary>
        /// Constructor of a pointer type.
        /// </summary>
        /// <param name="elementType">The element type pointed to.</param>
        public CppPointerType(CppType elementType) : base(CppTypeKind.Pointer, elementType)
        {
            SizeOf = IntPtr.Size;
            // Check if it is a function ptr
            Regex regex = new Regex(@"\(\*\w*\d*_*\)");

            IsFunctionPtr = regex.IsMatch(elementType.GetDisplayName());
        }
Esempio n. 2
0
 /// <summary>
 /// Gets the display name of the specified type. If the type is <see cref="ICppMember"/> it will
 /// only use the name provided by <see cref="ICppMember.Name"/>
 /// </summary>
 /// <param name="type">The type</param>
 /// <returns>The display name</returns>
 public static string GetDisplayName(this CppType type)
 {
     if (type is ICppMember member)
     {
         return(member.Name);
     }
     return(type.ToString());
 }
Esempio n. 3
0
 /// <summary>
 /// Constructor of a pointer type.
 /// </summary>
 /// <param name="elementType">The element type pointed to.</param>
 public CppPointerType(CppType elementType) : base(CppTypeKind.Pointer, elementType)
 {
 }
Esempio n. 4
0
 /// <summary>
 /// Constructor for a C++ qualified type.
 /// </summary>
 /// <param name="qualifier">The C++ qualified (e.g `const`)</param>
 /// <param name="elementType">The element type (e.g `int`)</param>
 public CppQualifiedType(CppTypeQualifier qualifier, CppType elementType) : base(CppTypeKind.Qualified)
 {
     Qualifier   = qualifier;
     ElementType = elementType ?? throw new ArgumentNullException(nameof(elementType));
 }
Esempio n. 5
0
 /// <summary>
 /// Constructor of a function type.
 /// </summary>
 /// <param name="returnType">Return type of this function type.</param>
 public CppFunctionType(CppType returnType) : base(CppTypeKind.Function)
 {
     ReturnType     = returnType ?? throw new ArgumentNullException(nameof(returnType));
     ParameterTypes = new List <CppType>();
 }
Esempio n. 6
0
 /// <summary>
 /// Constructor of a reference type.
 /// </summary>
 /// <param name="elementType">The element type referenced to.</param>
 public CppReferenceType(CppType elementType) : base(CppTypeKind.Reference, elementType)
 {
 }
Esempio n. 7
0
 /// <summary>
 /// Constructor for a C++ qualified type.
 /// </summary>
 /// <param name="qualifier">The C++ qualified (e.g `const`)</param>
 /// <param name="elementType">The element type (e.g `int`)</param>
 public CppQualifiedType(CppTypeQualifier qualifier, CppType elementType) : base(CppTypeKind.Qualified, elementType)
 {
     Qualifier = qualifier;
     SizeOf    = elementType.SizeOf;
 }
Esempio n. 8
0
 /// <summary>
 /// Constructor of a reference type.
 /// </summary>
 /// <param name="elementType">The element type referenced to.</param>
 public CppReferenceType(CppType elementType) : base(CppTypeKind.Reference)
 {
     ElementType = elementType ?? throw new ArgumentNullException(nameof(elementType));
 }
Esempio n. 9
0
 public override bool IsEquivalent(CppType other)
 {
     // Special case for typedef, as they are aliasing, we don't care about the name
     return(Type.IsEquivalent(other));
 }
Esempio n. 10
0
 /// <summary>
 /// Constructor of a pointer type.
 /// </summary>
 /// <param name="elementType">The element type pointed to.</param>
 public CppPointerType(CppType elementType) : base(CppTypeKind.Pointer, elementType)
 {
     SizeOf = IntPtr.Size;
 }
Esempio n. 11
0
 /// <summary>
 /// Constructor of a C++ array.
 /// </summary>
 /// <param name="elementType">The element type (e.g `int`)</param>
 /// <param name="size">The size of the array. 0 means an unbound array</param>
 public CppArrayType(CppType elementType, int size) : base(CppTypeKind.Array, elementType)
 {
     Size = size;
 }
Esempio n. 12
0
 /// <summary>
 /// Constructor of a pointer type.
 /// </summary>
 /// <param name="elementType">The element type pointed to.</param>
 public CppPointerType(CppType elementType) : base(CppTypeKind.Pointer)
 {
     ElementType = elementType ?? throw new ArgumentNullException(nameof(elementType));
 }
Esempio n. 13
0
 /// <summary>
 /// Creates a base type.
 /// </summary>
 /// <param name="baseType">Type of the base</param>
 public CppBaseType(CppType baseType)
 {
     Type = baseType ?? throw new ArgumentNullException(nameof(baseType));
 }
Esempio n. 14
0
 protected CppTypeWithElementType(CppTypeKind typeKind, CppType elementType) : base(typeKind)
 {
     ElementType = elementType ?? throw new ArgumentNullException(nameof(elementType));
 }
Esempio n. 15
0
 /// <summary>
 /// Creates a new instance of a C++ function parameter.
 /// </summary>
 /// <param name="type">Type of the parameter.</param>
 /// <param name="name">Name of the parameter</param>
 public CppParameter(CppType type, string name)
 {
     Type = type ?? throw new ArgumentNullException(nameof(type));
     Name = name ?? throw new ArgumentNullException(nameof(name));
 }
Esempio n. 16
0
 /// <summary>
 /// Creates a new instance of a typedef.
 /// </summary>
 /// <param name="name">Name of the typedef (e.g `XXX`)</param>
 /// <param name="type">Underlying type.</param>
 public CppTypedef(string name, CppType type) : base(CppTypeKind.Typedef)
 {
     Name = name ?? throw new ArgumentNullException(nameof(name));
     Type = type ?? throw new ArgumentNullException(nameof(type));
 }
Esempio n. 17
0
 public CppField(CppType type, string name)
 {
     Type = type ?? throw new ArgumentNullException(nameof(type));
     Name = name;
 }
Esempio n. 18
0
 /// <summary>
 /// Constructor of a function type.
 /// </summary>
 /// <param name="returnType">Return type of this function type.</param>
 public CppFunctionType(CppType returnType) : base(CppTypeKind.Function)
 {
     ReturnType = returnType ?? throw new ArgumentNullException(nameof(returnType));
     Parameters = new CppContainerList <CppParameter>(this);
 }
Esempio n. 19
0
 /// <summary>
 /// Constructor of a C++ array.
 /// </summary>
 /// <param name="elementType">The element type (e.g `int`)</param>
 /// <param name="size">The size of the array. 0 means an unbound array</param>
 public CppArrayType(CppType elementType, int size) : base(CppTypeKind.Array)
 {
     ElementType = elementType ?? throw new ArgumentNullException(nameof(elementType));
     Size        = size;
 }