Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 6 additions & 6 deletions BUILD
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,10 @@ cc_library(
visibility = ["//visibility:public"],
deps = [
":jni_dep",
"//bind_lang/metaprogramming:corpus",
"//bind_lang/metaprogramming:corpus_tag",
"//bind_lang/metaprogramming:singleton",
"//bind_lang/metaprogramming:string_literal",
"//class_defs:java_lang_classes",
"//class_defs:java_lang_exception",
"//class_defs:java_lang_throwable",
Expand Down Expand Up @@ -92,10 +96,6 @@ cc_library(
"//implementation/jni_helper:jni_env",
"//implementation/jni_helper:lifecycle",
"//implementation/jni_helper:static_field_value",
"//metaprogramming:corpus",
"//metaprogramming:corpus_tag",
"//metaprogramming:singleton",
"//metaprogramming:string_literal",
],
)

Expand Down Expand Up @@ -175,11 +175,11 @@ genrule(
":headers_for_export",
":jni_bind_decorative_text",
":jni_bind_release_input",
"//bind_lang/metaprogramming:headers_for_export",
"//class_defs:headers_for_export",
"//class_defs/android:headers_for_export",
"//implementation:headers_for_export",
"//implementation/jni_helper:headers_for_export",
"//metaprogramming:headers_for_export",
],
visibility = ["//third_party/jni_wrapper/godbolt:__pkg__"],
)
Expand All @@ -199,11 +199,11 @@ genrule(
":headers_for_export",
":jni_bind_decorative_text",
":jni_bind_release_input",
"//bind_lang/metaprogramming:headers_for_export",
"//class_defs:headers_for_export",
"//class_defs/android:headers_for_export",
"//implementation:headers_for_export",
"//implementation/jni_helper:headers_for_export",
"//metaprogramming:headers_for_export",
],
visibility = ["//visibility:private"],
)
Expand Down
4 changes: 2 additions & 2 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ target_include_directories(jni_bind INTERFACE
${CMAKE_CURRENT_SOURCE_DIR}/class_defs
${CMAKE_CURRENT_SOURCE_DIR}/implementation
${CMAKE_CURRENT_SOURCE_DIR}/implementation/jni_helper
${CMAKE_CURRENT_SOURCE_DIR}/metaprogramming)
${CMAKE_CURRENT_SOURCE_DIR}/bind_lang/metaprogramming)

target_link_libraries(jni_bind INTERFACE jdk:jni)

Expand All @@ -26,7 +26,7 @@ endif()

enable_testing()

