mirror of
https://github.com/BeamMP/BeamMP-Server.git
synced 2025-07-02 15:55:30 +00:00
run clang-format
This commit is contained in:
parent
3c80bcbf01
commit
29f4d0d286
@ -37,8 +37,8 @@
|
|||||||
#include <filesystem>
|
#include <filesystem>
|
||||||
namespace fs = std::filesystem;
|
namespace fs = std::filesystem;
|
||||||
|
|
||||||
#include "TConsole.h"
|
|
||||||
#include "Settings.h"
|
#include "Settings.h"
|
||||||
|
#include "TConsole.h"
|
||||||
|
|
||||||
struct Version {
|
struct Version {
|
||||||
uint8_t major;
|
uint8_t major;
|
||||||
@ -61,8 +61,6 @@ class Application final {
|
|||||||
public:
|
public:
|
||||||
// types
|
// types
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
using TShutdownHandler = std::function<void()>;
|
using TShutdownHandler = std::function<void()>;
|
||||||
|
|
||||||
// methods
|
// methods
|
||||||
|
@ -17,7 +17,7 @@
|
|||||||
// along with this program. If not, see <https://www.gnu.org/licenses/>.
|
// along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||||
|
|
||||||
#pragma once
|
#pragma once
|
||||||
#include "rapidjson/stringbuffer.h"
|
|
||||||
#include "rapidjson/prettywriter.h"
|
|
||||||
#include "rapidjson/document.h"
|
#include "rapidjson/document.h"
|
||||||
|
#include "rapidjson/prettywriter.h"
|
||||||
|
#include "rapidjson/stringbuffer.h"
|
||||||
#include "rapidjson/writer.h"
|
#include "rapidjson/writer.h"
|
||||||
|
@ -23,8 +23,8 @@
|
|||||||
* and write locks and read locks are mutually exclusive.
|
* and write locks and read locks are mutually exclusive.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#include <shared_mutex>
|
|
||||||
#include <mutex>
|
#include <mutex>
|
||||||
|
#include <shared_mutex>
|
||||||
|
|
||||||
// Use ReadLock(m) and WriteLock(m) to lock it.
|
// Use ReadLock(m) and WriteLock(m) to lock it.
|
||||||
using RWMutex = std::shared_mutex;
|
using RWMutex = std::shared_mutex;
|
||||||
|
@ -142,5 +142,3 @@ struct Settings {
|
|||||||
void setConsoleInputAccessMapping(const ComposedKey& keyName, int value);
|
void setConsoleInputAccessMapping(const ComposedKey& keyName, int value);
|
||||||
void setConsoleInputAccessMapping(const ComposedKey& keyName, bool value);
|
void setConsoleInputAccessMapping(const ComposedKey& keyName, bool value);
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
|
@ -2,24 +2,21 @@
|
|||||||
#include "Common.h"
|
#include "Common.h"
|
||||||
#include <regex>
|
#include <regex>
|
||||||
|
|
||||||
std::chrono::high_resolution_clock::duration ChronoWrapper::TimeFromStringWithLiteral(const std::string& time_str)
|
std::chrono::high_resolution_clock::duration ChronoWrapper::TimeFromStringWithLiteral(const std::string& time_str) {
|
||||||
{
|
|
||||||
// const std::regex time_regex(R"((\d+\.{0,1}\d*)(min|ms|us|ns|[dhs]))"); //i.e one of: "25ns, 6us, 256ms, 2s, 13min, 69h, 356d" will get matched (only available in newer C++ versions)
|
// const std::regex time_regex(R"((\d+\.{0,1}\d*)(min|ms|us|ns|[dhs]))"); //i.e one of: "25ns, 6us, 256ms, 2s, 13min, 69h, 356d" will get matched (only available in newer C++ versions)
|
||||||
const std::regex time_regex(R"((\d+\.{0,1}\d*)(min|[dhs]))"); // i.e one of: "2.01s, 13min, 69h, 356.69d" will get matched
|
const std::regex time_regex(R"((\d+\.{0,1}\d*)(min|[dhs]))"); // i.e one of: "2.01s, 13min, 69h, 356.69d" will get matched
|
||||||
std::smatch match;
|
std::smatch match;
|
||||||
float time_value;
|
float time_value;
|
||||||
if (!std::regex_search(time_str, match, time_regex)) return std::chrono::nanoseconds(0);
|
if (!std::regex_search(time_str, match, time_regex))
|
||||||
|
return std::chrono::nanoseconds(0);
|
||||||
time_value = stof(match.str(1));
|
time_value = stof(match.str(1));
|
||||||
if (match.str(2) == "d") {
|
if (match.str(2) == "d") {
|
||||||
return std::chrono::seconds((uint64_t)(time_value * 86400)); // 86400 seconds in a day
|
return std::chrono::seconds((uint64_t)(time_value * 86400)); // 86400 seconds in a day
|
||||||
}
|
} else if (match.str(2) == "h") {
|
||||||
else if (match.str(2) == "h") {
|
|
||||||
return std::chrono::seconds((uint64_t)(time_value * 3600)); // 3600 seconds in an hour
|
return std::chrono::seconds((uint64_t)(time_value * 3600)); // 3600 seconds in an hour
|
||||||
}
|
} else if (match.str(2) == "min") {
|
||||||
else if (match.str(2) == "min") {
|
|
||||||
return std::chrono::seconds((uint64_t)(time_value * 60));
|
return std::chrono::seconds((uint64_t)(time_value * 60));
|
||||||
}
|
} else if (match.str(2) == "s") {
|
||||||
else if (match.str(2) == "s") {
|
|
||||||
return std::chrono::seconds((uint64_t)time_value);
|
return std::chrono::seconds((uint64_t)time_value);
|
||||||
}
|
}
|
||||||
return std::chrono::nanoseconds(0);
|
return std::chrono::nanoseconds(0);
|
||||||
|
@ -22,13 +22,13 @@
|
|||||||
#include "TConsole.h"
|
#include "TConsole.h"
|
||||||
#include <array>
|
#include <array>
|
||||||
#include <charconv>
|
#include <charconv>
|
||||||
|
#include <chrono>
|
||||||
#include <fmt/core.h>
|
#include <fmt/core.h>
|
||||||
#include <iostream>
|
#include <iostream>
|
||||||
#include <map>
|
#include <map>
|
||||||
#include <regex>
|
#include <regex>
|
||||||
#include <sstream>
|
#include <sstream>
|
||||||
#include <thread>
|
#include <thread>
|
||||||
#include <chrono>
|
|
||||||
|
|
||||||
#include "Compat.h"
|
#include "Compat.h"
|
||||||
#include "CustomAssert.h"
|
#include "CustomAssert.h"
|
||||||
@ -383,4 +383,3 @@ void SplitString(const std::string& str, const char delim, std::vector<std::stri
|
|||||||
out.push_back(str.substr(start, end - start));
|
out.push_back(str.substr(start, end - start));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -20,8 +20,8 @@
|
|||||||
#include "Client.h"
|
#include "Client.h"
|
||||||
#include "Common.h"
|
#include "Common.h"
|
||||||
#include "CustomAssert.h"
|
#include "CustomAssert.h"
|
||||||
#include "TLuaEngine.h"
|
|
||||||
#include "Settings.h"
|
#include "Settings.h"
|
||||||
|
#include "TLuaEngine.h"
|
||||||
|
|
||||||
#include <nlohmann/json.hpp>
|
#include <nlohmann/json.hpp>
|
||||||
|
|
||||||
|
@ -57,4 +57,3 @@ size_t prof::UnitExecutionTime::measurement_count() const {
|
|||||||
std::unique_lock lock(m_mtx);
|
std::unique_lock lock(m_mtx);
|
||||||
return m_total_calls;
|
return m_total_calls;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -18,8 +18,6 @@
|
|||||||
|
|
||||||
#include "Settings.h"
|
#include "Settings.h"
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
Settings::Settings() {
|
Settings::Settings() {
|
||||||
SettingsMap = std::unordered_map<Key, SettingsTypeVariant> {
|
SettingsMap = std::unordered_map<Key, SettingsTypeVariant> {
|
||||||
// All entries which contain std::strings must be explicitly constructed, otherwise they become 'bool'
|
// All entries which contain std::strings must be explicitly constructed, otherwise they become 'bool'
|
||||||
@ -61,8 +59,6 @@ Settings::Settings(){
|
|||||||
{ { "Misc", "ImScaredOfUpdates" }, { Misc_ImScaredOfUpdates, READ_WRITE } },
|
{ { "Misc", "ImScaredOfUpdates" }, { Misc_ImScaredOfUpdates, READ_WRITE } },
|
||||||
{ { "Misc", "UpdateReminderTime" }, { Misc_UpdateReminderTime, READ_WRITE } }
|
{ { "Misc", "UpdateReminderTime" }, { Misc_UpdateReminderTime, READ_WRITE } }
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
std::string Settings::getAsString(Key key) {
|
std::string Settings::getAsString(Key key) {
|
||||||
|
@ -19,8 +19,8 @@
|
|||||||
#include "Common.h"
|
#include "Common.h"
|
||||||
|
|
||||||
#include "Env.h"
|
#include "Env.h"
|
||||||
#include "TConfig.h"
|
|
||||||
#include "Settings.h"
|
#include "Settings.h"
|
||||||
|
#include "TConfig.h"
|
||||||
#include <cstdlib>
|
#include <cstdlib>
|
||||||
#include <exception>
|
#include <exception>
|
||||||
#include <fstream>
|
#include <fstream>
|
||||||
|
@ -18,9 +18,9 @@
|
|||||||
|
|
||||||
#include "THeartbeatThread.h"
|
#include "THeartbeatThread.h"
|
||||||
|
|
||||||
|
#include "ChronoWrapper.h"
|
||||||
#include "Client.h"
|
#include "Client.h"
|
||||||
#include "Http.h"
|
#include "Http.h"
|
||||||
#include "ChronoWrapper.h"
|
|
||||||
// #include "SocketIO.h"
|
// #include "SocketIO.h"
|
||||||
#include <rapidjson/document.h>
|
#include <rapidjson/document.h>
|
||||||
#include <rapidjson/rapidjson.h>
|
#include <rapidjson/rapidjson.h>
|
||||||
|
@ -20,6 +20,7 @@
|
|||||||
#include "Common.h"
|
#include "Common.h"
|
||||||
#include "Http.h"
|
#include "Http.h"
|
||||||
#include "LuaAPI.h"
|
#include "LuaAPI.h"
|
||||||
|
#include "Settings.h"
|
||||||
#include "SignalHandling.h"
|
#include "SignalHandling.h"
|
||||||
#include "TConfig.h"
|
#include "TConfig.h"
|
||||||
#include "THeartbeatThread.h"
|
#include "THeartbeatThread.h"
|
||||||
@ -29,7 +30,6 @@
|
|||||||
#include "TPluginMonitor.h"
|
#include "TPluginMonitor.h"
|
||||||
#include "TResourceManager.h"
|
#include "TResourceManager.h"
|
||||||
#include "TServer.h"
|
#include "TServer.h"
|
||||||
#include "Settings.h"
|
|
||||||
|
|
||||||
#include <cstdint>
|
#include <cstdint>
|
||||||
#include <iostream>
|
#include <iostream>
|
||||||
|
Loading…
x
Reference in New Issue
Block a user