Skip to content

Commit

Permalink
[cgo] refs fibercrypto#5 Added coin.mocks.WalletIterator
Browse files Browse the repository at this point in the history
  • Loading branch information
Maykel Arias Torres committed Mar 24, 2020
1 parent dbef753 commit 4e5979a
Show file tree
Hide file tree
Showing 4 changed files with 68 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 @@ -541,6 +541,12 @@ typedef Handle WalletAddressMocks__Handle;
*/
typedef Handle WalletEnvMocks__Handle;

/**
* WalletIteratorMocks__Handle Handle, struct
* mocks.WalletIterator
*/
typedef Handle WalletIteratorMocks__Handle;

// Callbacks

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

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

//export FC_mocks_WalletIterator_HasNext
func FC_mocks_WalletIterator_HasNext(__m *C.WalletIteratorMocks__Handle, _arg0 *bool) (____error_code uint32) {
_m, ok_m := lookupWalletIteratorMocksHandle(*__m)
if !ok_m {
____error_code = FC_BAD_HANDLE
return
}
__arg0 := _m.HasNext()
*_arg0 = __arg0
return
}

//export FC_mocks_WalletIterator_Next
func FC_mocks_WalletIterator_Next(__m *C.WalletIteratorMocks__Handle, _arg0 *bool) (____error_code uint32) {
_m, ok_m := lookupWalletIteratorMocksHandle(*__m)
if !ok_m {
____error_code = FC_BAD_HANDLE
return
}
__arg0 := _m.Next()
*_arg0 = __arg0
return
}

//export FC_mocks_WalletIterator_Value
func FC_mocks_WalletIterator_Value(__m *C.WalletIteratorMocks__Handle, _arg0 *C.Wallet__Handle) (____error_code uint32) {
_m, ok_m := lookupWalletIteratorMocksHandle(*__m)
if !ok_m {
____error_code = FC_BAD_HANDLE
return
}
__arg0 := _m.Value()
*_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 @@ -76,4 +76,5 @@ CGOGEN HANDLES mocks__TxnSigner|TxnSignerMocks
CGOGEN HANDLES mocks__TxnSignerIterator|TxnSignerIteratorMocks
CGOGEN HANDLES mocks__Wallet|WalletMocks
CGOGEN HANDLES mocks__WalletAddress|WalletAddressMocks
CGOGEN HANDLES mocks__WalletEnv|WalletEnvMocks
CGOGEN HANDLES mocks__WalletEnv|WalletEnvMocks
CGOGEN HANDLES mocks__WalletIterator|WalletIteratorMocks
14 changes: 14 additions & 0 deletions lib/cgo/libfc_handle.go
Original file line number Diff line number Diff line change
Expand Up @@ -1026,3 +1026,17 @@ func lookupWalletEnvMocksHandle(handle C.WalletEnvMocks__Handle) (*mocks.WalletE
func registerWalletEnvMocksHandle(obj *mocks.WalletEnv) C.WalletEnvMocks__Handle {
return (C.WalletEnvMocks__Handle)(registerHandle(obj))
}

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

func registerWalletIteratorMocksHandle(obj *mocks.WalletIterator) C.WalletIteratorMocks__Handle {
return (C.WalletIteratorMocks__Handle)(registerHandle(obj))
}

0 comments on commit 4e5979a

Please sign in to comment.