Remove detail namespaces. (#137)

This commit is contained in:
Skyth (Asilkan)
2025-01-19 21:09:47 +03:00
committed by GitHub
parent d10f4bac3c
commit 312f913a92
34 changed files with 99 additions and 231 deletions
+3 -3
View File
@@ -1,10 +1,10 @@
#include <os/logger_detail.h>
#include <os/logger.h>
void os::logger::detail::Init()
void os::logger::Init()
{
}
void os::logger::detail::Log(const std::string_view str, detail::ELogType type, const char* func)
void os::logger::Log(const std::string_view str, ELogType type, const char* func)
{
if (func)
{
+2 -2
View File
@@ -1,6 +1,6 @@
#include <os/media_detail.h>
#include <os/media.h>
bool os::media::detail::IsExternalMediaPlaying()
bool os::media::IsExternalMediaPlaying()
{
// This functionality is not supported in Linux.
return false;
+4 -4
View File
@@ -1,8 +1,8 @@
#include <os/process_detail.h>
#include <os/process.h>
#include <signal.h>
std::filesystem::path os::process::detail::GetExecutablePath()
std::filesystem::path os::process::GetExecutablePath()
{
char exePath[PATH_MAX] = {};
if (readlink("/proc/self/exe", exePath, PATH_MAX) > 0)
@@ -15,7 +15,7 @@ std::filesystem::path os::process::detail::GetExecutablePath()
}
}
std::filesystem::path os::process::detail::GetWorkingDirectory()
std::filesystem::path os::process::GetWorkingDirectory()
{
char cwd[PATH_MAX] = {};
char *res = getcwd(cwd, sizeof(cwd));
@@ -29,7 +29,7 @@ std::filesystem::path os::process::detail::GetWorkingDirectory()
}
}
bool os::process::detail::StartProcess(const std::filesystem::path path, const std::vector<std::string> args, std::filesystem::path work)
bool os::process::StartProcess(const std::filesystem::path& path, const std::vector<std::string>& args, std::filesystem::path work)
{
pid_t pid = fork();
if (pid < 0)
+2 -2
View File
@@ -1,6 +1,6 @@
#include <os/user_detail.h>
#include <os/user.h>
bool os::user::detail::IsDarkTheme()
bool os::user::IsDarkTheme()
{
return false;
}
+3 -3
View File
@@ -1,7 +1,7 @@
#include <os/version_detail.h>
#include <os/version.h>
os::version::detail::OSVersion os::version::detail::GetOSVersion()
os::version::OSVersion os::version::GetOSVersion()
{
assert(false && "Unimplemented.");
return os::version::detail::OSVersion();
return os::version::OSVersion();
}
-12
View File
@@ -1,12 +0,0 @@
#include <os/logger.h>
#include <os/logger_detail.h>
void os::logger::Init()
{
detail::Init();
}
void os::logger::Log(const std::string_view str, detail::ELogType type, const char* func)
{
detail::Log(str, type, func);
}
+12 -4
View File
@@ -1,9 +1,9 @@
#pragma once
#include <os/logger_detail.h>
#include <source_location>
#define LOG_IMPL(type, func, str) os::logger::Log(str, os::logger::detail::ELogType::type, func)
#define LOGF_IMPL(type, func, str, ...) os::logger::Log(fmt::format(str, __VA_ARGS__), os::logger::detail::ELogType::type, func)
#define LOG_IMPL(type, func, str) os::logger::Log(str, os::logger::ELogType::type, func)
#define LOGF_IMPL(type, func, str, ...) os::logger::Log(fmt::format(str, __VA_ARGS__), os::logger::ELogType::type, func)
// Function-specific logging.
@@ -51,6 +51,14 @@
namespace os::logger
{
enum class ELogType
{
None,
Utility,
Warning,
Error
};
void Init();
void Log(const std::string_view str, detail::ELogType type = detail::ELogType::None, const char* func = nullptr);
void Log(const std::string_view str, ELogType type = ELogType::None, const char* func = nullptr);
}
-17
View File
@@ -1,17 +0,0 @@
#pragma once
#include <source_location>
namespace os::logger::detail
{
enum class ELogType
{
None,
Utility,
Warning,
Error
};
void Init();
void Log(const std::string_view str, ELogType type = ELogType::None, const char* func = nullptr);
}
-7
View File
@@ -1,7 +0,0 @@
#include <os/media.h>
#include <os/media_detail.h>
bool os::media::IsExternalMediaPlaying()
{
return detail::IsExternalMediaPlaying();
}
-6
View File
@@ -1,6 +0,0 @@
#pragma once
namespace os::media::detail
{
bool IsExternalMediaPlaying();
}
-17
View File
@@ -1,17 +0,0 @@
#include <os/process.h>
#include <os/process_detail.h>
std::filesystem::path os::process::GetExecutablePath()
{
return detail::GetExecutablePath();
}
std::filesystem::path os::process::GetWorkingDirectory()
{
return detail::GetWorkingDirectory();
}
bool os::process::StartProcess(const std::filesystem::path path, const std::vector<std::string> args, std::filesystem::path work)
{
return detail::StartProcess(path, args, work);
}
+1 -1
View File
@@ -4,5 +4,5 @@ namespace os::process
{
std::filesystem::path GetExecutablePath();
std::filesystem::path GetWorkingDirectory();
bool StartProcess(const std::filesystem::path path, const std::vector<std::string> args, std::filesystem::path work = {});
bool StartProcess(const std::filesystem::path& path, const std::vector<std::string>& args, std::filesystem::path work = {});
}
-8
View File
@@ -1,8 +0,0 @@
#pragma once
namespace os::process::detail
{
std::filesystem::path GetExecutablePath();
std::filesystem::path GetWorkingDirectory();
bool StartProcess(const std::filesystem::path path, const std::vector<std::string> args, std::filesystem::path work = {});
}
-7
View File
@@ -1,7 +0,0 @@
#include <os/user.h>
#include <os/user_detail.h>
bool os::user::IsDarkTheme()
{
return detail::IsDarkTheme();
}
-6
View File
@@ -1,6 +0,0 @@
#pragma once
namespace os::user::detail
{
bool IsDarkTheme();
}
-7
View File
@@ -1,7 +0,0 @@
#include <os/version.h>
#include <os/version_detail.h>
os::version::detail::OSVersion os::version::GetOSVersion()
{
return detail::GetOSVersion();
}
+8 -3
View File
@@ -1,8 +1,13 @@
#pragma once
#include <os/version_detail.h>
namespace os::version
{
detail::OSVersion GetOSVersion();
struct OSVersion
{
uint32_t Major{};
uint32_t Minor{};
uint32_t Build{};
};
OSVersion GetOSVersion();
}
-13
View File
@@ -1,13 +0,0 @@
#pragma once
namespace os::version::detail
{
struct OSVersion
{
uint32_t Major{};
uint32_t Minor{};
uint32_t Build{};
};
OSVersion GetOSVersion();
}
+3 -4
View File
@@ -1,17 +1,16 @@
#include <os/logger_detail.h>
#include <print>
#include <os/logger.h>
#define FOREGROUND_WHITE (FOREGROUND_RED | FOREGROUND_GREEN | FOREGROUND_BLUE)
#define FOREGROUND_YELLOW (FOREGROUND_RED | FOREGROUND_GREEN)
HANDLE g_hStandardOutput;
void os::logger::detail::Init()
void os::logger::Init()
{
g_hStandardOutput = GetStdHandle(STD_OUTPUT_HANDLE);
}
void os::logger::detail::Log(const std::string_view str, detail::ELogType type, const char* func)
void os::logger::Log(const std::string_view str, ELogType type, const char* func)
{
switch (type)
{
+2 -2
View File
@@ -1,4 +1,4 @@
#include <os/media_detail.h>
#include <os/media.h>
#include <os/logger.h>
#include <winrt/Windows.Foundation.h>
#include <winrt/Windows.Media.Control.h>
@@ -62,7 +62,7 @@ static GlobalSystemMediaTransportControlsSessionPlaybackInfo GetPlaybackInfo()
}
}
bool os::media::detail::IsExternalMediaPlaying()
bool os::media::IsExternalMediaPlaying()
{
auto playbackInfo = GetPlaybackInfo();
+4 -4
View File
@@ -1,6 +1,6 @@
#include <os/process_detail.h>
#include <os/process.h>
std::filesystem::path os::process::detail::GetExecutablePath()
std::filesystem::path os::process::GetExecutablePath()
{
WCHAR exePath[MAX_PATH];
@@ -10,7 +10,7 @@ std::filesystem::path os::process::detail::GetExecutablePath()
return std::filesystem::path(exePath);
}
std::filesystem::path os::process::detail::GetWorkingDirectory()
std::filesystem::path os::process::GetWorkingDirectory()
{
WCHAR workPath[MAX_PATH];
@@ -20,7 +20,7 @@ std::filesystem::path os::process::detail::GetWorkingDirectory()
return std::filesystem::path(workPath);
}
bool os::process::detail::StartProcess(const std::filesystem::path path, const std::vector<std::string> args, std::filesystem::path work)
bool os::process::StartProcess(const std::filesystem::path& path, const std::vector<std::string>& args, std::filesystem::path work)
{
if (path.empty())
return false;
+2 -2
View File
@@ -1,6 +1,6 @@
#include <os/user_detail.h>
#include <os/user.h>
bool os::user::detail::IsDarkTheme()
bool os::user::IsDarkTheme()
{
HKEY hKey;
+3 -3
View File
@@ -1,10 +1,10 @@
#include <os/version_detail.h>
#include <os/version.h>
LIB_FUNCTION(LONG, "ntdll.dll", RtlGetVersion, PRTL_OSVERSIONINFOW);
os::version::detail::OSVersion os::version::detail::GetOSVersion()
os::version::OSVersion os::version::GetOSVersion()
{
auto result = os::version::detail::OSVersion{};
auto result = os::version::OSVersion{};
OSVERSIONINFOEXW osvi = { 0 };
osvi.dwOSVersionInfoSize = sizeof(OSVERSIONINFOEXW);