Core/Common: Update PCH content to include most commonly used headers

This commit is contained in:
Shauren
2025-06-11 16:35:31 +02:00
parent 2abf19e832
commit 1ae7cdd512
8 changed files with 28 additions and 38 deletions

View File

@@ -19,6 +19,7 @@
#include "Common.h"
#include "Log.h"
#include "StringConvert.h"
#include "Util.h"
#include <boost/filesystem/directory.hpp>
#include <boost/filesystem/operations.hpp>
#include <boost/property_tree/ini_parser.hpp>

View File

@@ -5,7 +5,7 @@
#include "Define.h"
#include "Optional.h"
#include <windows.h>
#include <Windows.h>
#include <winnt.h>
#include <winternl.h>
#include <dbghelp.h>

View File

@@ -19,7 +19,6 @@
#include "AppenderConsole.h"
#include "AppenderFile.h"
#include "Config.h"
#include "Duration.h"
#include "Errors.h"
#include "LogMessage.h"
#include "LogOperation.h"
@@ -263,8 +262,7 @@ Logger const* Log::GetLoggerByType(std::string_view type) const
std::string Log::GetTimestampStr()
{
time_t tt = std::chrono::system_clock::to_time_t(std::chrono::system_clock::now());
return TimeToTimestampStr(tt);
return TimeToTimestampStr(time(nullptr));
}
bool Log::SetLogLevel(std::string const& name, int32 newLeveli, bool isLogger /* = true */)

View File

@@ -20,7 +20,7 @@
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <windows.h>
#include <Windows.h>
#include <winsvc.h>
namespace

View File

@@ -15,28 +15,19 @@
* with this program. If not, see <http://www.gnu.org/licenses/>.
*/
#include "BoundingIntervalHierarchy.h"
#include "Common.h"
#include "Config.h"
#include "Define.h"
#include "Duration.h"
#include "Errors.h"
#include "GitRevision.h"
#include "Log.h"
#include "LogMessage.h"
#include "MapTree.h"
#include "ModelInstance.h"
#include "StringConvert.h"
#include "Util.h"
#include "VMapDefinitions.h"
#include "WorldModel.h"
#include <G3D/Ray.h>
#include <boost/filesystem/directory.hpp>
#include <G3D/Vector4.h>
#include <openssl/evp.h>
#include <algorithm>
#include <cstring>
#include <memory>
#include <mutex>
#include <set>
#include <sstream>
#include <string>
#include <unordered_map>
#include <vector>
#if TRINITY_PLATFORM == TRINITY_PLATFORM_WINDOWS
#include <Windows.h>
#endif

View File

@@ -17,14 +17,20 @@
#include "Timezone.h"
#include "Hash.h"
#include "Locales.h"
#include "MapUtils.h"
#include "StringConvert.h"
#include <boost/locale/date_time_facet.hpp>
#include <chrono>
#include <memory>
#include "Tuples.h"
#include <algorithm>
#include <unordered_map>
#if TRINITY_PLATFORM == TRINITY_PLATFORM_WINDOWS
#include "StringConvert.h"
#else
#include "Locales.h"
#include "Util.h"
#include <boost/locale/date_time_facet.hpp>
#include <memory>
#endif
namespace
{
std::unordered_map<uint32, Minutes, std::identity> InitTimezoneHashDb()
@@ -163,20 +169,13 @@ std::string GetSystemZoneName()
std::string_view FindClosestClientSupportedTimezone(std::string_view currentTimezone, Minutes currentTimezoneOffset)
{
// try exact match
auto itr = std::find_if(_clientSupportedTimezones.begin(), _clientSupportedTimezones.end(), [currentTimezone](ClientSupportedTimezone const& tz)
{
return tz.second == currentTimezone;
});
auto itr = std::ranges::find(_clientSupportedTimezones, currentTimezone, Trinity::TupleElement<1>);
if (itr != _clientSupportedTimezones.end())
return itr->second;
// try closest offset
itr = std::min_element(_clientSupportedTimezones.begin(), _clientSupportedTimezones.end(), [currentTimezoneOffset](ClientSupportedTimezone const& left, ClientSupportedTimezone const& right)
{
Minutes leftDiff = left.first - currentTimezoneOffset;
Minutes rightDiff = right.first - currentTimezoneOffset;
return std::abs(leftDiff.count()) < std::abs(rightDiff.count());
});
itr = std::ranges::min_element(_clientSupportedTimezones, std::ranges::less(),
[currentTimezoneOffset](ClientSupportedTimezone const& ctz) { return std::chrono::abs(ctz.first - currentTimezoneOffset); });
return itr->second;
}

View File

@@ -22,12 +22,13 @@
#include "Errors.h"
#include "Optional.h"
#include "Types.h"
#include "Util.h"
#include <charconv>
#include <string>
#include <string_view>
#include <type_traits>
TC_COMMON_API bool StringEqualI(std::string_view str1, std::string_view str2);
namespace Trinity::Impl::StringConvertImpl
{
template <typename T, typename = void> struct For

View File

@@ -125,6 +125,6 @@ struct fmt::formatter<Optional<T>, Char> : formatter<T, Char>
// allow implicit enum to int conversions for formatting
template <typename E, std::enable_if_t<std::is_enum_v<E>, std::nullptr_t> = nullptr>
auto format_as(E e) { return std::underlying_type_t<E>(e); }
inline constexpr auto format_as(E e) { return static_cast<std::underlying_type_t<E>>(e); }
#endif