file(GLOB METAPROGRAMMING_TESTS "${CMAKE_CURRENT_SOURCE_DIR}/metaprogramming/*_test.cc")
file(GLOB METAPROGRAMMING_TESTS "${CMAKE_CURRENT_SOURCE_DIR}/bind_lang/metaprogramming/*_test.cc")
foreach(TEST_SRC ${METAPROGRAMMING_TESTS})
get_filename_component(TEST_NAME ${TEST_SRC} NAME_WE)
add_jni_test(${TEST_NAME} ${TEST_SRC})
Expand Down
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -610,7 +610,7 @@ obj.Call<"Foo">(1.5f, "argString");
obj.Access<"intField">().Set(123);
```

This syntax was all that could be supported in C++17, and unfortunately [relies on a clang extension](metaprogramming/invocable_map.h). Because C++17 does not support string literals in non-type template parameters, the new syntax is not possible. Conversely, the syntax enabled by the clang extension is not possible to represent in standard C++20.
This syntax was all that could be supported in C++17, and unfortunately [relies on a clang extension](bind_lang/metaprogramming/invocable_map.h). Because C++17 does not support string literals in non-type template parameters, the new syntax is not possible. Conversely, the syntax enabled by the clang extension is not possible to represent in standard C++20.

As such, the documentation and sample code all use the new syntax, and because this uses standard C++20, it is portable. The old syntax is fully unit tested under the [legacy directory](implementation/legacy), and will continue to be supported for clang on C++17 and onwards. In the unlikely event this syntax needed deprecation I will only do so after a major version bump.

Expand Down
5 changes: 3 additions & 2 deletions metaprogramming/BUILD → bind_lang/metaprogramming/BUILD
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,6 @@ package(

licenses(["notice"])

exports_files(["LICENSE"])

################################################################################
# All.
################################################################################
Expand Down Expand Up @@ -599,6 +597,7 @@ cc_library(
":per_element",
":tuple_manipulation",
":type_of_nth_element",
":unwrap",
],
)

Expand Down Expand Up @@ -715,6 +714,7 @@ cc_test(
deps = [
":min_max",
":reduce",
":vals",
"@googletest//:gtest_main",
],
)
Expand Down Expand Up @@ -1239,6 +1239,7 @@ cc_test(
name = "vals_equal_diminished_test",
srcs = ["vals_equal_diminished_test.cc"],
deps = [
":vals",
":vals_equal_diminished",
"@googletest//:gtest_main",
],
Expand Down
6 changes: 3 additions & 3 deletions metaprogramming/all.h → bind_lang/metaprogramming/all.h
Original file line number Diff line number Diff line change
Expand Up @@ -14,8 +14,8 @@
* limitations under the License.
*/

#ifndef JNI_BIND_METAPROGRAMMING_ALL_H_
#define JNI_BIND_METAPROGRAMMING_ALL_H_
#ifndef JNI_BIND_BIND_LANG_METAPROGRAMMING_ALL_H_
#define JNI_BIND_BIND_LANG_METAPROGRAMMING_ALL_H_

#include <type_traits>

Expand All @@ -36,4 +36,4 @@ static constexpr bool All_v = All_t<Func, Ts...>::value;

} // namespace jni::metaprogramming

#endif // JNI_BIND_METAPROGRAMMING_ALL_H_
#endif // JNI_BIND_BIND_LANG_METAPROGRAMMING_ALL_H_
File renamed without changes.
Original file line number Diff line number Diff line change
Expand Up @@ -14,8 +14,8 @@
* limitations under the License.
*/

#ifndef JNI_BIND_METAPROGRAMMING_ALL_UNIQUE_H_
#define JNI_BIND_METAPROGRAMMING_ALL_UNIQUE_H_
#ifndef JNI_BIND_BIND_LANG_METAPROGRAMMING_ALL_UNIQUE_H_
#define JNI_BIND_BIND_LANG_METAPROGRAMMING_ALL_UNIQUE_H_

#include <type_traits>

Expand Down Expand Up @@ -49,4 +49,4 @@ constexpr bool AllUniqueValues(const T1&& t1, const Ts&&... ts) {

} // namespace jni::metaprogramming

#endif // JNI_BIND_METAPROGRAMMING_ALL_UNIQUE_H_
#endif // JNI_BIND_BIND_LANG_METAPROGRAMMING_ALL_UNIQUE_H_
6 changes: 3 additions & 3 deletions metaprogramming/any.h → bind_lang/metaprogramming/any.h
Original file line number Diff line number Diff line change
Expand Up @@ -14,8 +14,8 @@
* limitations under the License.
*/

#ifndef JNI_BIND_METAPROGRAMMING_ANY_H_
#define JNI_BIND_METAPROGRAMMING_ANY_H_
#ifndef JNI_BIND_BIND_LANG_METAPROGRAMMING_ANY_H_
#define JNI_BIND_BIND_LANG_METAPROGRAMMING_ANY_H_

#include <type_traits>

Expand Down Expand Up @@ -44,4 +44,4 @@ static constexpr bool Any_Tup_v = TupleUnroller_t<Any<Func>, Ts>::value;

} // namespace jni::metaprogramming

#endif // JNI_BIND_METAPROGRAMMING_ANY_H_
#endif // JNI_BIND_BIND_LANG_METAPROGRAMMING_ANY_H_
File renamed without changes.
6 changes: 3 additions & 3 deletions metaprogramming/apply.h → bind_lang/metaprogramming/apply.h
Original file line number Diff line number Diff line change
Expand Up @@ -14,8 +14,8 @@
* limitations under the License.
*/

#ifndef JNI_BIND_METAPROGRAMMING_APPLY_H_
#define JNI_BIND_METAPROGRAMMING_APPLY_H_
#ifndef JNI_BIND_BIND_LANG_METAPROGRAMMING_APPLY_H_
#define JNI_BIND_BIND_LANG_METAPROGRAMMING_APPLY_H_

#include "tuple_manipulation.h"

Expand All @@ -39,4 +39,4 @@ using ApplyTup_t = TupleUnroller_t<Apply<Function>, TupleType>;

} // namespace jni::metaprogramming

#endif // JNI_BIND_METAPROGRAMMING_APPLY_H_
#endif // JNI_BIND_BIND_LANG_METAPROGRAMMING_APPLY_H_
File renamed without changes.
6 changes: 3 additions & 3 deletions metaprogramming/base.h → bind_lang/metaprogramming/base.h
Original file line number Diff line number Diff line change
Expand Up @@ -14,8 +14,8 @@
* limitations under the License.
*/

#ifndef JNI_BIND_METAPROGRAMMING_BASE_H_
#define JNI_BIND_METAPROGRAMMING_BASE_H_
#ifndef JNI_BIND_BIND_LANG_METAPROGRAMMING_BASE_H_
#define JNI_BIND_BIND_LANG_METAPROGRAMMING_BASE_H_

#include <type_traits>

Expand All @@ -32,4 +32,4 @@ using Base_t = typename Base<BaseToTest>::template type<TypeToTest>;

} // namespace jni::metaprogramming

#endif // JNI_BIND_METAPROGRAMMING_BASE_H_
#endif // JNI_BIND_BIND_LANG_METAPROGRAMMING_BASE_H_
Original file line number Diff line number Diff line change
Expand Up @@ -14,8 +14,8 @@
* limitations under the License.
*/

#ifndef JNI_BIND_METAPROGRAMMING_BASE_FILTER_H_
#define JNI_BIND_METAPROGRAMMING_BASE_FILTER_H_
#ifndef JNI_BIND_BIND_LANG_METAPROGRAMMING_BASE_FILTER_H_
#define JNI_BIND_BIND_LANG_METAPROGRAMMING_BASE_FILTER_H_

#include <tuple>
#include <type_traits>
Expand Down Expand Up @@ -67,4 +67,4 @@ using BaseFilterWithDefault_t =

} // namespace jni::metaprogramming

#endif // JNI_BIND_METAPROGRAMMING_BASE_FILTER_H_
#endif // JNI_BIND_BIND_LANG_METAPROGRAMMING_BASE_FILTER_H_
6 changes: 3 additions & 3 deletions metaprogramming/call.h → bind_lang/metaprogramming/call.h
Original file line number Diff line number Diff line change
Expand Up @@ -13,8 +13,8 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
#ifndef JNI_BIND_METAPROGRAMMING_CALL_H_
#define JNI_BIND_METAPROGRAMMING_CALL_H_
#ifndef JNI_BIND_BIND_LANG_METAPROGRAMMING_CALL_H_
#define JNI_BIND_BIND_LANG_METAPROGRAMMING_CALL_H_

#include <tuple>

Expand All @@ -41,4 +41,4 @@ using Call_t = typename Call::type<T>;

} // namespace jni::metaprogramming

#endif // JNI_BIND_METAPROGRAMMING_CALL_H_
#endif // JNI_BIND_BIND_LANG_METAPROGRAMMING_CALL_H_
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
* limitations under the License.
*/

#include "metaprogramming/call.h"
#include "bind_lang/metaprogramming/call.h"

#include <tuple>
#include <type_traits>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,8 +14,8 @@
* limitations under the License.
*/

#ifndef JNI_BIND_METAPROGRAMMING_CARTESIAN_PRODUCT_H_
#define JNI_BIND_METAPROGRAMMING_CARTESIAN_PRODUCT_H_
#ifndef JNI_BIND_BIND_LANG_METAPROGRAMMING_CARTESIAN_PRODUCT_H_
#define JNI_BIND_BIND_LANG_METAPROGRAMMING_CARTESIAN_PRODUCT_H_

#include <cstddef>
#include <tuple>
Expand Down Expand Up @@ -102,4 +102,4 @@ using CartesianProduct_t = typename CartesianProduct::template type<Tups...>;

} // namespace jni::metaprogramming

#endif // JNI_BIND_METAPROGRAMMING_CARTESIAN_PRODUCT_H_
#endif // JNI_BIND_BIND_LANG_METAPROGRAMMING_CARTESIAN_PRODUCT_H_
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,6 @@ using ::jni::metaprogramming::GenerateBitSequenceFromTupSets_t;
using ::jni::metaprogramming::InvokeAsPack_t;
using ::jni::metaprogramming::NBit;
using ::jni::metaprogramming::NBitSequence;
using ::jni::metaprogramming::TupleUnroller_t;

template <typename... Ts>
using Tup = std::tuple<Ts...>;
Expand Down
6 changes: 3 additions & 3 deletions metaprogramming/chain.h → bind_lang/metaprogramming/chain.h
Original file line number Diff line number Diff line change
Expand Up @@ -14,8 +14,8 @@
* limitations under the License.
*/

#ifndef JNI_BIND_METAPROGRAMMING_CHAIN_H_
#define JNI_BIND_METAPROGRAMMING_CHAIN_H_
#ifndef JNI_BIND_BIND_LANG_METAPROGRAMMING_CHAIN_H_
#define JNI_BIND_BIND_LANG_METAPROGRAMMING_CHAIN_H_

#include "invoke.h"

Expand Down Expand Up @@ -44,4 +44,4 @@ struct Chain<FirstFunc, Funcs...> {

} // namespace jni::metaprogramming

#endif // JNI_BIND_METAPROGRAMMING_CHAIN_H_
#endif // JNI_BIND_BIND_LANG_METAPROGRAMMING_CHAIN_H_
File renamed without changes.
6 changes: 3 additions & 3 deletions metaprogramming/color.h → bind_lang/metaprogramming/color.h
Original file line number Diff line number Diff line change
Expand Up @@ -14,8 +14,8 @@
* limitations under the License.
*/

#ifndef JNI_BIND_METAPROGRAMMING_COLOUR_H_
#define JNI_BIND_METAPROGRAMMING_COLOUR_H_
#ifndef JNI_BIND_BIND_LANG_METAPROGRAMMING_COLOR_H_
#define JNI_BIND_BIND_LANG_METAPROGRAMMING_COLOR_H_

#include <string>
#include <string_view>
Expand Down Expand Up @@ -73,4 +73,4 @@ inline std::string Colorize(std::string_view colour, std::string_view str,

} // namespace jni::metaprogramming

#endif // JNI_BIND_METAPROGRAMMING_COLOUR_H_
#endif // JNI_BIND_BIND_LANG_METAPROGRAMMING_COLOR_H_
File renamed without changes.
Original file line number Diff line number Diff line change
Expand Up @@ -14,8 +14,8 @@
* limitations under the License.
*/

#ifndef JNI_BIND_METAPROGRAMMING_COMBINE_H_
#define JNI_BIND_METAPROGRAMMING_COMBINE_H_
#ifndef JNI_BIND_BIND_LANG_METAPROGRAMMING_COMBINE_H_
#define JNI_BIND_BIND_LANG_METAPROGRAMMING_COMBINE_H_

#include <tuple>

Expand Down Expand Up @@ -43,4 +43,4 @@ using Combine_t = typename Combine::template type<Tup1, Tup2>;

} // namespace jni::metaprogramming

#endif // JNI_BIND_METAPROGRAMMING_COMBINE_H_
#endif // JNI_BIND_BIND_LANG_METAPROGRAMMING_COMBINE_H_
Original file line number Diff line number Diff line change
Expand Up @@ -14,8 +14,8 @@
* limitations under the License.
*/

#ifndef JNI_BIND_METAPROGRAMMING_CONCATENATE_H_
#define JNI_BIND_METAPROGRAMMING_CONCATENATE_H_
#ifndef JNI_BIND_BIND_LANG_METAPROGRAMMING_CONCATENATE_H_
#define JNI_BIND_BIND_LANG_METAPROGRAMMING_CONCATENATE_H_

#include <tuple>

Expand Down Expand Up @@ -49,4 +49,4 @@ using ConcatenateTup_t = Reduce_t<Combine, Tups...>;

} // namespace jni::metaprogramming

#endif // JNI_BIND_METAPROGRAMMING_CONCATENATE_H_
#endif // JNI_BIND_BIND_LANG_METAPROGRAMMING_CONCATENATE_H_
Original file line number Diff line number Diff line change
Expand Up @@ -14,8 +14,8 @@
* limitations under the License.
*/

#ifndef JNI_BIND_METAPROGRAMMING_CONDITIONAL_H_
#define JNI_BIND_METAPROGRAMMING_CONDITIONAL_H_
#ifndef JNI_BIND_BIND_LANG_METAPROGRAMMING_CONDITIONAL_H_
#define JNI_BIND_BIND_LANG_METAPROGRAMMING_CONDITIONAL_H_

#include <tuple>
#include <type_traits>
Expand All @@ -40,4 +40,4 @@ using Conditional_t = typename Conditional<Func>::template type<Ts...>;

} // namespace jni::metaprogramming

#endif // JNI_BIND_METAPROGRAMMING_CONDITIONAL_H_
#endif // JNI_BIND_BIND_LANG_METAPROGRAMMING_CONDITIONAL_H_
Original file line number Diff line number Diff line change
Expand Up @@ -14,8 +14,8 @@
* limitations under the License.
*/

#ifndef JNI_BIND_METAPROGRAMMING_CONTAINS_H_
#define JNI_BIND_METAPROGRAMMING_CONTAINS_H_
#ifndef JNI_BIND_BIND_LANG_METAPROGRAMMING_CONTAINS_H_
#define JNI_BIND_BIND_LANG_METAPROGRAMMING_CONTAINS_H_

#include "any.h"
#include "invoke.h"
Expand Down Expand Up @@ -44,4 +44,4 @@ constexpr bool ContainsValue(const SoughtType& sought_value, Ts&&... ts) {

} // namespace jni::metaprogramming

#endif // JNI_BIND_METAPROGRAMMING_CONTAINS_H_
#endif // JNI_BIND_BIND_LANG_METAPROGRAMMING_CONTAINS_H_
Original file line number Diff line number Diff line change
Expand Up @@ -14,8 +14,8 @@
* limitations under the License.
*/

#ifndef JNI_BIND_METAPROGRAMMING_CONTAINS_BASE_H_
#define JNI_BIND_METAPROGRAMMING_CONTAINS_BASE_H_
#ifndef JNI_BIND_BIND_LANG_METAPROGRAMMING_CONTAINS_BASE_H_
#define JNI_BIND_BIND_LANG_METAPROGRAMMING_CONTAINS_BASE_H_

#include "any.h"
#include "base.h"
Expand All @@ -41,4 +41,4 @@ static constexpr bool TupContainsBase_v =

} // namespace jni::metaprogramming

#endif // JNI_BIND_METAPROGRAMMING_CONTAINS_BASE_H_
#endif // JNI_BIND_BIND_LANG_METAPROGRAMMING_CONTAINS_BASE_H_
Original file line number Diff line number Diff line change
Expand Up @@ -14,8 +14,8 @@
* limitations under the License.
*/

#ifndef JNI_BIND_IMPLEMENTATION_CORPUS_H_
#define JNI_BIND_IMPLEMENTATION_CORPUS_H_
#ifndef JNI_BIND_BIND_LANG_METAPROGRAMMING_CORPUS_H_
#define JNI_BIND_BIND_LANG_METAPROGRAMMING_CORPUS_H_

#include <tuple>

Expand Down Expand Up @@ -49,4 +49,4 @@ using Corpus_t = typename Corpus<Defaults...>::template type<T>;

} // namespace jni::metaprogramming

#endif // JNI_BIND_IMPLEMENTATION_CORPUS_H_
#endif // JNI_BIND_BIND_LANG_METAPROGRAMMING_CORPUS_H_
Loading
Loading