summaryrefslogtreecommitdiff
path: root/src/helpers
diff options
context:
space:
mode:
authorvaxerski <43317083+vaxerski@users.noreply.github.com>2022-05-05 12:50:25 +0200
committervaxerski <43317083+vaxerski@users.noreply.github.com>2022-05-05 12:50:25 +0200
commit8bb908a8da3be119cc64552d4fe8a23cdfb938b8 (patch)
tree9126a09a72bdcce560405a8f79315ec703021b55 /src/helpers
parentc7fd3d46fde472c2e6c2801c9aa7e9376656e235 (diff)
Added focusmonitor
Diffstat (limited to 'src/helpers')
-rw-r--r--src/helpers/MiscFunctions.cpp9
-rw-r--r--src/helpers/MiscFunctions.hpp2
2 files changed, 11 insertions, 0 deletions
diff --git a/src/helpers/MiscFunctions.cpp b/src/helpers/MiscFunctions.cpp
index 489fa02a..bf8724c6 100644
--- a/src/helpers/MiscFunctions.cpp
+++ b/src/helpers/MiscFunctions.cpp
@@ -1,5 +1,6 @@
#include "MiscFunctions.hpp"
#include "../defines.hpp"
+#include <algorithm>
void addWLSignal(wl_signal* pSignal, wl_listener* pListener, void* pOwner, std::string ownerString) {
ASSERT(pSignal);
@@ -111,4 +112,12 @@ float getPlusMinusKeywordResult(std::string source, float relative) {
}
return result;
+}
+
+bool isNumber(const std::string& str) {
+ return std::ranges::all_of(str.begin(), str.end(), [](char c) { return isdigit(c) != 0; });
+}
+
+bool isDirection(const std::string& arg) {
+ return arg == "l" || arg == "r" || arg == "u" || arg == "d" || arg == "t" || arg == "b";
} \ No newline at end of file
diff --git a/src/helpers/MiscFunctions.hpp b/src/helpers/MiscFunctions.hpp
index 4fb42e12..e7b207de 100644
--- a/src/helpers/MiscFunctions.hpp
+++ b/src/helpers/MiscFunctions.hpp
@@ -7,5 +7,7 @@ void wlr_signal_emit_safe(struct wl_signal *signal, void *data);
std::string getFormat(const char *fmt, ...); // Basically Debug::log to a string
void scaleBox(wlr_box*, float);
std::string removeBeginEndSpacesTabs(std::string);
+bool isNumber(const std::string&);
+bool isDirection(const std::string&);
float getPlusMinusKeywordResult(std::string in, float relative); \ No newline at end of file