summaryrefslogtreecommitdiff
path: root/modules/mono/utils
diff options
context:
space:
mode:
authorAndreas Haas <Hinsbart@users.noreply.github.com>2017-10-03 00:13:40 +0200
committerGitHub <noreply@github.com>2017-10-03 00:13:40 +0200
commitb0194a33f65970948ef66819913bf3034a3a22e8 (patch)
tree35e21b53b10bbd525506bb5b72b7f89214e1234f /modules/mono/utils
parent5cd68abf8896fd86a33c048d6fece61c3cd3f8e5 (diff)
parentd5caf71c3fcdeb422d1b0ea97a836fcdb57a8713 (diff)
Merge pull request #11739 from neikeq/tengo-el-mono
Moved mono module here
Diffstat (limited to 'modules/mono/utils')
-rw-r--r--modules/mono/utils/mono_reg_utils.cpp228
-rw-r--r--modules/mono/utils/mono_reg_utils.h54
-rw-r--r--modules/mono/utils/path_utils.cpp111
-rw-r--r--modules/mono/utils/path_utils.h53
-rw-r--r--modules/mono/utils/string_utils.cpp128
-rw-r--r--modules/mono/utils/string_utils.h38
6 files changed, 612 insertions, 0 deletions
diff --git a/modules/mono/utils/mono_reg_utils.cpp b/modules/mono/utils/mono_reg_utils.cpp
new file mode 100644
index 0000000000..2e90b3b716
--- /dev/null
+++ b/modules/mono/utils/mono_reg_utils.cpp
@@ -0,0 +1,228 @@
+/*************************************************************************/
+/* mono_reg_utils.cpp */
+/*************************************************************************/
+/* This file is part of: */
+/* GODOT ENGINE */
+/* https://godotengine.org */
+/*************************************************************************/
+/* Copyright (c) 2007-2017 Juan Linietsky, Ariel Manzur. */
+/* Copyright (c) 2014-2017 Godot Engine contributors (cf. AUTHORS.md) */
+/* */
+/* 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. */
+/*************************************************************************/
+#include "mono_reg_utils.h"
+
+#ifdef WINDOWS_ENABLED
+
+#include "os/os.h"
+
+// Here, after os/os.h
+#include <windows.h>
+
+namespace MonoRegUtils {
+
+template <int>
+REGSAM bitness_sam_impl();
+
+template <>
+REGSAM bitness_sam_impl<4>() {
+ return KEY_WOW64_64KEY;
+}
+
+template <>
+REGSAM bitness_sam_impl<8>() {
+ return KEY_WOW64_32KEY;
+}
+
+REGSAM _get_bitness_sam() {
+ return bitness_sam_impl<sizeof(size_t)>();
+}
+
+LONG _RegOpenKey(HKEY hKey, LPCWSTR lpSubKey, PHKEY phkResult) {
+
+ LONG res = RegOpenKeyExW(hKey, lpSubKey, 0, KEY_READ, phkResult);
+
+ if (res != ERROR_SUCCESS)
+ res = RegOpenKeyExW(hKey, lpSubKey, 0, KEY_READ | _get_bitness_sam(), phkResult);
+
+ return res;
+}
+
+LONG _RegKeyQueryString(HKEY hKey, const String &p_value_name, String &r_value) {
+
+ Vector<WCHAR> buffer;
+ buffer.resize(512);
+ DWORD dwBufferSize = buffer.size();
+
+ LONG res = RegQueryValueExW(hKey, p_value_name.c_str(), 0, NULL, (LPBYTE)buffer.ptr(), &dwBufferSize);
+
+ if (res == ERROR_MORE_DATA) {
+ // dwBufferSize now contains the actual size
+ Vector<WCHAR> buffer;
+ buffer.resize(dwBufferSize);
+ res = RegQueryValueExW(hKey, p_value_name.c_str(), 0, NULL, (LPBYTE)buffer.ptr(), &dwBufferSize);
+ }
+
+ if (res == ERROR_SUCCESS) {
+ r_value = String(buffer.ptr(), buffer.size());
+ } else {
+ r_value = String();
+ }
+
+ return res;
+}
+
+LONG _find_mono_in_reg(const String &p_subkey, MonoRegInfo &r_info, bool p_old_reg = false) {
+
+ HKEY hKey;
+ LONG res = _RegOpenKey(HKEY_LOCAL_MACHINE, p_subkey.c_str(), &hKey);
+
+ if (res != ERROR_SUCCESS)
+ goto cleanup;
+
+ if (!p_old_reg) {
+ res = _RegKeyQueryString(hKey, "Version", r_info.version);
+ if (res != ERROR_SUCCESS)
+ goto cleanup;
+ }
+
+ res = _RegKeyQueryString(hKey, "SdkInstallRoot", r_info.install_root_dir);
+ if (res != ERROR_SUCCESS)
+ goto cleanup;
+
+ res = _RegKeyQueryString(hKey, "FrameworkAssemblyDirectory", r_info.assembly_dir);
+ if (res != ERROR_SUCCESS)
+ goto cleanup;
+
+ res = _RegKeyQueryString(hKey, "MonoConfigDir", r_info.config_dir);
+ if (res != ERROR_SUCCESS)
+ goto cleanup;
+
+ if (r_info.install_root_dir.ends_with("\\"))
+ r_info.bin_dir = r_info.install_root_dir + "bin";
+ else
+ r_info.bin_dir = r_info.install_root_dir + "\\bin";
+
+cleanup:
+ RegCloseKey(hKey);
+ return res;
+}
+
+LONG _find_mono_in_reg_old(const String &p_subkey, MonoRegInfo &r_info) {
+
+ String default_clr;
+
+ HKEY hKey;
+ LONG res = _RegOpenKey(HKEY_LOCAL_MACHINE, p_subkey.c_str(), &hKey);
+
+ if (res != ERROR_SUCCESS)
+ goto cleanup;
+
+ res = _RegKeyQueryString(hKey, "DefaultCLR", default_clr);
+
+ if (res == ERROR_SUCCESS && default_clr.length()) {
+ r_info.version = default_clr;
+ res = _find_mono_in_reg(p_subkey + "\\" + default_clr, r_info, true);
+ }
+
+cleanup:
+ RegCloseKey(hKey);
+ return res;
+}
+
+MonoRegInfo find_mono() {
+
+ MonoRegInfo info;
+
+ if (_find_mono_in_reg("Software\\Mono", info) == ERROR_SUCCESS)
+ return info;
+
+ if (_find_mono_in_reg_old("Software\\Novell\\Mono", info) == ERROR_SUCCESS)
+ return info;
+
+ ERR_PRINT("Cannot find mono in the registry");
+
+ return MonoRegInfo();
+}
+
+String find_msbuild_tools_path() {
+
+ String msbuild_tools_path;
+
+ // Try to find 15.0 with vswhere
+
+ String vswhere_path = OS::get_singleton()->get_environment(sizeof(size_t) == 8 ? "ProgramFiles(x86)" : "ProgramFiles");
+ vswhere_path += "\\Microsoft Visual Studio\\Installer\\vswhere.exe";
+
+ List<String> vswhere_args;
+ vswhere_args.push_back("-latest");
+ vswhere_args.push_back("-requires");
+ vswhere_args.push_back("Microsoft.Component.MSBuild");
+
+ String output;
+ int exit_code;
+ OS::get_singleton()->execute(vswhere_path, vswhere_args, true, NULL, &output, &exit_code);
+
+ if (exit_code == 0) {
+ Vector<String> lines = output.split("\n");
+
+ for (int i = 0; i < lines.size(); i++) {
+ const String &line = lines[i];
+ int sep_idx = line.find(":");
+
+ if (sep_idx > 0) {
+ String key = line.substr(0, sep_idx); // No need to trim
+
+ if (key == "installationPath") {
+ String val = line.substr(sep_idx + 1, line.length()).strip_edges();
+
+ ERR_BREAK(val.empty());
+
+ if (!val.ends_with("\\")) {
+ val += "\\";
+ }
+
+ return val + "MSBuild\\15.0\\Bin";
+ }
+ }
+ }
+ }
+
+ // Try to find 14.0 in the Registry
+
+ HKEY hKey;
+ LONG res = _RegOpenKey(HKEY_LOCAL_MACHINE, L"SOFTWARE\\Microsoft\\MSBuild\\ToolsVersions\\14.0", &hKey);
+
+ if (res != ERROR_SUCCESS)
+ goto cleanup;
+
+ res = _RegKeyQueryString(hKey, "MSBuildToolsPath", msbuild_tools_path);
+
+ if (res != ERROR_SUCCESS)
+ goto cleanup;
+
+cleanup:
+ RegCloseKey(hKey);
+
+ return msbuild_tools_path;
+}
+} // namespace MonoRegUtils
+
+#endif WINDOWS_ENABLED
diff --git a/modules/mono/utils/mono_reg_utils.h b/modules/mono/utils/mono_reg_utils.h
new file mode 100644
index 0000000000..4cc4965acb
--- /dev/null
+++ b/modules/mono/utils/mono_reg_utils.h
@@ -0,0 +1,54 @@
+/*************************************************************************/
+/* mono_reg_utils.h */
+/*************************************************************************/
+/* This file is part of: */
+/* GODOT ENGINE */
+/* https://godotengine.org */
+/*************************************************************************/
+/* Copyright (c) 2007-2017 Juan Linietsky, Ariel Manzur. */
+/* Copyright (c) 2014-2017 Godot Engine contributors (cf. AUTHORS.md) */
+/* */
+/* 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 MONO_REG_UTILS_H
+#define MONO_REG_UTILS_H
+
+#ifdef WINDOWS_ENABLED
+
+#include "ustring.h"
+
+struct MonoRegInfo {
+
+ String version;
+ String install_root_dir;
+ String assembly_dir;
+ String config_dir;
+ String bin_dir;
+};
+
+namespace MonoRegUtils {
+
+MonoRegInfo find_mono();
+String find_msbuild_tools_path();
+} // MonoRegUtils
+
+#endif // WINDOWS_ENABLED
+
+#endif // MONO_REG_UTILS_H
diff --git a/modules/mono/utils/path_utils.cpp b/modules/mono/utils/path_utils.cpp
new file mode 100644
index 0000000000..c8581f6122
--- /dev/null
+++ b/modules/mono/utils/path_utils.cpp
@@ -0,0 +1,111 @@
+/*************************************************************************/
+/* path_utils.cpp */
+/*************************************************************************/
+/* This file is part of: */
+/* GODOT ENGINE */
+/* https://godotengine.org */
+/*************************************************************************/
+/* Copyright (c) 2007-2017 Juan Linietsky, Ariel Manzur. */
+/* Copyright (c) 2014-2017 Godot Engine contributors (cf. AUTHORS.md) */
+/* */
+/* 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. */
+/*************************************************************************/
+#include "path_utils.h"
+
+#include "os/dir_access.h"
+#include "os/file_access.h"
+#include "os/os.h"
+#include "project_settings.h"
+
+#ifdef WINDOWS_ENABLED
+#define ENV_PATH_SEP ";"
+#else
+#define ENV_PATH_SEP ":"
+#include <limits.h>
+#endif
+
+#include <stdlib.h>
+
+String path_which(const String &p_name) {
+
+#ifdef WINDOWS_ENABLED
+ Vector<String> exts = OS::get_singleton()->get_environment("PATHEXT").split(ENV_PATH_SEP, false);
+#endif
+ Vector<String> env_path = OS::get_singleton()->get_environment("PATH").split(ENV_PATH_SEP, false);
+
+ if (env_path.empty())
+ return String();
+
+ for (int i = 0; i < env_path.size(); i++) {
+ String p = path_join(env_path[i], p_name);
+
+ if (FileAccess::exists(p))
+ return p;
+
+#ifdef WINDOWS_ENABLED
+ for (int j = 0; j < exts.size(); j++) {
+ String p2 = p + exts[j];
+
+ if (FileAccess::exists(p2))
+ return p2;
+ }
+#endif
+ }
+
+ return String();
+}
+
+void fix_path(const String &p_path, String &r_out) {
+ r_out = p_path.replace("\\", "/");
+
+ while (true) { // in case of using 2 or more slash
+ String compare = r_out.replace("//", "/");
+ if (r_out == compare)
+ break;
+ else
+ r_out = compare;
+ }
+}
+
+bool rel_path_to_abs(const String &p_existing_path, String &r_abs_path) {
+#ifdef WINDOWS_ENABLED
+ CharType ret[_MAX_PATH];
+ if (_wfullpath(ret, p_existing_path.c_str(), _MAX_PATH)) {
+ String abspath = String(ret).replace("\\", "/");
+ int pos = abspath.find(":/");
+ if (pos != -1) {
+ r_abs_path = abspath.substr(pos - 1, abspath.length());
+ } else {
+ r_abs_path = abspath;
+ }
+ return true;
+ }
+#else
+ char ret[PATH_MAX];
+ if (realpath(p_existing_path.utf8().get_data(), ret)) {
+ String retstr;
+ if (!retstr.parse_utf8(ret)) {
+ r_abs_path = retstr;
+ return true;
+ }
+ }
+#endif
+ return false;
+}
diff --git a/modules/mono/utils/path_utils.h b/modules/mono/utils/path_utils.h
new file mode 100644
index 0000000000..445604300d
--- /dev/null
+++ b/modules/mono/utils/path_utils.h
@@ -0,0 +1,53 @@
+/*************************************************************************/
+/* path_utils.h */
+/*************************************************************************/
+/* This file is part of: */
+/* GODOT ENGINE */
+/* https://godotengine.org */
+/*************************************************************************/
+/* Copyright (c) 2007-2017 Juan Linietsky, Ariel Manzur. */
+/* Copyright (c) 2014-2017 Godot Engine contributors (cf. AUTHORS.md) */
+/* */
+/* 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 PATH_UTILS_H
+#define PATH_UTILS_H
+
+#include "ustring.h"
+
+_FORCE_INLINE_ String path_join(const String &e1, const String &e2) {
+ return e1.plus_file(e2);
+}
+
+_FORCE_INLINE_ String path_join(const String &e1, const String &e2, const String &e3) {
+ return e1.plus_file(e2).plus_file(e3);
+}
+
+_FORCE_INLINE_ String path_join(const String &e1, const String &e2, const String &e3, const String &e4) {
+ return e1.plus_file(e2).plus_file(e3).plus_file(e4);
+}
+
+String path_which(const String &p_name);
+
+void fix_path(const String &p_path, String &r_out);
+
+bool rel_path_to_abs(const String &p_existing_path, String &r_abs_path);
+
+#endif // PATH_UTILS_H
diff --git a/modules/mono/utils/string_utils.cpp b/modules/mono/utils/string_utils.cpp
new file mode 100644
index 0000000000..de1a60dbd1
--- /dev/null
+++ b/modules/mono/utils/string_utils.cpp
@@ -0,0 +1,128 @@
+/*************************************************************************/
+/* string_utils.cpp */
+/*************************************************************************/
+/* This file is part of: */
+/* GODOT ENGINE */
+/* https://godotengine.org */
+/*************************************************************************/
+/* Copyright (c) 2007-2017 Juan Linietsky, Ariel Manzur. */
+/* Copyright (c) 2014-2017 Godot Engine contributors (cf. AUTHORS.md) */
+/* */
+/* 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. */
+/*************************************************************************/
+#include "string_utils.h"
+
+namespace {
+
+int sfind(const String &p_text, int p_from) {
+ if (p_from < 0)
+ return -1;
+
+ int src_len = 2;
+ int len = p_text.length();
+
+ if (src_len == 0 || len == 0)
+ return -1;
+
+ const CharType *src = p_text.c_str();
+
+ for (int i = p_from; i <= (len - src_len); i++) {
+ bool found = true;
+
+ for (int j = 0; j < src_len; j++) {
+ int read_pos = i + j;
+
+ if (read_pos >= len) {
+ ERR_PRINT("read_pos >= len");
+ return -1;
+ };
+
+ switch (j) {
+ case 0:
+ found = src[read_pos] == '%';
+ break;
+ case 1: {
+ CharType c = src[read_pos];
+ found = src[read_pos] == 's' || (c >= '0' || c <= '4');
+ break;
+ }
+ default:
+ found = false;
+ }
+
+ if (!found) {
+ break;
+ }
+ }
+
+ if (found)
+ return i;
+ }
+
+ return -1;
+}
+}
+
+String sformat(const String &p_text, const Variant &p1, const Variant &p2, const Variant &p3, const Variant &p4, const Variant &p5) {
+ if (p_text.length() < 2)
+ return p_text;
+
+ Array args;
+
+ if (p1.get_type() != Variant::NIL) {
+ args.push_back(p1);
+
+ if (p2.get_type() != Variant::NIL) {
+ args.push_back(p2);
+
+ if (p3.get_type() != Variant::NIL) {
+ args.push_back(p3);
+
+ if (p4.get_type() != Variant::NIL) {
+ args.push_back(p4);
+
+ if (p5.get_type() != Variant::NIL) {
+ args.push_back(p5);
+ }
+ }
+ }
+ }
+ }
+
+ String new_string;
+
+ int findex = 0;
+ int search_from = 0;
+ int result = 0;
+
+ while ((result = sfind(p_text, search_from)) >= 0) {
+ CharType c = p_text[result + 1];
+
+ int req_index = (c == 's' ? findex++ : c - '0');
+
+ new_string += p_text.substr(search_from, result - search_from);
+ new_string += args[req_index].operator String();
+ search_from = result + 2;
+ }
+
+ new_string += p_text.substr(search_from, p_text.length() - search_from);
+
+ return new_string;
+}
diff --git a/modules/mono/utils/string_utils.h b/modules/mono/utils/string_utils.h
new file mode 100644
index 0000000000..2f2c3c2d89
--- /dev/null
+++ b/modules/mono/utils/string_utils.h
@@ -0,0 +1,38 @@
+/*************************************************************************/
+/* string_utils.h */
+/*************************************************************************/
+/* This file is part of: */
+/* GODOT ENGINE */
+/* https://godotengine.org */
+/*************************************************************************/
+/* Copyright (c) 2007-2017 Juan Linietsky, Ariel Manzur. */
+/* Copyright (c) 2014-2017 Godot Engine contributors (cf. AUTHORS.md) */
+/* */
+/* 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 STRING_FORMAT_H
+#define STRING_FORMAT_H
+
+#include "ustring.h"
+#include "variant.h"
+
+String sformat(const String &p_text, const Variant &p1 = Variant(), const Variant &p2 = Variant(), const Variant &p3 = Variant(), const Variant &p4 = Variant(), const Variant &p5 = Variant());
+
+#endif // STRING_FORMAT_H