This commit is contained in:
Mars 2024-06-09 03:05:18 -04:00
parent 35a3dd159a
commit d68be0f19f
2 changed files with 58 additions and 11 deletions

47
.clang-tidy Normal file
View file

@ -0,0 +1,47 @@
Checks: >
*,
-abseil-*,
-altera-*,
-bugprone-easily-swappable-parameters,
-bugprone-implicit-widening-of-multiplication-result,
-concurrency-mt-unsafe,
-cppcoreguidelines-avoid-magic-numbers,
-cppcoreguidelines-owning-memory,
-cppcoreguidelines-pro-type-member-init,
-fuchsia-*,
-google-*,
-hicpp-*,
-llvm-include-order,
-llvm-include-order,
-llvmlibc-*,
-misc-non-private-member-variables-in-classes,
-modernize-use-trailing-return-type,
-readability-braces-around-statements,
-readability-implicit-bool-conversion,
-readability-isolate-declaration,
-readability-magic-numbers
CheckOptions:
readability-identifier-naming.ClassCase: CamelCase
readability-identifier-naming.EnumCase: CamelCase
readability-identifier-naming.LocalConstantCase: camelBack
readability-identifier-naming.LocalVariableCase: camelBack
readability-identifier-naming.GlobalFunctionCase: CamelCase
readability-identifier-naming.MemberCase: lower_case
readability-identifier-naming.MethodCase: camelBack
readability-identifier-naming.MethodIgnoredRegexp: ((to|from)_class)
readability-identifier-naming.ParameterPackCase: lower_case
readability-identifier-naming.PrivateMemberCase: CamelCase
readability-identifier-naming.PrivateMemberPrefix: 'm_'
readability-identifier-naming.PrivateMethodCase: CamelCase
readability-identifier-naming.PrivateMethodPrefix: ''
readability-identifier-naming.ProtectedMemberPrefix: 'm_'
readability-identifier-naming.ProtectedMethodPrefix: ''
readability-identifier-naming.PublicMemberCase: lower_case
readability-identifier-naming.StaticConstantCase: UPPER_CASE
readability-identifier-naming.StaticVariableCase: CamelCase
readability-identifier-naming.StructCase: CamelCase
readability-identifier-naming.TemplateParameterCase: lower_case
readability-identifier-naming.TemplateTemplateParameterCase: CamelCase
readability-identifier-naming.TypeTemplateParameterCase: CamelCase
readability-identifier-naming.TypedefCase: CamelCase
readability-identifier-naming.UnionCase: CamelCase

View file

@ -33,7 +33,7 @@ struct fmt::formatter<KBToGiB> : formatter<double> {
}
};
enum DateNum { Ones, Twos, Threes, Default };
enum DateNum : u8 { Ones, Twos, Threes, Default };
DateNum ParseDate(std::string const& input) {
if (input == "1" || input == "21" || input == "31") return Ones;
@ -72,12 +72,12 @@ std::string GetNowPlaying() {
} catch (...) { return "Failed to get media properties."; }
}
std::string getRegistryValue(
std::string GetRegistryValue(
const HKEY& hKey,
const std::string& subKey,
const std::string& valueName
) {
HKEY key;
HKEY key = nullptr;
if (RegOpenKeyExA(hKey, subKey.c_str(), 0, KEY_READ, &key) != ERROR_SUCCESS)
return "";
@ -95,7 +95,7 @@ std::string getRegistryValue(
valueName.c_str(),
nullptr,
nullptr,
reinterpret_cast<LPBYTE>(&value[0]),
reinterpret_cast<LPBYTE>(value.data()), // NOLINT(*-reinterpret-cast)
&dataSize
) != ERROR_SUCCESS) {
RegCloseKey(key);
@ -109,26 +109,26 @@ std::string getRegistryValue(
return value;
}
std::string getPrettyWindowsName() {
std::string productName = getRegistryValue(
std::string GetPrettyWindowsName() {
std::string productName = GetRegistryValue(
HKEY_LOCAL_MACHINE,
R"(SOFTWARE\Microsoft\Windows NT\CurrentVersion)",
"ProductName"
);
const std::string displayVersion = getRegistryValue(
const std::string displayVersion = GetRegistryValue(
HKEY_LOCAL_MACHINE,
R"(SOFTWARE\Microsoft\Windows NT\CurrentVersion)",
"DisplayVersion"
);
const std::string releaseId = getRegistryValue(
const std::string releaseId = GetRegistryValue(
HKEY_LOCAL_MACHINE,
R"(SOFTWARE\Microsoft\Windows NT\CurrentVersion)",
"ReleaseId"
);
const int buildNumber = stoi(getRegistryValue(
const int buildNumber = stoi(GetRegistryValue(
HKEY_LOCAL_MACHINE,
R"(SOFTWARE\Microsoft\Windows NT\CurrentVersion)",
"CurrentBuildNumber"
@ -158,7 +158,7 @@ std::string getPrettyWindowsName() {
int main() {
init_apartment();
u64 memInfo;
u64 memInfo = 0;
GetPhysicallyInstalledSystemMemory(&memInfo);
fmt::println("Installed RAM: {:.2f}", KBToGiB {memInfo});
@ -192,7 +192,7 @@ int main() {
fmt::println("{:%B} {}, {:%-I:%0M %p}", localTime, date, localTime);
fmt::println("Version: {}", getPrettyWindowsName());
fmt::println("Version: {}", GetPrettyWindowsName());
uninit_apartment();
return 0;