-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
9493b90
commit cd847fe
Showing
29 changed files
with
805 additions
and
143 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
57 changes: 57 additions & 0 deletions
57
include/javabind/detail/call_array_byte_method_functor.hpp
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,57 @@ | ||
// (c) Copyright 2012 Felipe Magno de Almeida | ||
// | ||
// All rights reserved | ||
|
||
#if !defined(BOOST_PP_IS_ITERATING) | ||
|
||
#ifndef JAVABIND_DETAIL_CALL_ARRAY_BYTE_METHOD_FUNCTOR_HPP | ||
#define JAVABIND_DETAIL_CALL_ARRAY_BYTE_METHOD_FUNCTOR_HPP | ||
|
||
#include <javabind/primitives.hpp> | ||
#include <javabind/array.hpp> | ||
#include <javabind/detail/max_args.hpp> | ||
#include <javabind/detail/unwrap.hpp> | ||
|
||
#include <boost/preprocessor/iteration/iterate.hpp> | ||
#include <boost/preprocessor/repetition/enum_trailing_binary_params.hpp> | ||
#include <boost/preprocessor/repetition/enum_trailing_params.hpp> | ||
|
||
#include <stdexcept> | ||
|
||
namespace javabind { namespace detail { | ||
|
||
struct call_array_byte_method_functor | ||
{ | ||
call_array_byte_method_functor(jmethodID id) | ||
: id(id) {} | ||
typedef javabind::array<javabind::byte> result_type; | ||
|
||
#define BOOST_PP_ITERATION_PARAMS_1 (3, (0, BOOST_PP_DEC (JAVABIND_MAX_ARGS), "javabind/detail/call_array_byte_method_functor.hpp")) | ||
#include BOOST_PP_ITERATE () | ||
|
||
jmethodID raw() const { return id; } | ||
|
||
jmethodID id; | ||
}; | ||
|
||
} } | ||
|
||
#endif | ||
#else | ||
|
||
template <typename O BOOST_PP_ENUM_TRAILING_PARAMS(BOOST_PP_ITERATION(), typename A)> | ||
result_type operator()(O o BOOST_PP_ENUM_TRAILING_BINARY_PARAMS(BOOST_PP_ITERATION(), A, a)) const | ||
{ | ||
jbyteArray r | ||
= static_cast<jbyteArray>(static_cast<void*> | ||
(o.environment()->CallObjectMethod(o.raw(), id | ||
BOOST_PP_REPEAT(BOOST_PP_ITERATION() | ||
, JAVABIND_TRAILING_UNWRAP, a)))); | ||
if(o.environment()->ExceptionCheck()) | ||
{ | ||
throw std::runtime_error("Exception was thrown"); | ||
} | ||
return result_type(r, o.environment()); | ||
} | ||
|
||
#endif |
57 changes: 57 additions & 0 deletions
57
include/javabind/detail/call_array_object_method_functor.hpp
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,57 @@ | ||
// (c) Copyright 2012 Felipe Magno de Almeida | ||
// | ||
// All rights reserved | ||
|
||
#if !defined(BOOST_PP_IS_ITERATING) | ||
|
||
#ifndef JAVABIND_DETAIL_CALL_ARRAY_OBJECT_METHOD_FUNCTOR_HPP | ||
#define JAVABIND_DETAIL_CALL_ARRAY_OBJECT_METHOD_FUNCTOR_HPP | ||
|
||
#include <javabind/primitives.hpp> | ||
#include <javabind/array.hpp> | ||
#include <javabind/detail/max_args.hpp> | ||
#include <javabind/detail/unwrap.hpp> | ||
|
||
#include <boost/preprocessor/iteration/iterate.hpp> | ||
#include <boost/preprocessor/repetition/enum_trailing_binary_params.hpp> | ||
#include <boost/preprocessor/repetition/enum_trailing_params.hpp> | ||
|
||
#include <stdexcept> | ||
|
||
namespace javabind { namespace detail { | ||
|
||
struct call_array_object_method_functor | ||
{ | ||
call_array_object_method_functor(jmethodID id) | ||
: id(id) {} | ||
typedef javabind::array<javabind::object> result_type; | ||
|
||
#define BOOST_PP_ITERATION_PARAMS_1 (3, (0, BOOST_PP_DEC (JAVABIND_MAX_ARGS), "javabind/detail/call_array_object_method_functor.hpp")) | ||
#include BOOST_PP_ITERATE () | ||
|
||
jmethodID raw() const { return id; } | ||
|
||
jmethodID id; | ||
}; | ||
|
||
} } | ||
|
||
#endif | ||
#else | ||
|
||
template <typename O BOOST_PP_ENUM_TRAILING_PARAMS(BOOST_PP_ITERATION(), typename A)> | ||
result_type operator()(O o BOOST_PP_ENUM_TRAILING_BINARY_PARAMS(BOOST_PP_ITERATION(), A, a)) const | ||
{ | ||
jobjectArray r | ||
= static_cast<jobjectArray>(static_cast<void*> | ||
(o.environment()->CallObjectMethod(o.raw(), id | ||
BOOST_PP_REPEAT(BOOST_PP_ITERATION() | ||
, JAVABIND_TRAILING_UNWRAP, a)))); | ||
if(o.environment()->ExceptionCheck()) | ||
{ | ||
throw std::runtime_error("Exception was thrown"); | ||
} | ||
return result_type(r, o.environment()); | ||
} | ||
|
||
#endif |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.