CType

public protocol CType: CustomStringConvertible

The type of an element in the abstract syntax tree.

  • Converts the receiver to a CXType to be consumed by the libclang APIs.

    Declaration

    Swift

    func asClang() -> CXType
  • sizeOf() Extension method

    Computes the size of a type in bytes as per C++ [expr.sizeof] standard.

    Throws

    Declaration

    Swift

    public func sizeOf() throws -> Int

    Return Value

    The size of the type in bytes.

  • alignOf() Extension method

    Computes the alignment of a type in bytes as per C++[expr.alignof] standard.

    Throws

    Declaration

    Swift

    public func alignOf() throws -> Int

    Return Value

    The alignment of the given type, in bytes.

  • description Extension method

    Pretty-print the underlying type using the rules of the language of the translation unit from which it came.

    Note

    If the type is invalid, an empty string is returned.

    Declaration

    Swift

    public var description: String
  • declaration Extension method

    Retrieves the cursor for the declaration of the receiver.

    Declaration

    Swift

    public var declaration: Cursor?
  • objcEncoding Extension method

    Retrieves the Objective-C type encoding for the receiver.

    Declaration

    Swift

    public var objcEncoding: String
  • canonicalType Extension method

    Return the canonical type for a CType. Clang’s type system explicitly models typedefs and all the ways a specific type can be represented. The canonical type is the underlying type with all the sugar removed. For example, if ‘T’ is a typedef for ‘int’, the canonical type for ‘T’ would be ‘int’.

    Declaration

    Swift

    public var canonicalType: CType
  • cxxRefQualifier Extension method

    Retrieve the ref-qualifier kind of a function or method. The ref-qualifier is returned for C++ functions or methods. For other types or non-C++ declarations, nil is returned.

    Declaration

    Swift

    public var cxxRefQualifier: RefQualifier?