hoppy-generator-0.5.0: C++ FFI generator - Code generator

Safe HaskellNone
LanguageHaskell2010

Foreign.Hoppy.Generator.Types

Contents

Description

Concrete C++ types. It is possible to represent invalid C++ types with these functions, but we try to catch these and fail cleanly as much as possible.

Synopsis

Primitive types

voidT :: Type Source #

C++ void, Haskell ().

boolT :: Type Source #

C++ bool, Haskell Bool.

charT :: Type Source #

C++ char, Haskell CChar.

ucharT :: Type Source #

C++ unsigned char, Haskell CUChar.

shortT :: Type Source #

C++ short int, Haskell CShort.

ushortT :: Type Source #

C++ unsigned short int, Haskell CUShort.

intT :: Type Source #

C++ int, Haskell CInt.

uintT :: Type Source #

C++ unsigned int, Haskell CUInt.

longT :: Type Source #

C++ long int, Haskell CLong.

ulongT :: Type Source #

C++ unsigned long int, Haskell CULong.

llongT :: Type Source #

C++ long long int, Haskell CLLong.

ullongT :: Type Source #

C++ unsigned long long int, Haskell CULLong.

floatT :: Type Source #

C++ float, Haskell CFloat.

doubleT :: Type Source #

C++ double, Haskell CDouble.

int8T :: Type Source #

C++ int8_t, Haskell Int8.

int16T :: Type Source #

C++ int16_t, Haskell Int16.

int32T :: Type Source #

C++ int32_t, Haskell Int32.

int64T :: Type Source #

C++ int64_t, Haskell Int64.

word8T :: Type Source #

C++ uint8_t, Haskell Word8.

word16T :: Type Source #

C++ uint16_t, Haskell Word16.

word32T :: Type Source #

C++ uint32_t, Haskell Word32.

word64T :: Type Source #

C++ uint64_t, Haskell Word64.

ptrdiffT :: Type Source #

C++ ptrdiff_t, Haskell CPtrdiff.

sizeT :: Type Source #

C++ size_t, Haskell CSize.

ssizeT :: Type Source #

C++ ssize_t, Haskell CSsize.

Complex types

enumT :: CppEnum -> Type Source #

A C++ enum value.

bitspaceT :: Bitspace -> Type Source #

A C++ bitspace value.

ptrT :: Type -> Type Source #

A pointer to another type.

refT :: Type -> Type Source #

A reference to another type.

fnT :: [Type] -> Type -> Type Source #

A function taking parameters and returning a value (or voidT). Function pointers must wrap a fnT in a ptrT.

callbackT :: Callback -> Type Source #

A handle for calling foreign code from C++.

objT :: Class -> Type Source #

An instance of a class. When used in a parameter or return type and not wrapped in a ptrT or refT, this is a by-value object.

objToHeapT :: Class -> Type Source #

A special case of objT that is only allowed when passing objects from C++ to a foreign language. Rather than looking at the object's ClassConversion, the object will be copied to the heap, and a pointer to the heap object will be passed. The object must be copy-constructable.

The foreign language owns the pointer, even for callback arguments.

toGcT :: Type -> Type Source #

This type transfers ownership of the object to the foreign language's garbage collector, and results in a managed pointer in the foreign language. This may only be used in one of the forms below, when passing data from C++ to a foreign language (i.e. in a C++ function return type or in a callback argument). In the first case, the temporary object is copied to the heap, and the result is a managed pointer to the heap object instead of the temporary.

constT :: Type -> Type Source #

A const version of another type.