godot/core/object/class_db.h

/**************************************************************************/
/*  class_db.h                                                            */
/**************************************************************************/
/*                         This file is part of:                          */
/*                             GODOT ENGINE                               */
/*                        https://godotengine.org                         */
/**************************************************************************/
/* Copyright (c) 2014-present Godot Engine contributors (see AUTHORS.md). */
/* Copyright (c) 2007-2014 Juan Linietsky, Ariel Manzur.                  */
/*                                                                        */
/* Permission is hereby granted, free of charge, to any person obtaining  */
/* a copy of this software and associated documentation files (the        */
/* "Software"), to deal in the Software without restriction, including    */
/* without limitation the rights to use, copy, modify, merge, publish,    */
/* distribute, sublicense, and/or sell copies of the Software, and to     */
/* permit persons to whom the Software is furnished to do so, subject to  */
/* the following conditions:                                              */
/*                                                                        */
/* The above copyright notice and this permission notice shall be         */
/* included in all copies or substantial portions of the Software.        */
/*                                                                        */
/* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,        */
/* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF     */
/* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. */
/* IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY   */
/* CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,   */
/* TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE      */
/* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.                 */
/**************************************************************************/

#ifndef CLASS_DB_H
#define CLASS_DB_H

#include "core/object/method_bind.h"
#include "core/object/object.h"
#include "core/string/print_string.h"

// Makes callable_mp readily available in all classes connecting signals.
// Needs to come after method_bind and object have been included.
#include "core/object/callable_method_pointer.h"
#include "core/templates/hash_set.h"

#include <type_traits>

#define DEFVAL(m_defval)

#ifdef DEBUG_METHODS_ENABLED

struct MethodDefinition {};

MethodDefinition D_METHODP(const char *p_name, const char *const **p_args, uint32_t p_argcount);

template <typename... VarArgs>
MethodDefinition D_METHOD(const char *p_name, const VarArgs... p_args) {}

#else

// When DEBUG_METHODS_ENABLED is set this will let the engine know
// the argument names for easier debugging.
#define D_METHOD

#endif

class ClassDB {};

#define BIND_ENUM_CONSTANT(m_constant)

#define BIND_BITFIELD_FLAG(m_constant)

#define BIND_CONSTANT(m_constant)

#ifdef DEBUG_METHODS_ENABLED

_FORCE_INLINE_ void errarray_add_str(Vector<Error> &arr) {}

_FORCE_INLINE_ void errarray_add_str(Vector<Error> &arr, const Error &p_err) {}

template <typename... P>
_FORCE_INLINE_ void errarray_add_str(Vector<Error> &arr, const Error &p_err, P... p_args) {}

template <typename... P>
_FORCE_INLINE_ Vector<Error> errarray(P... p_args) {}

#define BIND_METHOD_ERR_RETURN_DOC(m_method, ...)

#else

#define BIND_METHOD_ERR_RETURN_DOC

#endif

#define GDREGISTER_CLASS(m_class)
#define GDREGISTER_VIRTUAL_CLASS(m_class)
#define GDREGISTER_ABSTRACT_CLASS(m_class)
#define GDREGISTER_INTERNAL_CLASS(m_class)

#define GDREGISTER_RUNTIME_CLASS(m_class)

#define GDREGISTER_NATIVE_STRUCT(m_class, m_code)

#include "core/disabled_classes.gen.h"

#endif // CLASS_DB_H