diff --git a/core/src/hir/defs.rs b/core/src/hir/defs.rs
index fbc2b586e..16bd42ed8 100644
--- a/core/src/hir/defs.rs
+++ b/core/src/hir/defs.rs
@@ -152,15 +152,9 @@ impl EnumDef {
}
}
-impl<'a> From<&'a StructDef> for TypeDef<'a> {
- fn from(x: &'a StructDef) -> Self {
- TypeDef::Struct(x)
- }
-}
-
-impl<'a> From<&'a OutStructDef> for TypeDef<'a> {
- fn from(x: &'a OutStructDef) -> Self {
- TypeDef::OutStruct(x)
+impl<'a, P: TyPosition> From<&'a StructDef
> for TypeDef<'a> {
+ fn from(x: &'a StructDef
) -> Self {
+ P::wrap_struct_def(x)
}
}
diff --git a/core/src/hir/ty_position.rs b/core/src/hir/ty_position.rs
index 87916a7f7..4312681eb 100644
--- a/core/src/hir/ty_position.rs
+++ b/core/src/hir/ty_position.rs
@@ -1,7 +1,7 @@
use super::lifetimes::{Lifetime, Lifetimes, MaybeStatic};
use super::{
- Borrow, LinkedLifetimes, MaybeOwn, Mutability, OutStructId, ReturnableStructPath, StructId,
- StructPath, TypeContext, TypeId,
+ Borrow, LinkedLifetimes, MaybeOwn, Mutability, OutStructId, ReturnableStructPath, StructDef,
+ StructId, StructPath, TypeContext, TypeDef, TypeId,
};
use core::fmt::Debug;
@@ -87,7 +87,10 @@ use core::fmt::Debug;
/// Therefore, this trait allows be extremely precise about making invalid states
/// unrepresentable, while also reducing duplicated code.
///
-pub trait TyPosition: Debug + Copy {
+pub trait TyPosition: Debug + Copy
+where
+ for<'tcx> TypeDef<'tcx>: From<&'tcx StructDef>,
+{
const IS_OUT_ONLY: bool;
/// Type representing how we can point to opaques, which must always be behind a pointer.
@@ -102,6 +105,8 @@ pub trait TyPosition: Debug + Copy {
type StructId: Debug;
type StructPath: Debug + StructPathLike;
+
+ fn wrap_struct_def<'tcx>(def: &'tcx StructDef) -> TypeDef<'tcx>;
}
/// One of two types implementing [`TyPosition`], representing types that can be
@@ -125,6 +130,10 @@ impl TyPosition for Everywhere {
type OpaqueOwnership = Borrow;
type StructId = StructId;
type StructPath = StructPath;
+
+ fn wrap_struct_def<'tcx>(def: &'tcx StructDef) -> TypeDef<'tcx> {
+ TypeDef::Struct(def)
+ }
}
impl TyPosition for OutputOnly {
@@ -132,6 +141,10 @@ impl TyPosition for OutputOnly {
type OpaqueOwnership = MaybeOwn;
type StructId = OutStructId;
type StructPath = ReturnableStructPath;
+
+ fn wrap_struct_def<'tcx>(def: &'tcx StructDef) -> TypeDef<'tcx> {
+ TypeDef::OutStruct(def)
+ }
}
pub trait StructPathLike {
diff --git a/example/cpp2/include/ICU4XDataProvider.d.h b/example/cpp2/include/ICU4XDataProvider.d.h
deleted file mode 100644
index 8a6432968..000000000
--- a/example/cpp2/include/ICU4XDataProvider.d.h
+++ /dev/null
@@ -1,20 +0,0 @@
-#ifndef ICU4XDataProvider_D_H
-#define ICU4XDataProvider_D_H
-
-#include
-#include
-#include
-#include
-#include "diplomat_runtime.h"
-
-
-namespace capi {
-
-
-typedef struct ICU4XDataProvider ICU4XDataProvider;
-
-
-
-} // namespace capi
-
-#endif // ICU4XDataProvider_D_H
diff --git a/example/cpp2/include/ICU4XDataProvider.d.hpp b/example/cpp2/include/ICU4XDataProvider.d.hpp
index 65b9baab7..4b31caaa0 100644
--- a/example/cpp2/include/ICU4XDataProvider.d.hpp
+++ b/example/cpp2/include/ICU4XDataProvider.d.hpp
@@ -8,9 +8,12 @@
#include
#include
#include "diplomat_runtime.hpp"
-#include "ICU4XDataProvider.d.h"
+namespace capi {
+ typedef struct ICU4XDataProvider ICU4XDataProvider;
+}
+
class ICU4XDataProvider {
public:
diff --git a/example/cpp2/include/ICU4XDataProvider.h b/example/cpp2/include/ICU4XDataProvider.h
deleted file mode 100644
index 9a9b91187..000000000
--- a/example/cpp2/include/ICU4XDataProvider.h
+++ /dev/null
@@ -1,30 +0,0 @@
-#ifndef ICU4XDataProvider_H
-#define ICU4XDataProvider_H
-
-#include
-#include
-#include
-#include
-#include "diplomat_runtime.h"
-
-
-#include "ICU4XDataProvider.d.h"
-
-namespace capi {
-
-
-extern "C" {
-
-ICU4XDataProvider* ICU4XDataProvider_new_static();
-
-struct ICU4XDataProvider_returns_result_result { bool is_ok;};
-struct ICU4XDataProvider_returns_result_result ICU4XDataProvider_returns_result();
-
-
-void ICU4XDataProvider_destroy(ICU4XDataProvider* self);
-
-} // extern "C"
-
-} // namespace capi
-
-#endif // ICU4XDataProvider_H
diff --git a/example/cpp2/include/ICU4XDataProvider.hpp b/example/cpp2/include/ICU4XDataProvider.hpp
index 5e2c0140d..e6d738d18 100644
--- a/example/cpp2/include/ICU4XDataProvider.hpp
+++ b/example/cpp2/include/ICU4XDataProvider.hpp
@@ -10,9 +10,22 @@
#include
#include
#include "diplomat_runtime.hpp"
-#include "ICU4XDataProvider.h"
+namespace capi {
+ extern "C" {
+
+ ICU4XDataProvider* ICU4XDataProvider_new_static();
+
+ struct ICU4XDataProvider_returns_result_result { bool is_ok;};
+ struct ICU4XDataProvider_returns_result_result ICU4XDataProvider_returns_result();
+
+
+ void ICU4XDataProvider_destroy(ICU4XDataProvider* self);
+
+ } // extern "C"
+}
+
inline std::unique_ptr ICU4XDataProvider::new_static() {
auto result = capi::ICU4XDataProvider_new_static();
return std::unique_ptr(ICU4XDataProvider::FromFFI(result));
diff --git a/example/cpp2/include/ICU4XFixedDecimal.d.h b/example/cpp2/include/ICU4XFixedDecimal.d.h
deleted file mode 100644
index 45cb0a614..000000000
--- a/example/cpp2/include/ICU4XFixedDecimal.d.h
+++ /dev/null
@@ -1,20 +0,0 @@
-#ifndef ICU4XFixedDecimal_D_H
-#define ICU4XFixedDecimal_D_H
-
-#include
-#include
-#include
-#include
-#include "diplomat_runtime.h"
-
-
-namespace capi {
-
-
-typedef struct ICU4XFixedDecimal ICU4XFixedDecimal;
-
-
-
-} // namespace capi
-
-#endif // ICU4XFixedDecimal_D_H
diff --git a/example/cpp2/include/ICU4XFixedDecimal.d.hpp b/example/cpp2/include/ICU4XFixedDecimal.d.hpp
index e13f0adc5..45b9a5763 100644
--- a/example/cpp2/include/ICU4XFixedDecimal.d.hpp
+++ b/example/cpp2/include/ICU4XFixedDecimal.d.hpp
@@ -8,9 +8,12 @@
#include
#include
#include "diplomat_runtime.hpp"
-#include "ICU4XFixedDecimal.d.h"
+namespace capi {
+ typedef struct ICU4XFixedDecimal ICU4XFixedDecimal;
+}
+
class ICU4XFixedDecimal {
public:
diff --git a/example/cpp2/include/ICU4XFixedDecimal.h b/example/cpp2/include/ICU4XFixedDecimal.h
deleted file mode 100644
index 22de29f4d..000000000
--- a/example/cpp2/include/ICU4XFixedDecimal.h
+++ /dev/null
@@ -1,32 +0,0 @@
-#ifndef ICU4XFixedDecimal_H
-#define ICU4XFixedDecimal_H
-
-#include
-#include
-#include
-#include
-#include "diplomat_runtime.h"
-
-
-#include "ICU4XFixedDecimal.d.h"
-
-namespace capi {
-
-
-extern "C" {
-
-ICU4XFixedDecimal* ICU4XFixedDecimal_new(int32_t v);
-
-void ICU4XFixedDecimal_multiply_pow10(ICU4XFixedDecimal* self, int16_t power);
-
-struct ICU4XFixedDecimal_to_string_result { bool is_ok;};
-struct ICU4XFixedDecimal_to_string_result ICU4XFixedDecimal_to_string(const ICU4XFixedDecimal* self, DiplomatWrite* write);
-
-
-void ICU4XFixedDecimal_destroy(ICU4XFixedDecimal* self);
-
-} // extern "C"
-
-} // namespace capi
-
-#endif // ICU4XFixedDecimal_H
diff --git a/example/cpp2/include/ICU4XFixedDecimal.hpp b/example/cpp2/include/ICU4XFixedDecimal.hpp
index 4c2de6585..c95f80aa9 100644
--- a/example/cpp2/include/ICU4XFixedDecimal.hpp
+++ b/example/cpp2/include/ICU4XFixedDecimal.hpp
@@ -10,9 +10,24 @@
#include
#include
#include "diplomat_runtime.hpp"
-#include "ICU4XFixedDecimal.h"
+namespace capi {
+ extern "C" {
+
+ ICU4XFixedDecimal* ICU4XFixedDecimal_new(int32_t v);
+
+ void ICU4XFixedDecimal_multiply_pow10(ICU4XFixedDecimal* self, int16_t power);
+
+ struct ICU4XFixedDecimal_to_string_result { bool is_ok;};
+ struct ICU4XFixedDecimal_to_string_result ICU4XFixedDecimal_to_string(const ICU4XFixedDecimal* self, DiplomatWrite* write);
+
+
+ void ICU4XFixedDecimal_destroy(ICU4XFixedDecimal* self);
+
+ } // extern "C"
+}
+
inline std::unique_ptr ICU4XFixedDecimal::new_(int32_t v) {
auto result = capi::ICU4XFixedDecimal_new(v);
return std::unique_ptr(ICU4XFixedDecimal::FromFFI(result));
diff --git a/example/cpp2/include/ICU4XFixedDecimalFormatter.d.h b/example/cpp2/include/ICU4XFixedDecimalFormatter.d.h
deleted file mode 100644
index 42fb93618..000000000
--- a/example/cpp2/include/ICU4XFixedDecimalFormatter.d.h
+++ /dev/null
@@ -1,20 +0,0 @@
-#ifndef ICU4XFixedDecimalFormatter_D_H
-#define ICU4XFixedDecimalFormatter_D_H
-
-#include
-#include
-#include
-#include
-#include "diplomat_runtime.h"
-
-
-namespace capi {
-
-
-typedef struct ICU4XFixedDecimalFormatter ICU4XFixedDecimalFormatter;
-
-
-
-} // namespace capi
-
-#endif // ICU4XFixedDecimalFormatter_D_H
diff --git a/example/cpp2/include/ICU4XFixedDecimalFormatter.d.hpp b/example/cpp2/include/ICU4XFixedDecimalFormatter.d.hpp
index 31616a878..c31dc2bb9 100644
--- a/example/cpp2/include/ICU4XFixedDecimalFormatter.d.hpp
+++ b/example/cpp2/include/ICU4XFixedDecimalFormatter.d.hpp
@@ -8,7 +8,6 @@
#include
#include
#include "diplomat_runtime.hpp"
-#include "ICU4XFixedDecimalFormatter.d.h"
#include "ICU4XFixedDecimalFormatterOptions.d.hpp"
class ICU4XDataProvider;
@@ -17,6 +16,10 @@ class ICU4XLocale;
struct ICU4XFixedDecimalFormatterOptions;
+namespace capi {
+ typedef struct ICU4XFixedDecimalFormatter ICU4XFixedDecimalFormatter;
+}
+
class ICU4XFixedDecimalFormatter {
public:
diff --git a/example/cpp2/include/ICU4XFixedDecimalFormatter.h b/example/cpp2/include/ICU4XFixedDecimalFormatter.h
deleted file mode 100644
index abc9131f8..000000000
--- a/example/cpp2/include/ICU4XFixedDecimalFormatter.h
+++ /dev/null
@@ -1,34 +0,0 @@
-#ifndef ICU4XFixedDecimalFormatter_H
-#define ICU4XFixedDecimalFormatter_H
-
-#include
-#include
-#include
-#include
-#include "diplomat_runtime.h"
-
-#include "ICU4XDataProvider.d.h"
-#include "ICU4XFixedDecimal.d.h"
-#include "ICU4XFixedDecimalFormatterOptions.d.h"
-#include "ICU4XLocale.d.h"
-
-#include "ICU4XFixedDecimalFormatter.d.h"
-
-namespace capi {
-
-
-extern "C" {
-
-struct ICU4XFixedDecimalFormatter_try_new_result {union {ICU4XFixedDecimalFormatter* ok; }; bool is_ok;};
-struct ICU4XFixedDecimalFormatter_try_new_result ICU4XFixedDecimalFormatter_try_new(const ICU4XLocale* locale, const ICU4XDataProvider* provider, ICU4XFixedDecimalFormatterOptions options);
-
-void ICU4XFixedDecimalFormatter_format_write(const ICU4XFixedDecimalFormatter* self, const ICU4XFixedDecimal* value, DiplomatWrite* write);
-
-
-void ICU4XFixedDecimalFormatter_destroy(ICU4XFixedDecimalFormatter* self);
-
-} // extern "C"
-
-} // namespace capi
-
-#endif // ICU4XFixedDecimalFormatter_H
diff --git a/example/cpp2/include/ICU4XFixedDecimalFormatter.hpp b/example/cpp2/include/ICU4XFixedDecimalFormatter.hpp
index 1a75e2f36..3e44149ae 100644
--- a/example/cpp2/include/ICU4XFixedDecimalFormatter.hpp
+++ b/example/cpp2/include/ICU4XFixedDecimalFormatter.hpp
@@ -12,11 +12,24 @@
#include "diplomat_runtime.hpp"
#include "ICU4XDataProvider.hpp"
#include "ICU4XFixedDecimal.hpp"
-#include "ICU4XFixedDecimalFormatter.h"
#include "ICU4XFixedDecimalFormatterOptions.hpp"
#include "ICU4XLocale.hpp"
+namespace capi {
+ extern "C" {
+
+ struct ICU4XFixedDecimalFormatter_try_new_result {union {ICU4XFixedDecimalFormatter* ok; }; bool is_ok;};
+ struct ICU4XFixedDecimalFormatter_try_new_result ICU4XFixedDecimalFormatter_try_new(const ICU4XLocale* locale, const ICU4XDataProvider* provider, ICU4XFixedDecimalFormatterOptions options);
+
+ void ICU4XFixedDecimalFormatter_format_write(const ICU4XFixedDecimalFormatter* self, const ICU4XFixedDecimal* value, DiplomatWrite* write);
+
+
+ void ICU4XFixedDecimalFormatter_destroy(ICU4XFixedDecimalFormatter* self);
+
+ } // extern "C"
+}
+
inline diplomat::result, std::monostate> ICU4XFixedDecimalFormatter::try_new(const ICU4XLocale& locale, const ICU4XDataProvider& provider, ICU4XFixedDecimalFormatterOptions options) {
auto result = capi::ICU4XFixedDecimalFormatter_try_new(locale.AsFFI(),
provider.AsFFI(),
diff --git a/example/cpp2/include/ICU4XFixedDecimalFormatterOptions.d.h b/example/cpp2/include/ICU4XFixedDecimalFormatterOptions.d.h
deleted file mode 100644
index 8a6379933..000000000
--- a/example/cpp2/include/ICU4XFixedDecimalFormatterOptions.d.h
+++ /dev/null
@@ -1,24 +0,0 @@
-#ifndef ICU4XFixedDecimalFormatterOptions_D_H
-#define ICU4XFixedDecimalFormatterOptions_D_H
-
-#include
-#include
-#include
-#include
-#include "diplomat_runtime.h"
-
-#include "ICU4XFixedDecimalGroupingStrategy.d.h"
-
-namespace capi {
-
-
-typedef struct ICU4XFixedDecimalFormatterOptions {
- ICU4XFixedDecimalGroupingStrategy grouping_strategy;
- bool some_other_config;
-} ICU4XFixedDecimalFormatterOptions;
-
-
-
-} // namespace capi
-
-#endif // ICU4XFixedDecimalFormatterOptions_D_H
diff --git a/example/cpp2/include/ICU4XFixedDecimalFormatterOptions.d.hpp b/example/cpp2/include/ICU4XFixedDecimalFormatterOptions.d.hpp
index 6f29b1666..6a62baeab 100644
--- a/example/cpp2/include/ICU4XFixedDecimalFormatterOptions.d.hpp
+++ b/example/cpp2/include/ICU4XFixedDecimalFormatterOptions.d.hpp
@@ -8,12 +8,18 @@
#include
#include
#include "diplomat_runtime.hpp"
-#include "ICU4XFixedDecimalFormatterOptions.d.h"
#include "ICU4XFixedDecimalGroupingStrategy.d.hpp"
class ICU4XFixedDecimalGroupingStrategy;
+namespace capi {
+ typedef struct ICU4XFixedDecimalFormatterOptions {
+ ICU4XFixedDecimalGroupingStrategy grouping_strategy;
+ bool some_other_config;
+ } ICU4XFixedDecimalFormatterOptions;
+}
+
struct ICU4XFixedDecimalFormatterOptions {
ICU4XFixedDecimalGroupingStrategy grouping_strategy;
bool some_other_config;
diff --git a/example/cpp2/include/ICU4XFixedDecimalFormatterOptions.h b/example/cpp2/include/ICU4XFixedDecimalFormatterOptions.h
deleted file mode 100644
index 6893b8316..000000000
--- a/example/cpp2/include/ICU4XFixedDecimalFormatterOptions.h
+++ /dev/null
@@ -1,25 +0,0 @@
-#ifndef ICU4XFixedDecimalFormatterOptions_H
-#define ICU4XFixedDecimalFormatterOptions_H
-
-#include
-#include
-#include
-#include
-#include "diplomat_runtime.h"
-
-
-#include "ICU4XFixedDecimalFormatterOptions.d.h"
-
-namespace capi {
-
-
-extern "C" {
-
-ICU4XFixedDecimalFormatterOptions ICU4XFixedDecimalFormatterOptions_default();
-
-
-} // extern "C"
-
-} // namespace capi
-
-#endif // ICU4XFixedDecimalFormatterOptions_H
diff --git a/example/cpp2/include/ICU4XFixedDecimalFormatterOptions.hpp b/example/cpp2/include/ICU4XFixedDecimalFormatterOptions.hpp
index b287290bd..f343f07a4 100644
--- a/example/cpp2/include/ICU4XFixedDecimalFormatterOptions.hpp
+++ b/example/cpp2/include/ICU4XFixedDecimalFormatterOptions.hpp
@@ -10,10 +10,18 @@
#include
#include
#include "diplomat_runtime.hpp"
-#include "ICU4XFixedDecimalFormatterOptions.h"
#include "ICU4XFixedDecimalGroupingStrategy.hpp"
+namespace capi {
+ extern "C" {
+
+ ICU4XFixedDecimalFormatterOptions ICU4XFixedDecimalFormatterOptions_default();
+
+
+ } // extern "C"
+}
+
inline ICU4XFixedDecimalFormatterOptions ICU4XFixedDecimalFormatterOptions::default_() {
auto result = capi::ICU4XFixedDecimalFormatterOptions_default();
return ICU4XFixedDecimalFormatterOptions::FromFFI(result);
diff --git a/example/cpp2/include/ICU4XFixedDecimalGroupingStrategy.d.h b/example/cpp2/include/ICU4XFixedDecimalGroupingStrategy.d.h
deleted file mode 100644
index 8dede3bc8..000000000
--- a/example/cpp2/include/ICU4XFixedDecimalGroupingStrategy.d.h
+++ /dev/null
@@ -1,25 +0,0 @@
-#ifndef ICU4XFixedDecimalGroupingStrategy_D_H
-#define ICU4XFixedDecimalGroupingStrategy_D_H
-
-#include
-#include
-#include
-#include
-#include "diplomat_runtime.h"
-
-
-namespace capi {
-
-
-typedef enum ICU4XFixedDecimalGroupingStrategy {
- ICU4XFixedDecimalGroupingStrategy_Auto = 0,
- ICU4XFixedDecimalGroupingStrategy_Never = 1,
- ICU4XFixedDecimalGroupingStrategy_Always = 2,
- ICU4XFixedDecimalGroupingStrategy_Min2 = 3,
-} ICU4XFixedDecimalGroupingStrategy;
-
-
-
-} // namespace capi
-
-#endif // ICU4XFixedDecimalGroupingStrategy_D_H
diff --git a/example/cpp2/include/ICU4XFixedDecimalGroupingStrategy.d.hpp b/example/cpp2/include/ICU4XFixedDecimalGroupingStrategy.d.hpp
index cda9c1b20..559f88553 100644
--- a/example/cpp2/include/ICU4XFixedDecimalGroupingStrategy.d.hpp
+++ b/example/cpp2/include/ICU4XFixedDecimalGroupingStrategy.d.hpp
@@ -8,9 +8,17 @@
#include
#include
#include "diplomat_runtime.hpp"
-#include "ICU4XFixedDecimalGroupingStrategy.d.h"
+namespace capi {
+ typedef enum ICU4XFixedDecimalGroupingStrategy {
+ ICU4XFixedDecimalGroupingStrategy_Auto = 0,
+ ICU4XFixedDecimalGroupingStrategy_Never = 1,
+ ICU4XFixedDecimalGroupingStrategy_Always = 2,
+ ICU4XFixedDecimalGroupingStrategy_Min2 = 3,
+ } ICU4XFixedDecimalGroupingStrategy;
+}
+
class ICU4XFixedDecimalGroupingStrategy {
public:
enum Value {
diff --git a/example/cpp2/include/ICU4XFixedDecimalGroupingStrategy.h b/example/cpp2/include/ICU4XFixedDecimalGroupingStrategy.h
deleted file mode 100644
index d9603d573..000000000
--- a/example/cpp2/include/ICU4XFixedDecimalGroupingStrategy.h
+++ /dev/null
@@ -1,23 +0,0 @@
-#ifndef ICU4XFixedDecimalGroupingStrategy_H
-#define ICU4XFixedDecimalGroupingStrategy_H
-
-#include
-#include
-#include
-#include
-#include "diplomat_runtime.h"
-
-
-#include "ICU4XFixedDecimalGroupingStrategy.d.h"
-
-namespace capi {
-
-
-extern "C" {
-
-
-} // extern "C"
-
-} // namespace capi
-
-#endif // ICU4XFixedDecimalGroupingStrategy_H
diff --git a/example/cpp2/include/ICU4XFixedDecimalGroupingStrategy.hpp b/example/cpp2/include/ICU4XFixedDecimalGroupingStrategy.hpp
index 068adea39..1703f9886 100644
--- a/example/cpp2/include/ICU4XFixedDecimalGroupingStrategy.hpp
+++ b/example/cpp2/include/ICU4XFixedDecimalGroupingStrategy.hpp
@@ -10,7 +10,14 @@
#include
#include
#include "diplomat_runtime.hpp"
-#include "ICU4XFixedDecimalGroupingStrategy.h"
+
+
+namespace capi {
+ extern "C" {
+
+
+ } // extern "C"
+}
inline capi::ICU4XFixedDecimalGroupingStrategy ICU4XFixedDecimalGroupingStrategy::AsFFI() const {
diff --git a/example/cpp2/include/ICU4XLocale.d.h b/example/cpp2/include/ICU4XLocale.d.h
deleted file mode 100644
index 47841fa68..000000000
--- a/example/cpp2/include/ICU4XLocale.d.h
+++ /dev/null
@@ -1,20 +0,0 @@
-#ifndef ICU4XLocale_D_H
-#define ICU4XLocale_D_H
-
-#include
-#include
-#include
-#include
-#include "diplomat_runtime.h"
-
-
-namespace capi {
-
-
-typedef struct ICU4XLocale ICU4XLocale;
-
-
-
-} // namespace capi
-
-#endif // ICU4XLocale_D_H
diff --git a/example/cpp2/include/ICU4XLocale.d.hpp b/example/cpp2/include/ICU4XLocale.d.hpp
index d18ba44be..402a82408 100644
--- a/example/cpp2/include/ICU4XLocale.d.hpp
+++ b/example/cpp2/include/ICU4XLocale.d.hpp
@@ -8,9 +8,12 @@
#include
#include
#include "diplomat_runtime.hpp"
-#include "ICU4XLocale.d.h"
+namespace capi {
+ typedef struct ICU4XLocale ICU4XLocale;
+}
+
class ICU4XLocale {
public:
diff --git a/example/cpp2/include/ICU4XLocale.h b/example/cpp2/include/ICU4XLocale.h
deleted file mode 100644
index 8f9340ef5..000000000
--- a/example/cpp2/include/ICU4XLocale.h
+++ /dev/null
@@ -1,27 +0,0 @@
-#ifndef ICU4XLocale_H
-#define ICU4XLocale_H
-
-#include
-#include
-#include
-#include
-#include "diplomat_runtime.h"
-
-
-#include "ICU4XLocale.d.h"
-
-namespace capi {
-
-
-extern "C" {
-
-ICU4XLocale* ICU4XLocale_new(const char* name_data, size_t name_len);
-
-
-void ICU4XLocale_destroy(ICU4XLocale* self);
-
-} // extern "C"
-
-} // namespace capi
-
-#endif // ICU4XLocale_H
diff --git a/example/cpp2/include/ICU4XLocale.hpp b/example/cpp2/include/ICU4XLocale.hpp
index eab8f3bce..e99aebba4 100644
--- a/example/cpp2/include/ICU4XLocale.hpp
+++ b/example/cpp2/include/ICU4XLocale.hpp
@@ -10,9 +10,19 @@
#include
#include
#include "diplomat_runtime.hpp"
-#include "ICU4XLocale.h"
+namespace capi {
+ extern "C" {
+
+ ICU4XLocale* ICU4XLocale_new(const char* name_data, size_t name_len);
+
+
+ void ICU4XLocale_destroy(ICU4XLocale* self);
+
+ } // extern "C"
+}
+
inline std::unique_ptr ICU4XLocale::new_(std::string_view name) {
auto result = capi::ICU4XLocale_new(name.data(),
name.size());
diff --git a/feature_tests/cpp2/include/AttrEnum.d.h b/feature_tests/cpp2/include/AttrEnum.d.h
deleted file mode 100644
index 15f6c0763..000000000
--- a/feature_tests/cpp2/include/AttrEnum.d.h
+++ /dev/null
@@ -1,24 +0,0 @@
-#ifndef AttrEnum_D_H
-#define AttrEnum_D_H
-
-#include
-#include
-#include
-#include
-#include "diplomat_runtime.h"
-
-
-namespace capi {
-
-
-typedef enum AttrEnum {
- AttrEnum_A = 0,
- AttrEnum_B = 1,
- AttrEnum_C = 2,
-} AttrEnum;
-
-
-
-} // namespace capi
-
-#endif // AttrEnum_D_H
diff --git a/feature_tests/cpp2/include/AttrEnum.h b/feature_tests/cpp2/include/AttrEnum.h
deleted file mode 100644
index 1dd13cf4c..000000000
--- a/feature_tests/cpp2/include/AttrEnum.h
+++ /dev/null
@@ -1,23 +0,0 @@
-#ifndef AttrEnum_H
-#define AttrEnum_H
-
-#include
-#include
-#include
-#include
-#include "diplomat_runtime.h"
-
-
-#include "AttrEnum.d.h"
-
-namespace capi {
-
-
-extern "C" {
-
-
-} // extern "C"
-
-} // namespace capi
-
-#endif // AttrEnum_H
diff --git a/feature_tests/cpp2/include/AttrOpaque1.d.h b/feature_tests/cpp2/include/AttrOpaque1.d.h
deleted file mode 100644
index 478bf76fb..000000000
--- a/feature_tests/cpp2/include/AttrOpaque1.d.h
+++ /dev/null
@@ -1,20 +0,0 @@
-#ifndef AttrOpaque1_D_H
-#define AttrOpaque1_D_H
-
-#include
-#include
-#include
-#include
-#include "diplomat_runtime.h"
-
-
-namespace capi {
-
-
-typedef struct AttrOpaque1 AttrOpaque1;
-
-
-
-} // namespace capi
-
-#endif // AttrOpaque1_D_H
diff --git a/feature_tests/cpp2/include/AttrOpaque1.h b/feature_tests/cpp2/include/AttrOpaque1.h
deleted file mode 100644
index 87d1bebef..000000000
--- a/feature_tests/cpp2/include/AttrOpaque1.h
+++ /dev/null
@@ -1,37 +0,0 @@
-#ifndef AttrOpaque1_H
-#define AttrOpaque1_H
-
-#include
-#include
-#include
-#include
-#include "diplomat_runtime.h"
-
-#include "AttrEnum.d.h"
-#include "Unnamespaced.d.h"
-
-#include "AttrOpaque1.d.h"
-
-namespace capi {
-
-
-extern "C" {
-
-AttrOpaque1* namespace_AttrOpaque1_new();
-
-uint8_t namespace_AttrOpaque1_method(const AttrOpaque1* self);
-
-uint8_t renamed_on_abi_only(const AttrOpaque1* self);
-
-void namespace_AttrOpaque1_use_unnamespaced(const AttrOpaque1* self, const Unnamespaced* _un);
-
-void namespace_AttrOpaque1_use_namespaced(const AttrOpaque1* self, AttrEnum _n);
-
-
-void namespace_AttrOpaque1_destroy(AttrOpaque1* self);
-
-} // extern "C"
-
-} // namespace capi
-
-#endif // AttrOpaque1_H
diff --git a/feature_tests/cpp2/include/AttrOpaque1Renamed.d.hpp b/feature_tests/cpp2/include/AttrOpaque1Renamed.d.hpp
index 7268655f1..25dfa8201 100644
--- a/feature_tests/cpp2/include/AttrOpaque1Renamed.d.hpp
+++ b/feature_tests/cpp2/include/AttrOpaque1Renamed.d.hpp
@@ -8,7 +8,6 @@
#include
#include
#include "diplomat_runtime.hpp"
-#include "AttrOpaque1.d.h"
#include "CPPRenamedAttrEnum.d.hpp"
class Unnamespaced;
@@ -18,6 +17,10 @@ class CPPRenamedAttrEnum;
}
+namespace capi {
+ typedef struct AttrOpaque1 AttrOpaque1;
+}
+
namespace ns {
class AttrOpaque1Renamed {
public:
diff --git a/feature_tests/cpp2/include/AttrOpaque1Renamed.hpp b/feature_tests/cpp2/include/AttrOpaque1Renamed.hpp
index 21b85bef9..05007a2de 100644
--- a/feature_tests/cpp2/include/AttrOpaque1Renamed.hpp
+++ b/feature_tests/cpp2/include/AttrOpaque1Renamed.hpp
@@ -10,11 +10,29 @@
#include
#include
#include "diplomat_runtime.hpp"
-#include "AttrOpaque1.h"
#include "CPPRenamedAttrEnum.hpp"
#include "Unnamespaced.hpp"
+namespace capi {
+ extern "C" {
+
+ AttrOpaque1* namespace_AttrOpaque1_new();
+
+ uint8_t namespace_AttrOpaque1_method(const AttrOpaque1* self);
+
+ uint8_t renamed_on_abi_only(const AttrOpaque1* self);
+
+ void namespace_AttrOpaque1_use_unnamespaced(const AttrOpaque1* self, const Unnamespaced* _un);
+
+ void namespace_AttrOpaque1_use_namespaced(const AttrOpaque1* self, AttrEnum _n);
+
+
+ void namespace_AttrOpaque1_destroy(AttrOpaque1* self);
+
+ } // extern "C"
+}
+
inline std::unique_ptr ns::AttrOpaque1Renamed::totally_not_new() {
auto result = capi::namespace_AttrOpaque1_new();
return std::unique_ptr(ns::AttrOpaque1Renamed::FromFFI(result));
diff --git a/feature_tests/cpp2/include/AttrOpaque2.d.h b/feature_tests/cpp2/include/AttrOpaque2.d.h
deleted file mode 100644
index 199832f92..000000000
--- a/feature_tests/cpp2/include/AttrOpaque2.d.h
+++ /dev/null
@@ -1,20 +0,0 @@
-#ifndef AttrOpaque2_D_H
-#define AttrOpaque2_D_H
-
-#include
-#include
-#include
-#include
-#include "diplomat_runtime.h"
-
-
-namespace capi {
-
-
-typedef struct AttrOpaque2 AttrOpaque2;
-
-
-
-} // namespace capi
-
-#endif // AttrOpaque2_D_H
diff --git a/feature_tests/cpp2/include/AttrOpaque2.h b/feature_tests/cpp2/include/AttrOpaque2.h
deleted file mode 100644
index f7dbbcaca..000000000
--- a/feature_tests/cpp2/include/AttrOpaque2.h
+++ /dev/null
@@ -1,25 +0,0 @@
-#ifndef AttrOpaque2_H
-#define AttrOpaque2_H
-
-#include
-#include
-#include
-#include
-#include "diplomat_runtime.h"
-
-
-#include "AttrOpaque2.d.h"
-
-namespace capi {
-
-
-extern "C" {
-
-
-void namespace_AttrOpaque2_destroy(AttrOpaque2* self);
-
-} // extern "C"
-
-} // namespace capi
-
-#endif // AttrOpaque2_H
diff --git a/feature_tests/cpp2/include/Bar.d.h b/feature_tests/cpp2/include/Bar.d.h
deleted file mode 100644
index 35b5aec25..000000000
--- a/feature_tests/cpp2/include/Bar.d.h
+++ /dev/null
@@ -1,20 +0,0 @@
-#ifndef Bar_D_H
-#define Bar_D_H
-
-#include
-#include
-#include
-#include
-#include "diplomat_runtime.h"
-
-
-namespace capi {
-
-
-typedef struct Bar Bar;
-
-
-
-} // namespace capi
-
-#endif // Bar_D_H
diff --git a/feature_tests/cpp2/include/Bar.d.hpp b/feature_tests/cpp2/include/Bar.d.hpp
index 91e24a10d..7af995cf9 100644
--- a/feature_tests/cpp2/include/Bar.d.hpp
+++ b/feature_tests/cpp2/include/Bar.d.hpp
@@ -8,11 +8,14 @@
#include
#include
#include "diplomat_runtime.hpp"
-#include "Bar.d.h"
class Foo;
+namespace capi {
+ typedef struct Bar Bar;
+}
+
class Bar {
public:
diff --git a/feature_tests/cpp2/include/Bar.h b/feature_tests/cpp2/include/Bar.h
deleted file mode 100644
index 89e74d2c3..000000000
--- a/feature_tests/cpp2/include/Bar.h
+++ /dev/null
@@ -1,28 +0,0 @@
-#ifndef Bar_H
-#define Bar_H
-
-#include
-#include
-#include
-#include
-#include "diplomat_runtime.h"
-
-#include "Foo.d.h"
-
-#include "Bar.d.h"
-
-namespace capi {
-
-
-extern "C" {
-
-const Foo* Bar_foo(const Bar* self);
-
-
-void Bar_destroy(Bar* self);
-
-} // extern "C"
-
-} // namespace capi
-
-#endif // Bar_H
diff --git a/feature_tests/cpp2/include/Bar.hpp b/feature_tests/cpp2/include/Bar.hpp
index caf1fd600..29942602f 100644
--- a/feature_tests/cpp2/include/Bar.hpp
+++ b/feature_tests/cpp2/include/Bar.hpp
@@ -10,10 +10,20 @@
#include
#include
#include "diplomat_runtime.hpp"
-#include "Bar.h"
#include "Foo.hpp"
+namespace capi {
+ extern "C" {
+
+ const Foo* Bar_foo(const Bar* self);
+
+
+ void Bar_destroy(Bar* self);
+
+ } // extern "C"
+}
+
inline const Foo& Bar::foo() const {
auto result = capi::Bar_foo(this->AsFFI());
return *Foo::FromFFI(result);
diff --git a/feature_tests/cpp2/include/BorrowedFields.d.h b/feature_tests/cpp2/include/BorrowedFields.d.h
deleted file mode 100644
index 284b6c738..000000000
--- a/feature_tests/cpp2/include/BorrowedFields.d.h
+++ /dev/null
@@ -1,24 +0,0 @@
-#ifndef BorrowedFields_D_H
-#define BorrowedFields_D_H
-
-#include
-#include
-#include
-#include
-#include "diplomat_runtime.h"
-
-
-namespace capi {
-
-
-typedef struct BorrowedFields {
- DiplomatString16View a;
- DiplomatStringView b;
- DiplomatStringView c;
-} BorrowedFields;
-
-
-
-} // namespace capi
-
-#endif // BorrowedFields_D_H
diff --git a/feature_tests/cpp2/include/BorrowedFields.d.hpp b/feature_tests/cpp2/include/BorrowedFields.d.hpp
index a651544e7..c9964e203 100644
--- a/feature_tests/cpp2/include/BorrowedFields.d.hpp
+++ b/feature_tests/cpp2/include/BorrowedFields.d.hpp
@@ -8,11 +8,18 @@
#include
#include
#include "diplomat_runtime.hpp"
-#include "BorrowedFields.d.h"
class Bar;
+namespace capi {
+ typedef struct BorrowedFields {
+ DiplomatString16View a;
+ DiplomatStringView b;
+ DiplomatStringView c;
+ } BorrowedFields;
+}
+
struct BorrowedFields {
std::u16string_view a;
std::string_view b;
diff --git a/feature_tests/cpp2/include/BorrowedFields.h b/feature_tests/cpp2/include/BorrowedFields.h
deleted file mode 100644
index d9aaaa7b8..000000000
--- a/feature_tests/cpp2/include/BorrowedFields.h
+++ /dev/null
@@ -1,26 +0,0 @@
-#ifndef BorrowedFields_H
-#define BorrowedFields_H
-
-#include
-#include
-#include
-#include
-#include "diplomat_runtime.h"
-
-#include "Bar.d.h"
-
-#include "BorrowedFields.d.h"
-
-namespace capi {
-
-
-extern "C" {
-
-BorrowedFields BorrowedFields_from_bar_and_strings(const Bar* bar, const char16_t* dstr16_data, size_t dstr16_len, const char* utf8_str_data, size_t utf8_str_len);
-
-
-} // extern "C"
-
-} // namespace capi
-
-#endif // BorrowedFields_H
diff --git a/feature_tests/cpp2/include/BorrowedFields.hpp b/feature_tests/cpp2/include/BorrowedFields.hpp
index 14d004404..da62bcabe 100644
--- a/feature_tests/cpp2/include/BorrowedFields.hpp
+++ b/feature_tests/cpp2/include/BorrowedFields.hpp
@@ -11,9 +11,17 @@
#include
#include "diplomat_runtime.hpp"
#include "Bar.hpp"
-#include "BorrowedFields.h"
+namespace capi {
+ extern "C" {
+
+ BorrowedFields BorrowedFields_from_bar_and_strings(const Bar* bar, const char16_t* dstr16_data, size_t dstr16_len, const char* utf8_str_data, size_t utf8_str_len);
+
+
+ } // extern "C"
+}
+
inline diplomat::result BorrowedFields::from_bar_and_strings(const Bar& bar, std::u16string_view dstr16, std::string_view utf8_str) {
if (!capi::diplomat_is_str(utf8_str.data(), utf8_str.size())) {
return diplomat::Err(diplomat::Utf8Error());
diff --git a/feature_tests/cpp2/include/BorrowedFieldsReturning.d.h b/feature_tests/cpp2/include/BorrowedFieldsReturning.d.h
deleted file mode 100644
index 6845d297b..000000000
--- a/feature_tests/cpp2/include/BorrowedFieldsReturning.d.h
+++ /dev/null
@@ -1,22 +0,0 @@
-#ifndef BorrowedFieldsReturning_D_H
-#define BorrowedFieldsReturning_D_H
-
-#include
-#include
-#include
-#include
-#include "diplomat_runtime.h"
-
-
-namespace capi {
-
-
-typedef struct BorrowedFieldsReturning {
- DiplomatStringView bytes;
-} BorrowedFieldsReturning;
-
-
-
-} // namespace capi
-
-#endif // BorrowedFieldsReturning_D_H
diff --git a/feature_tests/cpp2/include/BorrowedFieldsReturning.d.hpp b/feature_tests/cpp2/include/BorrowedFieldsReturning.d.hpp
index 0c5fe993b..86b01d0e5 100644
--- a/feature_tests/cpp2/include/BorrowedFieldsReturning.d.hpp
+++ b/feature_tests/cpp2/include/BorrowedFieldsReturning.d.hpp
@@ -8,9 +8,14 @@
#include
#include
#include "diplomat_runtime.hpp"
-#include "BorrowedFieldsReturning.d.h"
+namespace capi {
+ typedef struct BorrowedFieldsReturning {
+ DiplomatStringView bytes;
+ } BorrowedFieldsReturning;
+}
+
struct BorrowedFieldsReturning {
std::string_view bytes;
diff --git a/feature_tests/cpp2/include/BorrowedFieldsReturning.h b/feature_tests/cpp2/include/BorrowedFieldsReturning.h
deleted file mode 100644
index 72588db6d..000000000
--- a/feature_tests/cpp2/include/BorrowedFieldsReturning.h
+++ /dev/null
@@ -1,23 +0,0 @@
-#ifndef BorrowedFieldsReturning_H
-#define BorrowedFieldsReturning_H
-
-#include
-#include
-#include
-#include
-#include "diplomat_runtime.h"
-
-
-#include "BorrowedFieldsReturning.d.h"
-
-namespace capi {
-
-
-extern "C" {
-
-
-} // extern "C"
-
-} // namespace capi
-
-#endif // BorrowedFieldsReturning_H
diff --git a/feature_tests/cpp2/include/BorrowedFieldsReturning.hpp b/feature_tests/cpp2/include/BorrowedFieldsReturning.hpp
index c4722e3bb..f7d76f523 100644
--- a/feature_tests/cpp2/include/BorrowedFieldsReturning.hpp
+++ b/feature_tests/cpp2/include/BorrowedFieldsReturning.hpp
@@ -10,9 +10,15 @@
#include
#include
#include "diplomat_runtime.hpp"
-#include "BorrowedFieldsReturning.h"
+namespace capi {
+ extern "C" {
+
+
+ } // extern "C"
+}
+
inline capi::BorrowedFieldsReturning BorrowedFieldsReturning::AsFFI() const {
return capi::BorrowedFieldsReturning {
diff --git a/feature_tests/cpp2/include/BorrowedFieldsWithBounds.d.h b/feature_tests/cpp2/include/BorrowedFieldsWithBounds.d.h
deleted file mode 100644
index 3c342a20d..000000000
--- a/feature_tests/cpp2/include/BorrowedFieldsWithBounds.d.h
+++ /dev/null
@@ -1,24 +0,0 @@
-#ifndef BorrowedFieldsWithBounds_D_H
-#define BorrowedFieldsWithBounds_D_H
-
-#include
-#include
-#include
-#include
-#include "diplomat_runtime.h"
-
-
-namespace capi {
-
-
-typedef struct BorrowedFieldsWithBounds {
- DiplomatString16View field_a;
- DiplomatStringView field_b;
- DiplomatStringView field_c;
-} BorrowedFieldsWithBounds;
-
-
-
-} // namespace capi
-
-#endif // BorrowedFieldsWithBounds_D_H
diff --git a/feature_tests/cpp2/include/BorrowedFieldsWithBounds.d.hpp b/feature_tests/cpp2/include/BorrowedFieldsWithBounds.d.hpp
index eedfb6d5d..6256c8a8b 100644
--- a/feature_tests/cpp2/include/BorrowedFieldsWithBounds.d.hpp
+++ b/feature_tests/cpp2/include/BorrowedFieldsWithBounds.d.hpp
@@ -8,11 +8,18 @@
#include
#include
#include "diplomat_runtime.hpp"
-#include "BorrowedFieldsWithBounds.d.h"
class Foo;
+namespace capi {
+ typedef struct BorrowedFieldsWithBounds {
+ DiplomatString16View field_a;
+ DiplomatStringView field_b;
+ DiplomatStringView field_c;
+ } BorrowedFieldsWithBounds;
+}
+
struct BorrowedFieldsWithBounds {
std::u16string_view field_a;
std::string_view field_b;
diff --git a/feature_tests/cpp2/include/BorrowedFieldsWithBounds.h b/feature_tests/cpp2/include/BorrowedFieldsWithBounds.h
deleted file mode 100644
index 335a32968..000000000
--- a/feature_tests/cpp2/include/BorrowedFieldsWithBounds.h
+++ /dev/null
@@ -1,26 +0,0 @@
-#ifndef BorrowedFieldsWithBounds_H
-#define BorrowedFieldsWithBounds_H
-
-#include
-#include
-#include
-#include
-#include "diplomat_runtime.h"
-
-#include "Foo.d.h"
-
-#include "BorrowedFieldsWithBounds.d.h"
-
-namespace capi {
-
-
-extern "C" {
-
-BorrowedFieldsWithBounds BorrowedFieldsWithBounds_from_foo_and_strings(const Foo* foo, const char16_t* dstr16_x_data, size_t dstr16_x_len, const char* utf8_str_z_data, size_t utf8_str_z_len);
-
-
-} // extern "C"
-
-} // namespace capi
-
-#endif // BorrowedFieldsWithBounds_H
diff --git a/feature_tests/cpp2/include/BorrowedFieldsWithBounds.hpp b/feature_tests/cpp2/include/BorrowedFieldsWithBounds.hpp
index a4ade36c3..aab7b48f7 100644
--- a/feature_tests/cpp2/include/BorrowedFieldsWithBounds.hpp
+++ b/feature_tests/cpp2/include/BorrowedFieldsWithBounds.hpp
@@ -10,10 +10,18 @@
#include
#include
#include "diplomat_runtime.hpp"
-#include "BorrowedFieldsWithBounds.h"
#include "Foo.hpp"
+namespace capi {
+ extern "C" {
+
+ BorrowedFieldsWithBounds BorrowedFieldsWithBounds_from_foo_and_strings(const Foo* foo, const char16_t* dstr16_x_data, size_t dstr16_x_len, const char* utf8_str_z_data, size_t utf8_str_z_len);
+
+
+ } // extern "C"
+}
+
inline diplomat::result BorrowedFieldsWithBounds::from_foo_and_strings(const Foo& foo, std::u16string_view dstr16_x, std::string_view utf8_str_z) {
if (!capi::diplomat_is_str(utf8_str_z.data(), utf8_str_z.size())) {
return diplomat::Err(diplomat::Utf8Error());
diff --git a/feature_tests/cpp2/include/CPPRenamedAttrEnum.d.hpp b/feature_tests/cpp2/include/CPPRenamedAttrEnum.d.hpp
index 7c953a7a7..95cef376c 100644
--- a/feature_tests/cpp2/include/CPPRenamedAttrEnum.d.hpp
+++ b/feature_tests/cpp2/include/CPPRenamedAttrEnum.d.hpp
@@ -8,9 +8,16 @@
#include
#include
#include "diplomat_runtime.hpp"
-#include "AttrEnum.d.h"
+namespace capi {
+ typedef enum AttrEnum {
+ AttrEnum_A = 0,
+ AttrEnum_B = 1,
+ AttrEnum_C = 2,
+ } AttrEnum;
+}
+
namespace ns {
class CPPRenamedAttrEnum {
public:
diff --git a/feature_tests/cpp2/include/CPPRenamedAttrEnum.hpp b/feature_tests/cpp2/include/CPPRenamedAttrEnum.hpp
index 73b181465..f7c639963 100644
--- a/feature_tests/cpp2/include/CPPRenamedAttrEnum.hpp
+++ b/feature_tests/cpp2/include/CPPRenamedAttrEnum.hpp
@@ -10,7 +10,14 @@
#include
#include
#include "diplomat_runtime.hpp"
-#include "AttrEnum.h"
+
+
+namespace capi {
+ extern "C" {
+
+
+ } // extern "C"
+}
inline capi::AttrEnum ns::CPPRenamedAttrEnum::AsFFI() const {
diff --git a/feature_tests/cpp2/include/CPPRenamedAttrOpaque2.d.hpp b/feature_tests/cpp2/include/CPPRenamedAttrOpaque2.d.hpp
index 0db5dabd8..df8dca681 100644
--- a/feature_tests/cpp2/include/CPPRenamedAttrOpaque2.d.hpp
+++ b/feature_tests/cpp2/include/CPPRenamedAttrOpaque2.d.hpp
@@ -8,9 +8,12 @@
#include
#include
#include "diplomat_runtime.hpp"
-#include "AttrOpaque2.d.h"
+namespace capi {
+ typedef struct AttrOpaque2 AttrOpaque2;
+}
+
namespace ns {
class CPPRenamedAttrOpaque2 {
public:
diff --git a/feature_tests/cpp2/include/CPPRenamedAttrOpaque2.hpp b/feature_tests/cpp2/include/CPPRenamedAttrOpaque2.hpp
index 2ca7711dc..f3792ff3e 100644
--- a/feature_tests/cpp2/include/CPPRenamedAttrOpaque2.hpp
+++ b/feature_tests/cpp2/include/CPPRenamedAttrOpaque2.hpp
@@ -10,9 +10,17 @@
#include
#include
#include "diplomat_runtime.hpp"
-#include "AttrOpaque2.h"
+namespace capi {
+ extern "C" {
+
+
+ void namespace_AttrOpaque2_destroy(AttrOpaque2* self);
+
+ } // extern "C"
+}
+
inline const capi::AttrOpaque2* ns::CPPRenamedAttrOpaque2::AsFFI() const {
return reinterpret_cast(this);
}
diff --git a/feature_tests/cpp2/include/ContiguousEnum.d.h b/feature_tests/cpp2/include/ContiguousEnum.d.h
deleted file mode 100644
index 6873e7b74..000000000
--- a/feature_tests/cpp2/include/ContiguousEnum.d.h
+++ /dev/null
@@ -1,25 +0,0 @@
-#ifndef ContiguousEnum_D_H
-#define ContiguousEnum_D_H
-
-#include
-#include
-#include
-#include
-#include "diplomat_runtime.h"
-
-
-namespace capi {
-
-
-typedef enum ContiguousEnum {
- ContiguousEnum_C = 0,
- ContiguousEnum_D = 1,
- ContiguousEnum_E = 2,
- ContiguousEnum_F = 3,
-} ContiguousEnum;
-
-
-
-} // namespace capi
-
-#endif // ContiguousEnum_D_H
diff --git a/feature_tests/cpp2/include/ContiguousEnum.d.hpp b/feature_tests/cpp2/include/ContiguousEnum.d.hpp
index 8b10990e0..de16c94d6 100644
--- a/feature_tests/cpp2/include/ContiguousEnum.d.hpp
+++ b/feature_tests/cpp2/include/ContiguousEnum.d.hpp
@@ -8,9 +8,17 @@
#include
#include
#include "diplomat_runtime.hpp"
-#include "ContiguousEnum.d.h"
+namespace capi {
+ typedef enum ContiguousEnum {
+ ContiguousEnum_C = 0,
+ ContiguousEnum_D = 1,
+ ContiguousEnum_E = 2,
+ ContiguousEnum_F = 3,
+ } ContiguousEnum;
+}
+
class ContiguousEnum {
public:
enum Value {
diff --git a/feature_tests/cpp2/include/ContiguousEnum.h b/feature_tests/cpp2/include/ContiguousEnum.h
deleted file mode 100644
index 49eee3982..000000000
--- a/feature_tests/cpp2/include/ContiguousEnum.h
+++ /dev/null
@@ -1,23 +0,0 @@
-#ifndef ContiguousEnum_H
-#define ContiguousEnum_H
-
-#include
-#include
-#include
-#include
-#include "diplomat_runtime.h"
-
-
-#include "ContiguousEnum.d.h"
-
-namespace capi {
-
-
-extern "C" {
-
-
-} // extern "C"
-
-} // namespace capi
-
-#endif // ContiguousEnum_H
diff --git a/feature_tests/cpp2/include/ContiguousEnum.hpp b/feature_tests/cpp2/include/ContiguousEnum.hpp
index cebe3b167..a8d3e4722 100644
--- a/feature_tests/cpp2/include/ContiguousEnum.hpp
+++ b/feature_tests/cpp2/include/ContiguousEnum.hpp
@@ -10,7 +10,14 @@
#include
#include
#include "diplomat_runtime.hpp"
-#include "ContiguousEnum.h"
+
+
+namespace capi {
+ extern "C" {
+
+
+ } // extern "C"
+}
inline capi::ContiguousEnum ContiguousEnum::AsFFI() const {
diff --git a/feature_tests/cpp2/include/ErrorEnum.d.h b/feature_tests/cpp2/include/ErrorEnum.d.h
deleted file mode 100644
index 71215c371..000000000
--- a/feature_tests/cpp2/include/ErrorEnum.d.h
+++ /dev/null
@@ -1,23 +0,0 @@
-#ifndef ErrorEnum_D_H
-#define ErrorEnum_D_H
-
-#include
-#include
-#include
-#include
-#include "diplomat_runtime.h"
-
-
-namespace capi {
-
-
-typedef enum ErrorEnum {
- ErrorEnum_Foo = 0,
- ErrorEnum_Bar = 1,
-} ErrorEnum;
-
-
-
-} // namespace capi
-
-#endif // ErrorEnum_D_H
diff --git a/feature_tests/cpp2/include/ErrorEnum.d.hpp b/feature_tests/cpp2/include/ErrorEnum.d.hpp
index 0e75aaf40..99bf99d26 100644
--- a/feature_tests/cpp2/include/ErrorEnum.d.hpp
+++ b/feature_tests/cpp2/include/ErrorEnum.d.hpp
@@ -8,9 +8,15 @@
#include
#include
#include "diplomat_runtime.hpp"
-#include "ErrorEnum.d.h"
+namespace capi {
+ typedef enum ErrorEnum {
+ ErrorEnum_Foo = 0,
+ ErrorEnum_Bar = 1,
+ } ErrorEnum;
+}
+
class ErrorEnum {
public:
enum Value {
diff --git a/feature_tests/cpp2/include/ErrorEnum.h b/feature_tests/cpp2/include/ErrorEnum.h
deleted file mode 100644
index 5788d9b92..000000000
--- a/feature_tests/cpp2/include/ErrorEnum.h
+++ /dev/null
@@ -1,23 +0,0 @@
-#ifndef ErrorEnum_H
-#define ErrorEnum_H
-
-#include
-#include
-#include
-#include
-#include "diplomat_runtime.h"
-
-
-#include "ErrorEnum.d.h"
-
-namespace capi {
-
-
-extern "C" {
-
-
-} // extern "C"
-
-} // namespace capi
-
-#endif // ErrorEnum_H
diff --git a/feature_tests/cpp2/include/ErrorEnum.hpp b/feature_tests/cpp2/include/ErrorEnum.hpp
index 8e7b14947..33a97bef4 100644
--- a/feature_tests/cpp2/include/ErrorEnum.hpp
+++ b/feature_tests/cpp2/include/ErrorEnum.hpp
@@ -10,7 +10,14 @@
#include
#include
#include "diplomat_runtime.hpp"
-#include "ErrorEnum.h"
+
+
+namespace capi {
+ extern "C" {
+
+
+ } // extern "C"
+}
inline capi::ErrorEnum ErrorEnum::AsFFI() const {
diff --git a/feature_tests/cpp2/include/ErrorStruct.d.h b/feature_tests/cpp2/include/ErrorStruct.d.h
deleted file mode 100644
index cd568e894..000000000
--- a/feature_tests/cpp2/include/ErrorStruct.d.h
+++ /dev/null
@@ -1,23 +0,0 @@
-#ifndef ErrorStruct_D_H
-#define ErrorStruct_D_H
-
-#include
-#include
-#include
-#include
-#include "diplomat_runtime.h"
-
-
-namespace capi {
-
-
-typedef struct ErrorStruct {
- int32_t i;
- int32_t j;
-} ErrorStruct;
-
-
-
-} // namespace capi
-
-#endif // ErrorStruct_D_H
diff --git a/feature_tests/cpp2/include/ErrorStruct.d.hpp b/feature_tests/cpp2/include/ErrorStruct.d.hpp
index 25e1079c7..df399bb16 100644
--- a/feature_tests/cpp2/include/ErrorStruct.d.hpp
+++ b/feature_tests/cpp2/include/ErrorStruct.d.hpp
@@ -8,9 +8,15 @@
#include
#include
#include "diplomat_runtime.hpp"
-#include "ErrorStruct.d.h"
+namespace capi {
+ typedef struct ErrorStruct {
+ int32_t i;
+ int32_t j;
+ } ErrorStruct;
+}
+
struct ErrorStruct {
int32_t i;
int32_t j;
diff --git a/feature_tests/cpp2/include/ErrorStruct.h b/feature_tests/cpp2/include/ErrorStruct.h
deleted file mode 100644
index b042d4f50..000000000
--- a/feature_tests/cpp2/include/ErrorStruct.h
+++ /dev/null
@@ -1,23 +0,0 @@
-#ifndef ErrorStruct_H
-#define ErrorStruct_H
-
-#include
-#include
-#include
-#include
-#include "diplomat_runtime.h"
-
-
-#include "ErrorStruct.d.h"
-
-namespace capi {
-
-
-extern "C" {
-
-
-} // extern "C"
-
-} // namespace capi
-
-#endif // ErrorStruct_H
diff --git a/feature_tests/cpp2/include/ErrorStruct.hpp b/feature_tests/cpp2/include/ErrorStruct.hpp
index 009597293..87afb7132 100644
--- a/feature_tests/cpp2/include/ErrorStruct.hpp
+++ b/feature_tests/cpp2/include/ErrorStruct.hpp
@@ -10,9 +10,15 @@
#include
#include
#include "diplomat_runtime.hpp"
-#include "ErrorStruct.h"
+namespace capi {
+ extern "C" {
+
+
+ } // extern "C"
+}
+
inline capi::ErrorStruct ErrorStruct::AsFFI() const {
return capi::ErrorStruct {
diff --git a/feature_tests/cpp2/include/Float64Vec.d.h b/feature_tests/cpp2/include/Float64Vec.d.h
deleted file mode 100644
index 74ab64931..000000000
--- a/feature_tests/cpp2/include/Float64Vec.d.h
+++ /dev/null
@@ -1,20 +0,0 @@
-#ifndef Float64Vec_D_H
-#define Float64Vec_D_H
-
-#include
-#include
-#include
-#include
-#include "diplomat_runtime.h"
-
-
-namespace capi {
-
-
-typedef struct Float64Vec Float64Vec;
-
-
-
-} // namespace capi
-
-#endif // Float64Vec_D_H
diff --git a/feature_tests/cpp2/include/Float64Vec.d.hpp b/feature_tests/cpp2/include/Float64Vec.d.hpp
index 7599382ca..d9a422de0 100644
--- a/feature_tests/cpp2/include/Float64Vec.d.hpp
+++ b/feature_tests/cpp2/include/Float64Vec.d.hpp
@@ -8,9 +8,12 @@
#include
#include
#include "diplomat_runtime.hpp"
-#include "Float64Vec.d.h"
+namespace capi {
+ typedef struct Float64Vec Float64Vec;
+}
+
class Float64Vec {
public:
diff --git a/feature_tests/cpp2/include/Float64Vec.h b/feature_tests/cpp2/include/Float64Vec.h
deleted file mode 100644
index 8e2d14c86..000000000
--- a/feature_tests/cpp2/include/Float64Vec.h
+++ /dev/null
@@ -1,54 +0,0 @@
-#ifndef Float64Vec_H
-#define Float64Vec_H
-
-#include
-#include
-#include
-#include
-#include "diplomat_runtime.h"
-
-
-#include "Float64Vec.d.h"
-
-namespace capi {
-
-
-extern "C" {
-
-Float64Vec* Float64Vec_new(const double* v_data, size_t v_len);
-
-Float64Vec* Float64Vec_new_bool(const bool* v_data, size_t v_len);
-
-Float64Vec* Float64Vec_new_i16(const int16_t* v_data, size_t v_len);
-
-Float64Vec* Float64Vec_new_u16(const uint16_t* v_data, size_t v_len);
-
-Float64Vec* Float64Vec_new_isize(const intptr_t* v_data, size_t v_len);
-
-Float64Vec* Float64Vec_new_usize(const size_t* v_data, size_t v_len);
-
-Float64Vec* Float64Vec_new_f64_be_bytes(const uint8_t* v_data, size_t v_len);
-
-DiplomatF64View Float64Vec_as_boxed_slice(const Float64Vec* self);
-
-DiplomatF64View Float64Vec_as_slice(const Float64Vec* self);
-
-void Float64Vec_fill_slice(const Float64Vec* self, double* v_data, size_t v_len);
-
-void Float64Vec_set_value(Float64Vec* self, const double* new_slice_data, size_t new_slice_len);
-
-void Float64Vec_to_string(const Float64Vec* self, DiplomatWrite* write);
-
-DiplomatF64View Float64Vec_borrow(const Float64Vec* self);
-
-struct Float64Vec_get_result {union {double ok; }; bool is_ok;};
-struct Float64Vec_get_result Float64Vec_get(const Float64Vec* self, size_t i);
-
-
-void Float64Vec_destroy(Float64Vec* self);
-
-} // extern "C"
-
-} // namespace capi
-
-#endif // Float64Vec_H
diff --git a/feature_tests/cpp2/include/Float64Vec.hpp b/feature_tests/cpp2/include/Float64Vec.hpp
index 1bef39de9..e8d52c3af 100644
--- a/feature_tests/cpp2/include/Float64Vec.hpp
+++ b/feature_tests/cpp2/include/Float64Vec.hpp
@@ -10,9 +10,46 @@
#include
#include
#include "diplomat_runtime.hpp"
-#include "Float64Vec.h"
+namespace capi {
+ extern "C" {
+
+ Float64Vec* Float64Vec_new(const double* v_data, size_t v_len);
+
+ Float64Vec* Float64Vec_new_bool(const bool* v_data, size_t v_len);
+
+ Float64Vec* Float64Vec_new_i16(const int16_t* v_data, size_t v_len);
+
+ Float64Vec* Float64Vec_new_u16(const uint16_t* v_data, size_t v_len);
+
+ Float64Vec* Float64Vec_new_isize(const intptr_t* v_data, size_t v_len);
+
+ Float64Vec* Float64Vec_new_usize(const size_t* v_data, size_t v_len);
+
+ Float64Vec* Float64Vec_new_f64_be_bytes(const uint8_t* v_data, size_t v_len);
+
+ DiplomatF64View Float64Vec_as_boxed_slice(const Float64Vec* self);
+
+ DiplomatF64View Float64Vec_as_slice(const Float64Vec* self);
+
+ void Float64Vec_fill_slice(const Float64Vec* self, double* v_data, size_t v_len);
+
+ void Float64Vec_set_value(Float64Vec* self, const double* new_slice_data, size_t new_slice_len);
+
+ void Float64Vec_to_string(const Float64Vec* self, DiplomatWrite* write);
+
+ DiplomatF64View Float64Vec_borrow(const Float64Vec* self);
+
+ struct Float64Vec_get_result {union {double ok; }; bool is_ok;};
+ struct Float64Vec_get_result Float64Vec_get(const Float64Vec* self, size_t i);
+
+
+ void Float64Vec_destroy(Float64Vec* self);
+
+ } // extern "C"
+}
+
inline std::unique_ptr Float64Vec::new_(diplomat::span v) {
auto result = capi::Float64Vec_new(v.data(),
v.size());
diff --git a/feature_tests/cpp2/include/Foo.d.h b/feature_tests/cpp2/include/Foo.d.h
deleted file mode 100644
index 7b535dd3e..000000000
--- a/feature_tests/cpp2/include/Foo.d.h
+++ /dev/null
@@ -1,20 +0,0 @@
-#ifndef Foo_D_H
-#define Foo_D_H
-
-#include
-#include
-#include
-#include
-#include "diplomat_runtime.h"
-
-
-namespace capi {
-
-
-typedef struct Foo Foo;
-
-
-
-} // namespace capi
-
-#endif // Foo_D_H
diff --git a/feature_tests/cpp2/include/Foo.d.hpp b/feature_tests/cpp2/include/Foo.d.hpp
index 9a8ef9183..17bd5f5c2 100644
--- a/feature_tests/cpp2/include/Foo.d.hpp
+++ b/feature_tests/cpp2/include/Foo.d.hpp
@@ -11,7 +11,6 @@
#include "BorrowedFields.d.hpp"
#include "BorrowedFieldsReturning.d.hpp"
#include "BorrowedFieldsWithBounds.d.hpp"
-#include "Foo.d.h"
class Bar;
struct BorrowedFields;
@@ -19,6 +18,10 @@ struct BorrowedFieldsReturning;
struct BorrowedFieldsWithBounds;
+namespace capi {
+ typedef struct Foo Foo;
+}
+
class Foo {
public:
diff --git a/feature_tests/cpp2/include/Foo.h b/feature_tests/cpp2/include/Foo.h
deleted file mode 100644
index 45e5112bc..000000000
--- a/feature_tests/cpp2/include/Foo.h
+++ /dev/null
@@ -1,41 +0,0 @@
-#ifndef Foo_H
-#define Foo_H
-
-#include
-#include
-#include
-#include
-#include "diplomat_runtime.h"
-
-#include "Bar.d.h"
-#include "BorrowedFields.d.h"
-#include "BorrowedFieldsReturning.d.h"
-#include "BorrowedFieldsWithBounds.d.h"
-
-#include "Foo.d.h"
-
-namespace capi {
-
-
-extern "C" {
-
-Foo* Foo_new(const char* x_data, size_t x_len);
-
-Bar* Foo_get_bar(const Foo* self);
-
-Foo* Foo_new_static(const char* x_data, size_t x_len);
-
-BorrowedFieldsReturning Foo_as_returning(const Foo* self);
-
-Foo* Foo_extract_from_fields(BorrowedFields fields);
-
-Foo* Foo_extract_from_bounds(BorrowedFieldsWithBounds bounds, const char* another_string_data, size_t another_string_len);
-
-
-void Foo_destroy(Foo* self);
-
-} // extern "C"
-
-} // namespace capi
-
-#endif // Foo_H
diff --git a/feature_tests/cpp2/include/Foo.hpp b/feature_tests/cpp2/include/Foo.hpp
index 0b856871a..ce4b7bba8 100644
--- a/feature_tests/cpp2/include/Foo.hpp
+++ b/feature_tests/cpp2/include/Foo.hpp
@@ -14,9 +14,29 @@
#include "BorrowedFields.hpp"
#include "BorrowedFieldsReturning.hpp"
#include "BorrowedFieldsWithBounds.hpp"
-#include "Foo.h"
+namespace capi {
+ extern "C" {
+
+ Foo* Foo_new(const char* x_data, size_t x_len);
+
+ Bar* Foo_get_bar(const Foo* self);
+
+ Foo* Foo_new_static(const char* x_data, size_t x_len);
+
+ BorrowedFieldsReturning Foo_as_returning(const Foo* self);
+
+ Foo* Foo_extract_from_fields(BorrowedFields fields);
+
+ Foo* Foo_extract_from_bounds(BorrowedFieldsWithBounds bounds, const char* another_string_data, size_t another_string_len);
+
+
+ void Foo_destroy(Foo* self);
+
+ } // extern "C"
+}
+
inline std::unique_ptr Foo::new_(std::string_view x) {
auto result = capi::Foo_new(x.data(),
x.size());
diff --git a/feature_tests/cpp2/include/ImportedStruct.d.h b/feature_tests/cpp2/include/ImportedStruct.d.h
deleted file mode 100644
index 336d96177..000000000
--- a/feature_tests/cpp2/include/ImportedStruct.d.h
+++ /dev/null
@@ -1,24 +0,0 @@
-#ifndef ImportedStruct_D_H
-#define ImportedStruct_D_H
-
-#include
-#include
-#include
-#include
-#include "diplomat_runtime.h"
-
-#include "UnimportedEnum.d.h"
-
-namespace capi {
-
-
-typedef struct ImportedStruct {
- UnimportedEnum foo;
- uint8_t count;
-} ImportedStruct;
-
-
-
-} // namespace capi
-
-#endif // ImportedStruct_D_H
diff --git a/feature_tests/cpp2/include/ImportedStruct.d.hpp b/feature_tests/cpp2/include/ImportedStruct.d.hpp
index 30df7c046..d03898fb3 100644
--- a/feature_tests/cpp2/include/ImportedStruct.d.hpp
+++ b/feature_tests/cpp2/include/ImportedStruct.d.hpp
@@ -8,12 +8,18 @@
#include
#include
#include "diplomat_runtime.hpp"
-#include "ImportedStruct.d.h"
#include "UnimportedEnum.d.hpp"
class UnimportedEnum;
+namespace capi {
+ typedef struct ImportedStruct {
+ UnimportedEnum foo;
+ uint8_t count;
+ } ImportedStruct;
+}
+
struct ImportedStruct {
UnimportedEnum foo;
uint8_t count;
diff --git a/feature_tests/cpp2/include/ImportedStruct.h b/feature_tests/cpp2/include/ImportedStruct.h
deleted file mode 100644
index 4dc84cf34..000000000
--- a/feature_tests/cpp2/include/ImportedStruct.h
+++ /dev/null
@@ -1,23 +0,0 @@
-#ifndef ImportedStruct_H
-#define ImportedStruct_H
-
-#include
-#include
-#include
-#include
-#include "diplomat_runtime.h"
-
-
-#include "ImportedStruct.d.h"
-
-namespace capi {
-
-
-extern "C" {
-
-
-} // extern "C"
-
-} // namespace capi
-
-#endif // ImportedStruct_H
diff --git a/feature_tests/cpp2/include/ImportedStruct.hpp b/feature_tests/cpp2/include/ImportedStruct.hpp
index 755d2330e..a4f15f45d 100644
--- a/feature_tests/cpp2/include/ImportedStruct.hpp
+++ b/feature_tests/cpp2/include/ImportedStruct.hpp
@@ -10,10 +10,16 @@
#include
#include
#include "diplomat_runtime.hpp"
-#include "ImportedStruct.h"
#include "UnimportedEnum.hpp"
+namespace capi {
+ extern "C" {
+
+
+ } // extern "C"
+}
+
inline capi::ImportedStruct ImportedStruct::AsFFI() const {
return capi::ImportedStruct {
diff --git a/feature_tests/cpp2/include/MyEnum.d.h b/feature_tests/cpp2/include/MyEnum.d.h
deleted file mode 100644
index ec7b19200..000000000
--- a/feature_tests/cpp2/include/MyEnum.d.h
+++ /dev/null
@@ -1,27 +0,0 @@
-#ifndef MyEnum_D_H
-#define MyEnum_D_H
-
-#include
-#include
-#include
-#include
-#include "diplomat_runtime.h"
-
-
-namespace capi {
-
-
-typedef enum MyEnum {
- MyEnum_A = -2,
- MyEnum_B = -1,
- MyEnum_C = 0,
- MyEnum_D = 1,
- MyEnum_E = 2,
- MyEnum_F = 3,
-} MyEnum;
-
-
-
-} // namespace capi
-
-#endif // MyEnum_D_H
diff --git a/feature_tests/cpp2/include/MyEnum.d.hpp b/feature_tests/cpp2/include/MyEnum.d.hpp
index 32f419ac8..93e59b716 100644
--- a/feature_tests/cpp2/include/MyEnum.d.hpp
+++ b/feature_tests/cpp2/include/MyEnum.d.hpp
@@ -8,9 +8,19 @@
#include
#include
#include "diplomat_runtime.hpp"
-#include "MyEnum.d.h"
+namespace capi {
+ typedef enum MyEnum {
+ MyEnum_A = -2,
+ MyEnum_B = -1,
+ MyEnum_C = 0,
+ MyEnum_D = 1,
+ MyEnum_E = 2,
+ MyEnum_F = 3,
+ } MyEnum;
+}
+
class MyEnum {
public:
enum Value {
diff --git a/feature_tests/cpp2/include/MyEnum.h b/feature_tests/cpp2/include/MyEnum.h
deleted file mode 100644
index b372830e3..000000000
--- a/feature_tests/cpp2/include/MyEnum.h
+++ /dev/null
@@ -1,27 +0,0 @@
-#ifndef MyEnum_H
-#define MyEnum_H
-
-#include
-#include
-#include
-#include
-#include "diplomat_runtime.h"
-
-
-#include "MyEnum.d.h"
-
-namespace capi {
-
-
-extern "C" {
-
-int8_t MyEnum_into_value(MyEnum self);
-
-MyEnum MyEnum_get_a();
-
-
-} // extern "C"
-
-} // namespace capi
-
-#endif // MyEnum_H
diff --git a/feature_tests/cpp2/include/MyEnum.hpp b/feature_tests/cpp2/include/MyEnum.hpp
index 01bf23b38..3f0e3652a 100644
--- a/feature_tests/cpp2/include/MyEnum.hpp
+++ b/feature_tests/cpp2/include/MyEnum.hpp
@@ -10,7 +10,18 @@
#include
#include