This repository has been archived by the owner on Mar 26, 2020. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 488
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Added support for constexpr for primitives in header files (#354)
* Got a basic version of constexpr in headers working * got enum values to work as well * can't do enums because interface headers forward declare so you can't set it there. So only primitives allowed * fixing const enums in obj-c, which apparently never worked to begin with
- Loading branch information
Showing
23 changed files
with
222 additions
and
53 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
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -5,4 +5,5 @@ The complete list of contributors can be identified through | |
Git history. | ||
|
||
- Google Inc. | ||
- Microsoft Corp. | ||
|
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
// AUTOGENERATED FILE - DO NOT MODIFY! | ||
// This file generated by Djinni from constants.djinni | ||
|
||
#pragma once | ||
|
||
#include <functional> | ||
|
||
namespace testsuite { | ||
|
||
enum class constant_enum : int { | ||
SOME_VALUE, | ||
SOME_OTHER_VALUE, | ||
}; | ||
|
||
} // namespace testsuite | ||
|
||
namespace std { | ||
|
||
template <> | ||
struct hash<::testsuite::constant_enum> { | ||
size_t operator()(::testsuite::constant_enum type) const { | ||
return std::hash<int>()(static_cast<int>(type)); | ||
} | ||
}; | ||
|
||
} // namespace std |
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
14 changes: 14 additions & 0 deletions
14
test-suite/generated-src/java/com/dropbox/djinni/test/ConstantEnum.java
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,14 @@ | ||
// AUTOGENERATED FILE - DO NOT MODIFY! | ||
// This file generated by Djinni from constants.djinni | ||
|
||
package com.dropbox.djinni.test; | ||
|
||
import javax.annotation.CheckForNull; | ||
import javax.annotation.Nonnull; | ||
|
||
/** enum for use in constants */ | ||
public enum ConstantEnum { | ||
SOME_VALUE, | ||
SOME_OTHER_VALUE, | ||
; | ||
} |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
// AUTOGENERATED FILE - DO NOT MODIFY! | ||
// This file generated by Djinni from constants.djinni | ||
|
||
#pragma once | ||
|
||
#include "constant_enum.hpp" | ||
#include "djinni_support.hpp" | ||
|
||
namespace djinni_generated { | ||
|
||
class NativeConstantEnum final : ::djinni::JniEnum { | ||
public: | ||
using CppType = ::testsuite::constant_enum; | ||
using JniType = jobject; | ||
|
||
using Boxed = NativeConstantEnum; | ||
|
||
static CppType toCpp(JNIEnv* jniEnv, JniType j) { return static_cast<CppType>(::djinni::JniClass<NativeConstantEnum>::get().ordinal(jniEnv, j)); } | ||
static ::djinni::LocalRef<JniType> fromCpp(JNIEnv* jniEnv, CppType c) { return ::djinni::JniClass<NativeConstantEnum>::get().create(jniEnv, static_cast<jint>(c)); } | ||
|
||
private: | ||
NativeConstantEnum() : JniEnum("com/dropbox/djinni/test/ConstantEnum") {} | ||
friend ::djinni::JniClass<NativeConstantEnum>; | ||
}; | ||
|
||
} // namespace djinni_generated |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
// AUTOGENERATED FILE - DO NOT MODIFY! | ||
// This file generated by Djinni from constants.djinni | ||
|
||
#include "constant_enum.hpp" | ||
#import "DJIMarshal+Private.h" | ||
|
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,11 @@ | ||
// AUTOGENERATED FILE - DO NOT MODIFY! | ||
// This file generated by Djinni from constants.djinni | ||
|
||
#import <Foundation/Foundation.h> | ||
|
||
/** enum for use in constants */ | ||
typedef NS_ENUM(NSInteger, DBConstantEnum) | ||
{ | ||
DBConstantEnumSomeValue, | ||
DBConstantEnumSomeOtherValue, | ||
}; |
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.