forked from dropbox/djinni
-
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.
Merge pull request dropbox#259 from dropbox/AT/WIP/EnumFix
Fix enum compile issue in C++11
- Loading branch information
Showing
46 changed files
with
1,879 additions
and
290 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
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 example.djinni | ||
|
||
#include "sort_order.hpp" | ||
#import "DJIMarshal+Private.h" | ||
|
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
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
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
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,30 @@ | ||
// AUTOGENERATED FILE - DO NOT MODIFY! | ||
// This file generated by Djinni from enum.djinni | ||
|
||
#pragma once | ||
|
||
#include "../../handwritten-src/cpp/optional.hpp" | ||
#include <unordered_map> | ||
#include <unordered_set> | ||
#include <vector> | ||
|
||
namespace testsuite { | ||
|
||
enum class color; | ||
|
||
class EnumUsageInterface { | ||
public: | ||
virtual ~EnumUsageInterface() {} | ||
|
||
virtual color e(color e) = 0; | ||
|
||
virtual std::experimental::optional<color> o(std::experimental::optional<color> o) = 0; | ||
|
||
virtual std::vector<color> l(const std::vector<color> & l) = 0; | ||
|
||
virtual std::unordered_set<color> s(const std::unordered_set<color> & s) = 0; | ||
|
||
virtual std::unordered_map<color, color> m(const std::unordered_map<color, color> & m) = 0; | ||
}; | ||
|
||
} // namespace testsuite |
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,35 @@ | ||
// AUTOGENERATED FILE - DO NOT MODIFY! | ||
// This file generated by Djinni from enum.djinni | ||
|
||
#pragma once | ||
|
||
#include "../../handwritten-src/cpp/optional.hpp" | ||
#include "color.hpp" | ||
#include <unordered_map> | ||
#include <unordered_set> | ||
#include <utility> | ||
#include <vector> | ||
|
||
namespace testsuite { | ||
|
||
struct EnumUsageRecord final { | ||
color e; | ||
std::experimental::optional<color> o; | ||
std::vector<color> l; | ||
std::unordered_set<color> s; | ||
std::unordered_map<color, color> m; | ||
|
||
EnumUsageRecord(color e_, | ||
std::experimental::optional<color> o_, | ||
std::vector<color> l_, | ||
std::unordered_set<color> s_, | ||
std::unordered_map<color, color> m_) | ||
: e(std::move(e_)) | ||
, o(std::move(o_)) | ||
, l(std::move(l_)) | ||
, s(std::move(s_)) | ||
, m(std::move(m_)) | ||
{} | ||
}; | ||
|
||
} // namespace testsuite |
This file was deleted.
Oops, something went wrong.
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
92 changes: 92 additions & 0 deletions
92
test-suite/generated-src/java/com/dropbox/djinni/test/EnumUsageInterface.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,92 @@ | ||
// AUTOGENERATED FILE - DO NOT MODIFY! | ||
// This file generated by Djinni from enum.djinni | ||
|
||
package com.dropbox.djinni.test; | ||
|
||
import java.util.ArrayList; | ||
import java.util.HashMap; | ||
import java.util.HashSet; | ||
import java.util.concurrent.atomic.AtomicBoolean; | ||
import javax.annotation.CheckForNull; | ||
import javax.annotation.Nonnull; | ||
|
||
public abstract class EnumUsageInterface { | ||
@Nonnull | ||
public abstract Color e(@Nonnull Color e); | ||
|
||
@CheckForNull | ||
public abstract Color o(@CheckForNull Color o); | ||
|
||
@Nonnull | ||
public abstract ArrayList<Color> l(@Nonnull ArrayList<Color> l); | ||
|
||
@Nonnull | ||
public abstract HashSet<Color> s(@Nonnull HashSet<Color> s); | ||
|
||
@Nonnull | ||
public abstract HashMap<Color, Color> m(@Nonnull HashMap<Color, Color> m); | ||
|
||
private static final class CppProxy extends EnumUsageInterface | ||
{ | ||
private final long nativeRef; | ||
private final AtomicBoolean destroyed = new AtomicBoolean(false); | ||
|
||
private CppProxy(long nativeRef) | ||
{ | ||
if (nativeRef == 0) throw new RuntimeException("nativeRef is zero"); | ||
this.nativeRef = nativeRef; | ||
} | ||
|
||
private native void nativeDestroy(long nativeRef); | ||
public void destroy() | ||
{ | ||
boolean destroyed = this.destroyed.getAndSet(true); | ||
if (!destroyed) nativeDestroy(this.nativeRef); | ||
} | ||
protected void finalize() throws java.lang.Throwable | ||
{ | ||
destroy(); | ||
super.finalize(); | ||
} | ||
|
||
@Override | ||
public Color e(Color e) | ||
{ | ||
assert !this.destroyed.get() : "trying to use a destroyed object"; | ||
return native_e(this.nativeRef, e); | ||
} | ||
private native Color native_e(long _nativeRef, Color e); | ||
|
||
@Override | ||
public Color o(Color o) | ||
{ | ||
assert !this.destroyed.get() : "trying to use a destroyed object"; | ||
return native_o(this.nativeRef, o); | ||
} | ||
private native Color native_o(long _nativeRef, Color o); | ||
|
||
@Override | ||
public ArrayList<Color> l(ArrayList<Color> l) | ||
{ | ||
assert !this.destroyed.get() : "trying to use a destroyed object"; | ||
return native_l(this.nativeRef, l); | ||
} | ||
private native ArrayList<Color> native_l(long _nativeRef, ArrayList<Color> l); | ||
|
||
@Override | ||
public HashSet<Color> s(HashSet<Color> s) | ||
{ | ||
assert !this.destroyed.get() : "trying to use a destroyed object"; | ||
return native_s(this.nativeRef, s); | ||
} | ||
private native HashSet<Color> native_s(long _nativeRef, HashSet<Color> s); | ||
|
||
@Override | ||
public HashMap<Color, Color> m(HashMap<Color, Color> m) | ||
{ | ||
assert !this.destroyed.get() : "trying to use a destroyed object"; | ||
return native_m(this.nativeRef, m); | ||
} | ||
private native HashMap<Color, Color> native_m(long _nativeRef, HashMap<Color, Color> m); | ||
} | ||
} |
Oops, something went wrong.