// AllocateArrayDescriptorEx allocates SafeArray. // // AKA: SafeArrayAllocDescriptorEx in Windows API. func AllocateArrayDescriptorEx(variantType com.VariantType, dimensions uint32) (safearray *COMArray, err error) { err = com.MaybeError(C.SafeArrayAllocDescriptorEx(uint16(variantType), dimensions, unsafe.Pointer(&safearray))) return }
// AllocateArrayData allocates SafeArray. // // AKA: SafeArrayAllocData in Windows API. func AllocateArrayData(safearray *COMArray) error { return com.MaybeError(C.SafeArrayAllocData(safearray)) }
// AllocateArrayDescriptor allocates SafeArray. // // AKA: SafeArrayAllocDescriptor in Windows API. func AllocateArrayDescriptor(dimensions uint32) (safearray *COMArray, err error) { err = com.MaybeError(C.SafeArrayAllocDescriptor(dimensions, unsafe.Pointer(&safearray))) return }
// GetRecordInfo accesses IRecordInfo info for custom types. // // AKA: SafeArrayGetRecordInfo in Windows API. // // XXX: Must implement IRecordInfo interface for this to return. func GetRecordInfo(safearray *COMArray) (recordInfo interface{}, err error) { err = com.MaybeError(C.SafeArrayGetRecordInfo(safearray, unsafe.Pointer(&recordInfo))) return }
// SetRecordInfo mutates IRecordInfo info for custom types. // // AKA: SafeArraySetRecordInfo in Windows API. // // XXX: Must implement IRecordInfo interface for this to return. func SetRecordInfo(safearray *COMArray, recordInfo interface{}) error { return com.MaybeError(C.SafeArraySetRecordInfo(safearray, unsafe.Pointer(recordInfo))) }
// AccessData returns raw array. // // AKA: SafeArrayAccessData in Windows API. func AccessData(safearray *COMArray) (element uintptr, err error) { err = com.MaybeError(C.SafeArrayAccessData(safearray, unsafe.Pointer(&element))) return }
// PutElement stores the data element at the specified location in the // array. // // AKA: SafeArrayPutElement in Windows API. func PutElement(safearray *COMArray, index int64, element interface{}) error { return com.MaybeError(C.SafeArrayPutElement(safearray, index, unsafe.Pointer(&element))) }
// SetInterfaceID sets the GUID of the interface for the specified safe // array. // // AKA: SafeArraySetIID in Windows API. func SetInterfaceID(safearray *COMArray, interfaceID *com.GUID) error { return com.MaybeError(C.SafeArraySetIID(safearray, interfaceID)) }
// UnaccessData releases raw array. // // AKA: SafeArrayUnaccessData in Windows API. func UnaccessData(safearray *COMArray) error { return com.MaybeError(C.SafeArrayUnaccessData(safearray)) }
// Unlock unlocks SafeArray for reading. // // AKA: SafeArrayUnlock in Windows API. func Unlock(safearray *COMArray) error { return com.MaybeError(C.SafeArrayUnlock(safearray)) }
// GetPointerOfIndex gets a pointer to an array element. // // AKA: SafeArrayPtrOfIndex in Windows API. func GetPointerOfIndex(safearray *COMArray, index int64) (ref uintptr, err error) { err = com.MaybeError(C.SafeArrayPtrOfIndex(safearray, index, unsafe.Pointer(&ref))) return }
// GetVariantType returns data type of SafeArray. // // AKA: SafeArrayGetVartype in Windows API. func GetVariantType(safearray *COMArray) (varType uint16, err error) { err = com.MaybeError(C.SafeArrayGetVartype(safearray, unsafe.Pointer(&varType))) return }
// GetUpperBound returns upper bounds of SafeArray. // // SafeArrays may have multiple dimensions. Meaning, it could be // multidimensional array. // // AKA: SafeArrayGetUBound in Windows API. func GetUpperBound(safearray *COMArray, dimension uint32) (upperBound int64, err error) { err = com.MaybeError(C.SafeArrayGetUBound(safearray, dimension, unsafe.Pointer(&upperBound))) return }
// GetInterfaceID is the InterfaceID of the elements in the SafeArray. // // AKA: SafeArrayGetIID in Windows API. func GetInterfaceID(safearray *COMArray) (guid *com.GUID, err error) { err = com.MaybeError(C.SafeArrayGetIID(safearray, unsafe.Pointer(&guid))) return }
// Duplicate returns copy of SafeArray. // // AKA: SafeArrayCopy in Windows API. func Duplicate(original *COMArray) (safearray *COMArray, err error) { err = com.MaybeError(C.SafeArrayCopy(original, unsafe.Pointer(&safearray))) return }
// ResetDimensions changes the right-most (least significant) bound of the // specified safe array. // // AKA: SafeArrayRedim in Windows API. func ResetDimensions(safearray *COMArray, bounds *Bounds) error { return com.MaybeError(C.SafeArrayRedim(safearray, bounds)) }
// DuplicateData duplicates SafeArray into another SafeArray object. // // AKA: SafeArrayCopyData in Windows API. func DuplicateData(original, duplicate *COMArray) error { return com.MaybeError(C.SafeArrayCopyData(original, unsafe.Pointer(&duplicate))) }
// DestroyDescriptor destroys SafeArray object. // // AKA: SafeArrayDestroyDescriptor in Windows API. func DestroyDescriptor(safearray *COMArray) error { return com.MaybeError(C.SafeArrayDestroyDescriptor(safearray)) }