aboutsummaryrefslogtreecommitdiff
path: root/app/source/Cplt/Model/Workflow/ValueInternals.hpp
diff options
context:
space:
mode:
authorrtk0c <[email protected]>2022-06-30 21:38:53 -0700
committerrtk0c <[email protected]>2022-06-30 21:38:53 -0700
commit7fe47a9d5b1727a61dc724523b530762f6d6ba19 (patch)
treee95be6e66db504ed06d00b72c579565bab873277 /app/source/Cplt/Model/Workflow/ValueInternals.hpp
parent2cf952088d375ac8b2f45b144462af0953436cff (diff)
Restructure project
Diffstat (limited to 'app/source/Cplt/Model/Workflow/ValueInternals.hpp')
-rw-r--r--app/source/Cplt/Model/Workflow/ValueInternals.hpp21
1 files changed, 21 insertions, 0 deletions
diff --git a/app/source/Cplt/Model/Workflow/ValueInternals.hpp b/app/source/Cplt/Model/Workflow/ValueInternals.hpp
new file mode 100644
index 0000000..45842db
--- /dev/null
+++ b/app/source/Cplt/Model/Workflow/ValueInternals.hpp
@@ -0,0 +1,21 @@
+// This file contains utility classes and macros for implementing values
+// As consumers, you should not include this header as it contains unnecessary symbols and can pollute your files
+// for this reason, classes here aren't forward-declared in fwd.hpp either.
+
+#pragma once
+
+#include <Cplt/Utils/RTTI.hpp>
+
+#include <utility>
+
+#define CHECK_VALUE_TYPE(Type, value) \
+ if (!is_a<Type>(value)) { \
+ return false; \
+ }
+
+#define CHECK_VALUE_TYPE_AND_MOVE(Type, dest, value) \
+ if (auto ptr = dyn_cast<Type>(value)) { \
+ dest = std::move(*ptr); \
+ } else { \
+ return false; \
+ }