Skip to content

Commit

Permalink
[cgo] refs fibercrypto#5 Added coin.mocks.WalletAddress
Browse files Browse the repository at this point in the history
  • Loading branch information
Maykel Arias Torres committed Mar 24, 2020
1 parent 371cb4d commit 3e60cb6
Show file tree
Hide file tree
Showing 4 changed files with 56 additions and 1 deletion.
6 changes: 6 additions & 0 deletions include/fctypes.h
Original file line number Diff line number Diff line change
Expand Up @@ -529,6 +529,12 @@ typedef Handle WalletMocks__Handle;
*/
typedef Handle AddressIterator__Handle;

/**
* WalletAddressMocks__Handle Handle, struct
* mocks.WalletAddress
*/
typedef Handle WalletAddressMocks__Handle;

// Callbacks

/**
Expand Down
34 changes: 34 additions & 0 deletions lib/cgo/coin.mocks.WalletAddress.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
package main

/*
#include <string.h>
#include <stdlib.h>
#include "fctypes.h"
*/
import "C"

//export FC_mocks_WalletAddress_GetAddress
func FC_mocks_WalletAddress_GetAddress(__m *C.WalletAddressMocks__Handle, _arg0 *C.Address__Handle) (____error_code uint32) {
_m, ok_m := lookupWalletAddressMocksHandle(*__m)
if !ok_m {
____error_code = FC_BAD_HANDLE
return
}
__arg0 := _m.GetAddress()
*_arg0 = registerAddressHandle(&__arg0)
return
}

//export FC_mocks_WalletAddress_GetWallet
func FC_mocks_WalletAddress_GetWallet(__m *C.WalletAddressMocks__Handle, _arg0 *C.Wallet__Handle) (____error_code uint32) {
_m, ok_m := lookupWalletAddressMocksHandle(*__m)
if !ok_m {
____error_code = FC_BAD_HANDLE
return
}
__arg0 := _m.GetWallet()
*_arg0 = registerWalletHandle(&__arg0)
return
}
3 changes: 2 additions & 1 deletion lib/cgo/handles
Original file line number Diff line number Diff line change
Expand Up @@ -74,4 +74,5 @@ CGOGEN HANDLES mocks__TransactionOutput|TransactionOutputMocks
CGOGEN HANDLES mocks__TransactionOutputIterator|TransactionOutputIteratorMocks
CGOGEN HANDLES mocks__TxnSigner|TxnSignerMocks
CGOGEN HANDLES mocks__TxnSignerIterator|TxnSignerIteratorMocks
CGOGEN HANDLES mocks__Wallet|WalletMocks
CGOGEN HANDLES mocks__Wallet|WalletMocks
CGOGEN HANDLES mocks__WalletAddress|WalletAddressMocks
14 changes: 14 additions & 0 deletions lib/cgo/libfc_handle.go
Original file line number Diff line number Diff line change
Expand Up @@ -998,3 +998,17 @@ func lookupAddressIteratorHandle(handle C.AddressIterator__Handle) (*core.Addres
func registerAddressIteratorHandle(obj *core.AddressIterator) C.AddressIterator__Handle {
return (C.AddressIterator__Handle)(registerHandle(obj))
}

func lookupWalletAddressMocksHandle(handle C.WalletAddressMocks__Handle) (*mocks.WalletAddress, bool) {
obj, ok := lookupHandle(C.Handle(handle))
if ok {
if obj, isOK := (obj).(*mocks.WalletAddress); isOK {
return obj, true
}
}
return nil, false
}

func registerWalletAddressMocksHandle(obj *mocks.WalletAddress) C.WalletAddressMocks__Handle {
return (C.WalletAddressMocks__Handle)(registerHandle(obj))
}

0 comments on commit 3e60cb6

Please sign in to comment.