summaryrefslogtreecommitdiff
path: root/core/object/class_db.h
diff options
context:
space:
mode:
Diffstat (limited to 'core/object/class_db.h')
-rw-r--r--core/object/class_db.h14
1 files changed, 14 insertions, 0 deletions
diff --git a/core/object/class_db.h b/core/object/class_db.h
index 580ae3582f..32e4bf7644 100644
--- a/core/object/class_db.h
+++ b/core/object/class_db.h
@@ -144,6 +144,13 @@ public:
static HashMap<StringName, HashMap<StringName, Variant>> default_values;
static Set<StringName> default_values_cached;
+ // Native structs, used by binder
+ struct NativeStruct {
+ String ccode; // C code to create the native struct, fields separated by ; Arrays accepted (even containing other structs), also function pointers. All types must be Godot types.
+ uint64_t struct_size; // local size of struct, for comparison
+ };
+ static Map<StringName, NativeStruct> native_structs;
+
private:
// Non-locking variants of get_parent_class and is_parent_class.
static StringName _get_parent_class(const StringName &p_class);
@@ -390,6 +397,11 @@ public:
static APIType get_current_api();
static void cleanup_defaults();
static void cleanup();
+
+ static void register_native_struct(const StringName &p_name, const String &p_code, uint64_t p_current_size);
+ static void get_native_struct_list(List<StringName> *r_names);
+ static String get_native_struct_code(const StringName &p_name);
+ static uint64_t get_native_struct_size(const StringName &p_name); // Used for asserting
};
#ifdef DEBUG_METHODS_ENABLED
@@ -448,6 +460,8 @@ _FORCE_INLINE_ Vector<Error> errarray(P... p_args) {
::ClassDB::register_abstract_class<m_class>(); \
}
+#define GDREGISTER_NATIVE_STRUCT(m_class, m_code) ClassDB::register_native_struct(#m_class, m_code, sizeof(m_class))
+
#include "core/disabled_classes.gen.h"
#endif // CLASS_DB_H