Formatting and fixes

This commit is contained in:
aristocratos 2021-08-04 00:11:50 +02:00
parent 102ed6179e
commit 95db0eaf90
7 changed files with 17 additions and 17 deletions

View File

@ -360,7 +360,7 @@ namespace Runner {
}
}
//* Stops any secondary thread running and unlocks config
//* Stops any secondary thread running
void stop() {
stopping = true;
atomic_wait(active);

View File

@ -68,7 +68,7 @@ namespace Config {
//* Set config key <name> to int <value>
inline void set(const string& name, const int& value) {
if (_locked(name)) intsTmp.insert_or_assign(name, value);
ints.at(name) = value;
else ints.at(name) = value;
}
//* Set config key <name> to string <value>

View File

@ -343,7 +343,7 @@ namespace Input {
}
}
//? Input actions for proc box
//? Input actions for cpu box
if (Cpu::shown) {
bool keep_going = false;
bool no_update = true;

View File

@ -65,7 +65,7 @@ namespace Cpu {
string get_cpuName();
//* Parse /proc/cpu info for mapping of core ids
unordered_flat_map<int, int> get_core_mapping();
auto get_core_mapping() -> unordered_flat_map<int, int>;
struct Sensor {
fs::path path;
@ -393,7 +393,7 @@ namespace Cpu {
return cpuhz;
}
unordered_flat_map<int, int> get_core_mapping() {
auto get_core_mapping() -> unordered_flat_map<int, int> {
unordered_flat_map<int, int> core_map;
ifstream cpuinfo("/proc/cpuinfo");
if (cpuinfo.good()) {
@ -442,7 +442,7 @@ namespace Cpu {
return core_map;
}
cpu_info collect(const bool no_update) {
auto collect(const bool no_update) -> cpu_info {
if (Runner::stopping or (no_update and not current_cpu.cpu_percent.at("total").empty())) return current_cpu;
auto& cpu = current_cpu;
@ -538,7 +538,7 @@ namespace Mem {
mem_info current_mem;
mem_info collect(const bool no_update) {
auto collect(const bool no_update) -> mem_info {
(void)no_update;
return current_mem;
}
@ -548,7 +548,7 @@ namespace Mem {
namespace Net {
net_info current_net;
net_info collect(const bool no_update) {
auto collect(const bool no_update) -> net_info {
(void)no_update;
return current_net;
}
@ -745,7 +745,7 @@ namespace Proc {
}
//* Collects and sorts process information from /proc
vector<proc_info> collect(const bool no_update) {
auto collect(const bool no_update) -> vector<proc_info> {
const auto& sorting = Config::getS("proc_sorting");
const auto& reverse = Config::getB("proc_reversed");
const auto& filter = Config::getS("proc_filter");

View File

@ -95,7 +95,7 @@ namespace Cpu {
};
//* Collect cpu stats and temperatures
cpu_info collect(const bool no_update=false);
auto collect(const bool no_update=false) -> cpu_info;
//* Draw contents of cpu box using <cpu> as source
string draw(const cpu_info& cpu, const bool force_redraw=false, const bool data_same=false);
@ -118,7 +118,7 @@ namespace Mem {
};
//* Collect mem & disks stats
mem_info collect(const bool no_update=false);
auto collect(const bool no_update=false) -> mem_info;
//* Draw contents of mem box using <mem> as source
string draw(const mem_info& mem, const bool force_redraw=false, const bool data_same=false);
@ -140,7 +140,7 @@ namespace Net {
};
//* Collect net upload/download stats
net_info collect(const bool no_update=false);
auto collect(const bool no_update=false) -> net_info;
//* Draw contents of net box using <net> as source
string draw(const net_info& net, const bool force_redraw=false, const bool data_same=false);
@ -190,7 +190,7 @@ namespace Proc {
extern detail_container detailed;
//* Collect and sort process information from /proc
vector<proc_info> collect(const bool no_update=false);
auto collect(const bool no_update=false) -> vector<proc_info>;
//* Update current selection and view, returns -1 if no change otherwise the current selection
int selection(const string& cmd_key);

View File

@ -163,7 +163,7 @@ namespace Tools {
return (string)str_v;
}
vector<string> ssplit(const string& str, const char& delim) {
auto ssplit(const string& str, const char& delim) -> vector<string> {
vector<string> out;
for (const auto& s : str | rng::views::split(delim)
| rng::views::transform([](auto &&rng) {
@ -307,7 +307,7 @@ namespace Tools {
return (out.empty() ? fallback : out);
}
tuple<long long, string> celsius_to(long long celsius, string scale) {
auto celsius_to(const long long& celsius, const string& scale) -> tuple<long long, string> {
if (scale == "celsius")
return {celsius, "°C"};
else if (scale == "fahrenheit")

View File

@ -217,7 +217,7 @@ namespace Tools {
}
//* Split <string> at all occurrences of <delim> and return as vector of strings
vector<string> ssplit(const string& str, const char& delim = ' ');
auto ssplit(const string& str, const char& delim = ' ') -> vector<string>;
//* Put current thread to sleep for <ms> milliseconds
inline void sleep_ms(const size_t& ms) { std::this_thread::sleep_for(std::chrono::milliseconds(ms)); }
@ -270,7 +270,7 @@ namespace Tools {
string readfile(const std::filesystem::path& path, const string& fallback="");
//* Convert a celsius value to celsius, fahrenheit, kelvin or rankin and return tuple with new value and unit.
tuple<long long, string> celsius_to(long long celsius, string scale);
auto celsius_to(const long long& celsius, const string& scale) -> tuple<long long, string>;
}