summaryrefslogtreecommitdiffstats
path: root/platform/web/api
diff options
context:
space:
mode:
authorRémi Verschelde <rverschelde@gmail.com>2023-06-08 14:51:32 +0200
committerRémi Verschelde <rverschelde@gmail.com>2023-06-08 15:19:19 +0200
commit9e4315bb502659e73b01eb5b40ce1cac10bea2c5 (patch)
tree0ba5196ed22da7782480105116134421412ae10a /platform/web/api
parent2985a9ac348fc0e08a7906ff36b08985e36ac2a4 (diff)
downloadredot-engine-9e4315bb502659e73b01eb5b40ce1cac10bea2c5.tar.gz
Style: Harmonize header includes in platform ports
This applies our existing style guide, and adds a new rule to that style guide for modular components such as platform ports and modules: Includes from the platform port or module should be included with relative paths (relative to the root folder of the modular component, e.g. `platform/linuxbsd/`), in their own section before Godot's "core" includes. The `api` and `export` subfolders also need to be handled as self-contained (and thus use relative paths for their "local" includes) as they are all compiled for each editor platform, without necessarily having the api/export matching platform folder in the include path. E.g. the Linux editor build will compile `platform/android/{api,export}/*.cpp` and those need to use relative includes for it to work.
Diffstat (limited to 'platform/web/api')
-rw-r--r--platform/web/api/api.cpp12
-rw-r--r--platform/web/api/web_tools_editor_plugin.cpp6
-rw-r--r--platform/web/api/web_tools_editor_plugin.h6
3 files changed, 20 insertions, 4 deletions
diff --git a/platform/web/api/api.cpp b/platform/web/api/api.cpp
index a630e3d866..ab7154b0fb 100644
--- a/platform/web/api/api.cpp
+++ b/platform/web/api/api.cpp
@@ -29,10 +29,12 @@
/**************************************************************************/
#include "api.h"
-#include "core/config/engine.h"
+
#include "javascript_bridge_singleton.h"
#include "web_tools_editor_plugin.h"
+#include "core/config/engine.h"
+
static JavaScriptBridge *javascript_bridge_singleton;
void register_web_api() {
@@ -78,6 +80,7 @@ void JavaScriptBridge::_bind_methods() {
}
#if !defined(WEB_ENABLED) || !defined(JAVASCRIPT_EVAL_ENABLED)
+
Variant JavaScriptBridge::eval(const String &p_code, bool p_use_global_exec_context) {
return Variant();
}
@@ -104,16 +107,23 @@ Variant JavaScriptBridge::_create_object_bind(const Variant **p_args, int p_argc
}
return Ref<JavaScriptObject>();
}
+
#endif
+
#if !defined(WEB_ENABLED)
+
bool JavaScriptBridge::pwa_needs_update() const {
return false;
}
+
Error JavaScriptBridge::pwa_update() {
return ERR_UNAVAILABLE;
}
+
void JavaScriptBridge::force_fs_sync() {
}
+
void JavaScriptBridge::download_buffer(Vector<uint8_t> p_arr, const String &p_name, const String &p_mime) {
}
+
#endif
diff --git a/platform/web/api/web_tools_editor_plugin.cpp b/platform/web/api/web_tools_editor_plugin.cpp
index 213204ff33..d39773bde2 100644
--- a/platform/web/api/web_tools_editor_plugin.cpp
+++ b/platform/web/api/web_tools_editor_plugin.cpp
@@ -28,9 +28,10 @@
/* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
/**************************************************************************/
-#if defined(TOOLS_ENABLED) && defined(WEB_ENABLED)
#include "web_tools_editor_plugin.h"
+#if defined(TOOLS_ENABLED) && defined(WEB_ENABLED)
+
#include "core/config/engine.h"
#include "core/config/project_settings.h"
#include "core/io/dir_access.h"
@@ -154,4 +155,5 @@ void WebToolsEditorPlugin::_zip_recursive(String p_path, String p_base_path, zip
cur = dir->get_next();
}
}
-#endif
+
+#endif // TOOLS_ENABLED && WEB_ENABLED
diff --git a/platform/web/api/web_tools_editor_plugin.h b/platform/web/api/web_tools_editor_plugin.h
index fc74899a58..ac0d5e20ec 100644
--- a/platform/web/api/web_tools_editor_plugin.h
+++ b/platform/web/api/web_tools_editor_plugin.h
@@ -32,6 +32,7 @@
#define WEB_TOOLS_EDITOR_PLUGIN_H
#if defined(TOOLS_ENABLED) && defined(WEB_ENABLED)
+
#include "core/io/zip_io.h"
#include "editor/editor_plugin.h"
@@ -48,11 +49,14 @@ public:
WebToolsEditorPlugin();
};
+
#else
+
class WebToolsEditorPlugin {
public:
static void initialize() {}
};
-#endif
+
+#endif // TOOLS_ENABLED && WEB_ENABLED
#endif // WEB_TOOLS_EDITOR_PLUGIN_H