diff --git a/CMakeLists.txt b/CMakeLists.txt index 5b46be5..ab28cef 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -7,7 +7,45 @@ if(NOT DEFINED CMAKE_BUILD_TYPE) endif() project(ElectraLang VERSION 1.0.0) -file(GLOB SOURCE_FILES "./src/*.cpp") +set(SOURCE_FILES + src/components/ArithmeticalUnit.cpp + src/components/Bomb.cpp + src/components/Cable.cpp + src/components/Cloner.cpp + src/components/CloningDynamicComponent.cpp + src/components/Component.cpp + src/components/ConditionalUnit.cpp + src/components/ConstantAdder.cpp + src/components/ConstantPusher.cpp + src/components/Eraser.cpp + src/components/FileCloser.cpp + src/components/FileOpener.cpp + src/components/FileReader.cpp + src/components/FileWriter.cpp + src/components/Key.cpp + src/components/NonCloningDynamicComponent.cpp + src/components/Portal.cpp + src/components/Printer.cpp + src/components/Reader.cpp + src/components/Reverser.cpp + src/components/StackChecker.cpp + src/components/StackSwitcher.cpp + src/components/Swapper.cpp + + src/utility/Argparser.cpp + src/utility/FileDescriptorManager.cpp + src/utility/Global.cpp + src/utility/LineRange.cpp + src/utility/Logger.cpp + src/utility/StringUtilities.cpp + + src/Current.cpp + src/Direction.cpp + src/Electra.cpp + src/Generator.cpp + src/main.cpp +) + add_executable(${TARGET_BINARY_NAME} ${SOURCE_FILES}) target_include_directories(${TARGET_BINARY_NAME} PUBLIC include) diff --git a/include/Current.hpp b/include/Current.hpp index 56b5426..6f8de14 100644 --- a/include/Current.hpp +++ b/include/Current.hpp @@ -26,8 +26,8 @@ SOFTWARE. #include #include -#include "Direction.hpp" -#include "Global.hpp" +#include +#include // Instruction pointers of Electra class Current @@ -58,4 +58,4 @@ class Current Direction m_direction = Direction::NONE; Position m_position = {0, 0}; std::stack m_visitedPortalStack{}; -}; \ No newline at end of file +}; diff --git a/include/Electra.hpp b/include/Electra.hpp index 1cdc0d1..e488dcb 100644 --- a/include/Electra.hpp +++ b/include/Electra.hpp @@ -35,10 +35,10 @@ SOFTWARE. #include #include -#include +#include #include -#include -#include +#include +#include #include typedef std::vector GeneratorData; @@ -148,4 +148,4 @@ class Electra // Signal handling. static void sigHandler([[maybe_unused]] int signal); -}; \ No newline at end of file +}; diff --git a/include/ArithmeticalUnit.hpp b/include/components/ArithmeticalUnit.hpp similarity index 98% rename from include/ArithmeticalUnit.hpp rename to include/components/ArithmeticalUnit.hpp index e24d225..18375a0 100644 --- a/include/ArithmeticalUnit.hpp +++ b/include/components/ArithmeticalUnit.hpp @@ -25,7 +25,7 @@ SOFTWARE. #pragma once #include -#include +#include // Pops 2 values from current's stackPtr and passes them into m_func. Then pushes result back to the same stack. // The first parameter that is popped is the first argument of m_func @@ -41,4 +41,4 @@ class ArithmeticalUnit : public Cable bool work(Current::Ptr current, std::vector& currentVector) override; private: ArithmeticalFunc m_func; -}; \ No newline at end of file +}; diff --git a/include/Bomb.hpp b/include/components/Bomb.hpp similarity index 97% rename from include/Bomb.hpp rename to include/components/Bomb.hpp index 32d23e3..b91ad8c 100644 --- a/include/Bomb.hpp +++ b/include/components/Bomb.hpp @@ -23,7 +23,7 @@ SOFTWARE. */ #pragma once -#include +#include // Ends the program. class Bomb : public Cable @@ -33,4 +33,4 @@ class Bomb : public Cable ~Bomb() override = default; bool work(Current::Ptr current, std::vector& currentVector) override; -}; \ No newline at end of file +}; diff --git a/include/Cable.hpp b/include/components/Cable.hpp similarity index 97% rename from include/Cable.hpp rename to include/components/Cable.hpp index 047eec3..dfff0ac 100644 --- a/include/Cable.hpp +++ b/include/components/Cable.hpp @@ -23,7 +23,7 @@ SOFTWARE. */ #pragma once -#include +#include // Clones the currents if the cable is multi-directional. class Cable : public Component @@ -35,4 +35,4 @@ class Cable : public Component bool work(Current::Ptr current, std::vector& currentVector) override; private: bool m_is_one_directional = false; -}; \ No newline at end of file +}; diff --git a/include/Cloner.hpp b/include/components/Cloner.hpp similarity index 97% rename from include/Cloner.hpp rename to include/components/Cloner.hpp index 28c3198..e222513 100644 --- a/include/Cloner.hpp +++ b/include/components/Cloner.hpp @@ -23,7 +23,7 @@ SOFTWARE. */ #pragma once -#include +#include // Pops the top value of the current's stackPtr and pushes it back onto same stack twice. // If there are no values on the stack it does nothing. @@ -34,4 +34,4 @@ class Cloner : public Cable ~Cloner() override = default; bool work(Current::Ptr current, std::vector& currentVector) override; -}; \ No newline at end of file +}; diff --git a/include/CloningDynamicComponent.hpp b/include/components/CloningDynamicComponent.hpp similarity index 97% rename from include/CloningDynamicComponent.hpp rename to include/components/CloningDynamicComponent.hpp index 180b94e..4af4811 100644 --- a/include/CloningDynamicComponent.hpp +++ b/include/components/CloningDynamicComponent.hpp @@ -25,7 +25,7 @@ SOFTWARE. #pragma once #include -#include +#include class CloningDynamicComponent : public Cable { @@ -38,4 +38,4 @@ class CloningDynamicComponent : public Cable bool work(Current::Ptr current, std::vector& currentVector) override; private: WorkFunctionType m_workFunc; -}; \ No newline at end of file +}; diff --git a/include/Component.hpp b/include/components/Component.hpp similarity index 100% rename from include/Component.hpp rename to include/components/Component.hpp diff --git a/include/ConditionalUnit.hpp b/include/components/ConditionalUnit.hpp similarity index 98% rename from include/ConditionalUnit.hpp rename to include/components/ConditionalUnit.hpp index 7e2d03f..8e00573 100644 --- a/include/ConditionalUnit.hpp +++ b/include/components/ConditionalUnit.hpp @@ -23,7 +23,7 @@ SOFTWARE. */ #pragma once -#include +#include // Pops the value on top of the current's stackPtr, and compares it with m_targetValue. If the result is true, lets current pass. // Otherwise, kills the current. Inverted Conditional units does the opposite. @@ -40,4 +40,4 @@ class ConditionalUnit : public Cable bool m_checkEqual; bool m_checkLess; bool m_checkGreater; -}; \ No newline at end of file +}; diff --git a/include/ConstantAdder.hpp b/include/components/ConstantAdder.hpp similarity index 97% rename from include/ConstantAdder.hpp rename to include/components/ConstantAdder.hpp index 3b20774..48c0496 100644 --- a/include/ConstantAdder.hpp +++ b/include/components/ConstantAdder.hpp @@ -23,7 +23,7 @@ SOFTWARE. */ #pragma once -#include +#include // Pops the value on top of the current's stackPtr adds m_constant to it and pushes it back to the current's stackPtr. // If there is no value on the current's stackPtr, it does nothing. @@ -36,4 +36,4 @@ class ConstantAdder : public Cable bool work(Current::Ptr current, std::vector& currentVector) override; private: var_t m_constant; -}; \ No newline at end of file +}; diff --git a/include/ConstantPusher.hpp b/include/components/ConstantPusher.hpp similarity index 97% rename from include/ConstantPusher.hpp rename to include/components/ConstantPusher.hpp index a4ff62d..930da49 100644 --- a/include/ConstantPusher.hpp +++ b/include/components/ConstantPusher.hpp @@ -23,7 +23,7 @@ SOFTWARE. */ #pragma once -#include +#include // Pushes m_constant to the current's stackPtr. class ConstantPusher : public Cable @@ -35,4 +35,4 @@ class ConstantPusher : public Cable bool work(Current::Ptr current, std::vector& currentVector) override; private: var_t m_constant; -}; \ No newline at end of file +}; diff --git a/include/Eraser.hpp b/include/components/Eraser.hpp similarity index 97% rename from include/Eraser.hpp rename to include/components/Eraser.hpp index ba4ecaf..101fb00 100644 --- a/include/Eraser.hpp +++ b/include/components/Eraser.hpp @@ -23,7 +23,7 @@ SOFTWARE. */ #pragma once -#include +#include // Pops the top value from the current's stackPtr. class Eraser : public Cable @@ -33,4 +33,4 @@ class Eraser : public Cable ~Eraser() override = default; bool work(Current::Ptr current, std::vector& currentVector) override; -}; \ No newline at end of file +}; diff --git a/include/FileCloser.hpp b/include/components/FileCloser.hpp similarity index 97% rename from include/FileCloser.hpp rename to include/components/FileCloser.hpp index 5e208c2..50bbb48 100644 --- a/include/FileCloser.hpp +++ b/include/components/FileCloser.hpp @@ -22,7 +22,7 @@ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ #pragma once -#include +#include class FileCloser : public Cable { @@ -31,4 +31,4 @@ class FileCloser : public Cable ~FileCloser() override = default; bool work(Current::Ptr current, std::vector& currentVector) override; -}; \ No newline at end of file +}; diff --git a/include/FileOpener.hpp b/include/components/FileOpener.hpp similarity index 97% rename from include/FileOpener.hpp rename to include/components/FileOpener.hpp index 49b26c5..e2a7472 100644 --- a/include/FileOpener.hpp +++ b/include/components/FileOpener.hpp @@ -22,7 +22,7 @@ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ #pragma once -#include +#include class FileOpener : public Cable { @@ -33,4 +33,4 @@ class FileOpener : public Cable bool work(Current::Ptr current, std::vector& currentVector) override; private: bool m_appendMode; -}; \ No newline at end of file +}; diff --git a/include/FileReader.hpp b/include/components/FileReader.hpp similarity index 97% rename from include/FileReader.hpp rename to include/components/FileReader.hpp index 961659c..32ca497 100644 --- a/include/FileReader.hpp +++ b/include/components/FileReader.hpp @@ -23,7 +23,7 @@ SOFTWARE. */ #pragma once -#include +#include class FileReader : public Cable { @@ -32,4 +32,4 @@ class FileReader : public Cable ~FileReader() override = default; bool work(Current::Ptr current, std::vector& currentVector) override; -}; \ No newline at end of file +}; diff --git a/include/FileWriter.hpp b/include/components/FileWriter.hpp similarity index 97% rename from include/FileWriter.hpp rename to include/components/FileWriter.hpp index a2d51ff..e0a3f67 100644 --- a/include/FileWriter.hpp +++ b/include/components/FileWriter.hpp @@ -22,7 +22,7 @@ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ #pragma once -#include +#include class FileWriter : public Cable { @@ -31,4 +31,4 @@ class FileWriter : public Cable ~FileWriter() override = default; bool work(Current::Ptr current, std::vector& currentVector) override; -}; \ No newline at end of file +}; diff --git a/include/Key.hpp b/include/components/Key.hpp similarity index 97% rename from include/Key.hpp rename to include/components/Key.hpp index efd539e..102b79a 100644 --- a/include/Key.hpp +++ b/include/components/Key.hpp @@ -23,7 +23,7 @@ SOFTWARE. */ #pragma once -#include +#include #include // Holds flown currents still until it is activated. To activate a key, a current has to touch it from its activator directions. @@ -38,4 +38,4 @@ class Key : public Cable std::vector m_activatorDirections; std::vector& m_sourceCode; char32_t m_transformTo; -}; \ No newline at end of file +}; diff --git a/include/NonCloningDynamicComponent.hpp b/include/components/NonCloningDynamicComponent.hpp similarity index 97% rename from include/NonCloningDynamicComponent.hpp rename to include/components/NonCloningDynamicComponent.hpp index 85eb5ff..62b47fd 100644 --- a/include/NonCloningDynamicComponent.hpp +++ b/include/components/NonCloningDynamicComponent.hpp @@ -25,7 +25,7 @@ SOFTWARE. #pragma once #include -#include +#include class NonCloningDynamicComponent : public Component { @@ -38,4 +38,4 @@ class NonCloningDynamicComponent : public Component bool work(Current::Ptr current, std::vector& currentVector) override; private: WorkFunctionType m_workFunc; -}; \ No newline at end of file +}; diff --git a/include/Portal.hpp b/include/components/Portal.hpp similarity index 97% rename from include/Portal.hpp rename to include/components/Portal.hpp index 14a95a5..65a68e1 100644 --- a/include/Portal.hpp +++ b/include/components/Portal.hpp @@ -23,7 +23,7 @@ SOFTWARE. */ #pragma once -#include +#include // Teleports currents around. class Portal : public Component @@ -35,4 +35,4 @@ class Portal : public Component bool work(Current::Ptr current, std::vector& currentVector) override; private: Position m_originalPosition; -}; \ No newline at end of file +}; diff --git a/include/Printer.hpp b/include/components/Printer.hpp similarity index 97% rename from include/Printer.hpp rename to include/components/Printer.hpp index 76e41d3..c303069 100644 --- a/include/Printer.hpp +++ b/include/components/Printer.hpp @@ -23,7 +23,7 @@ SOFTWARE. */ #pragma once -#include +#include // Pops the value on top of the current's stackPtr and prints it on screen as number. If m_printAsUchar is true it prints it as a char_t. // If there is no top value, it does nothing. @@ -36,4 +36,4 @@ class Printer : public Cable bool work(Current::Ptr current, std::vector& currentVector) override; private: bool m_printAsChar = false; -}; \ No newline at end of file +}; diff --git a/include/Reader.hpp b/include/components/Reader.hpp similarity index 97% rename from include/Reader.hpp rename to include/components/Reader.hpp index a5fc1b9..e2c2bed 100644 --- a/include/Reader.hpp +++ b/include/components/Reader.hpp @@ -23,7 +23,7 @@ SOFTWARE. */ #pragma once -#include +#include // Takes input from user and pushes it on top of the current's stackPtr. class Reader : public Cable @@ -35,4 +35,4 @@ class Reader : public Cable bool work(Current::Ptr current, std::vector& currentVector) override; private: bool m_getInputAsChar = false; -}; \ No newline at end of file +}; diff --git a/include/Reverser.hpp b/include/components/Reverser.hpp similarity index 97% rename from include/Reverser.hpp rename to include/components/Reverser.hpp index 8f2790d..fc1df99 100644 --- a/include/Reverser.hpp +++ b/include/components/Reverser.hpp @@ -23,7 +23,7 @@ SOFTWARE. */ #pragma once -#include +#include // Reverses the current's stackPtr. class Reverser : public Cable @@ -33,4 +33,4 @@ class Reverser : public Cable ~Reverser() override = default; bool work(Current::Ptr current, std::vector& currentVector) override; -}; \ No newline at end of file +}; diff --git a/include/StackChecker.hpp b/include/components/StackChecker.hpp similarity index 97% rename from include/StackChecker.hpp rename to include/components/StackChecker.hpp index 3adc26b..81aeaa4 100644 --- a/include/StackChecker.hpp +++ b/include/components/StackChecker.hpp @@ -23,7 +23,7 @@ SOFTWARE. */ #pragma once -#include +#include // Checks if the current's stackPtr is empty or not. class StackChecker : public Cable @@ -35,4 +35,4 @@ class StackChecker : public Cable bool work(Current::Ptr current, std::vector& currentVector) override; private: bool m_passIfEmpty = false; -}; \ No newline at end of file +}; diff --git a/include/StackSwitcher.hpp b/include/components/StackSwitcher.hpp similarity index 98% rename from include/StackSwitcher.hpp rename to include/components/StackSwitcher.hpp index 77a3038..022343c 100644 --- a/include/StackSwitcher.hpp +++ b/include/components/StackSwitcher.hpp @@ -23,7 +23,7 @@ SOFTWARE. */ #pragma once -#include +#include // Moves current's stackPtr pointer forwards or backwards. // If moveValue is true, it pops the top value before moving the stackPtr and pushes that value to the new stack after moving. @@ -39,4 +39,4 @@ class StackSwitcher : public Cable std::vector>* m_stacks; bool m_moveForward = true; bool m_moveValue = false; -}; \ No newline at end of file +}; diff --git a/include/Swapper.hpp b/include/components/Swapper.hpp similarity index 97% rename from include/Swapper.hpp rename to include/components/Swapper.hpp index 83f2637..b037eb2 100644 --- a/include/Swapper.hpp +++ b/include/components/Swapper.hpp @@ -23,7 +23,7 @@ SOFTWARE. */ #pragma once -#include +#include // Swaps the top two values of the current's stackPtr of the current. // If there is less than two values on current's stackPtr it does nothing. @@ -34,4 +34,4 @@ class Swapper : public Cable ~Swapper() override = default; bool work(Current::Ptr current, std::vector& currentVector) override; -}; \ No newline at end of file +}; diff --git a/include/ArgParser.hpp b/include/utility/ArgParser.hpp similarity index 100% rename from include/ArgParser.hpp rename to include/utility/ArgParser.hpp diff --git a/include/ComponentInformation.hpp b/include/utility/ComponentInformation.hpp similarity index 100% rename from include/ComponentInformation.hpp rename to include/utility/ComponentInformation.hpp diff --git a/include/FileDescriptorManager.hpp b/include/utility/FileDescriptorManager.hpp similarity index 100% rename from include/FileDescriptorManager.hpp rename to include/utility/FileDescriptorManager.hpp diff --git a/include/Global.hpp b/include/utility/Global.hpp similarity index 100% rename from include/Global.hpp rename to include/utility/Global.hpp diff --git a/include/LineRange.hpp b/include/utility/LineRange.hpp similarity index 100% rename from include/LineRange.hpp rename to include/utility/LineRange.hpp diff --git a/include/Logger.hpp b/include/utility/Logger.hpp similarity index 97% rename from include/Logger.hpp rename to include/utility/Logger.hpp index 59bf01d..0efe69e 100644 --- a/include/Logger.hpp +++ b/include/utility/Logger.hpp @@ -25,8 +25,8 @@ SOFTWARE. #pragma once #include #include -#include -#include +#include +#include #ifdef ERROR #undef ERROR diff --git a/include/StringUtilities.hpp b/include/utility/StringUtilities.hpp similarity index 98% rename from include/StringUtilities.hpp rename to include/utility/StringUtilities.hpp index 2c43f2f..6f185c3 100644 --- a/include/StringUtilities.hpp +++ b/include/utility/StringUtilities.hpp @@ -27,7 +27,7 @@ SOFTWARE. #include #include #include -#include +#include #include #include #include diff --git a/src/Electra.cpp b/src/Electra.cpp index 9e5a6ef..b7608c7 100644 --- a/src/Electra.cpp +++ b/src/Electra.cpp @@ -29,29 +29,29 @@ SOFTWARE. #include #include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include using namespace std::string_literals; Electra::Electra(): @@ -784,4 +784,4 @@ void Electra::createCurrents() void Electra::sigHandler([[maybe_unused]] int signal) { Global::safe_exit(1); -} \ No newline at end of file +} diff --git a/src/Generator.cpp b/src/Generator.cpp index b8d48c1..c9e028c 100644 --- a/src/Generator.cpp +++ b/src/Generator.cpp @@ -23,7 +23,7 @@ SOFTWARE. */ #include -#include +#include Generator::Generator(const std::vector& directions, Position position): m_directions(directions), m_position(position) @@ -50,4 +50,4 @@ const std::vector& Generator::getDirections() const std::vector& Generator::getDirections() { return m_directions; -} \ No newline at end of file +} diff --git a/src/ArithmeticalUnit.cpp b/src/components/ArithmeticalUnit.cpp similarity index 96% rename from src/ArithmeticalUnit.cpp rename to src/components/ArithmeticalUnit.cpp index ea442c3..ba8442e 100644 --- a/src/ArithmeticalUnit.cpp +++ b/src/components/ArithmeticalUnit.cpp @@ -22,8 +22,8 @@ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ -#include -#include +#include +#include ArithmeticalUnit::ArithmeticalUnit(const std::vector& directions, ArithmeticalFunc func): Cable(directions), m_func(std::move(func)) @@ -48,4 +48,4 @@ bool ArithmeticalUnit::work(Current::Ptr current, std::vector& cur defaultLogger.log(LogType::INFO, "(ArithmeticalUnit) Passing {} and {} into an arithmetical unit. The result is: {}", first, second, result); return Cable::work(current, currentVector); -} \ No newline at end of file +} diff --git a/src/Bomb.cpp b/src/components/Bomb.cpp similarity index 95% rename from src/Bomb.cpp rename to src/components/Bomb.cpp index 14a1810..85c721a 100644 --- a/src/Bomb.cpp +++ b/src/components/Bomb.cpp @@ -22,8 +22,8 @@ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ -#include -#include +#include +#include Bomb::Bomb(const std::vector& directions): Cable(directions) @@ -39,4 +39,4 @@ bool Bomb::work(Current::Ptr current, std::vector& currentVector) defaultLogger.log(LogType::INFO, "(Bomb) Ending the program."); Global::safe_exit(0); return Cable::work(current, currentVector); -} \ No newline at end of file +} diff --git a/src/Cable.cpp b/src/components/Cable.cpp similarity index 97% rename from src/Cable.cpp rename to src/components/Cable.cpp index 31f47f6..f0cc6e7 100644 --- a/src/Cable.cpp +++ b/src/components/Cable.cpp @@ -22,8 +22,8 @@ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ -#include -#include +#include +#include Cable::Cable(const std::vector& directions, bool is_one_directional): Component(directions), m_is_one_directional(is_one_directional) @@ -57,4 +57,4 @@ bool Cable::work(Current::Ptr current, std::vector& currentVector) } return m_is_one_directional || (std::find(m_directions.begin(), m_directions.end(), currentDir) != m_directions.end()); -} \ No newline at end of file +} diff --git a/src/Cloner.cpp b/src/components/Cloner.cpp similarity index 96% rename from src/Cloner.cpp rename to src/components/Cloner.cpp index ff59630..c5aa8fe 100644 --- a/src/Cloner.cpp +++ b/src/components/Cloner.cpp @@ -22,8 +22,8 @@ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ -#include -#include +#include +#include Cloner::Cloner(const std::vector& directions): Cable(directions) @@ -46,4 +46,4 @@ bool Cloner::work(Current::Ptr current, std::vector& currentVector defaultLogger.log(LogType::INFO, "(Cloner) Pushing {} to stack.", top); return Cable::work(current, currentVector); -} \ No newline at end of file +} diff --git a/src/CloningDynamicComponent.cpp b/src/components/CloningDynamicComponent.cpp similarity index 95% rename from src/CloningDynamicComponent.cpp rename to src/components/CloningDynamicComponent.cpp index 0bd402a..8d90054 100644 --- a/src/CloningDynamicComponent.cpp +++ b/src/components/CloningDynamicComponent.cpp @@ -21,8 +21,9 @@ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ -#include -#include + +#include +#include CloningDynamicComponent::CloningDynamicComponent(const std::vector& directions, const CloningDynamicComponent::WorkFunctionType& workFunction): Cable(directions), m_workFunc(workFunction) @@ -40,4 +41,4 @@ bool CloningDynamicComponent::work(Current::Ptr current, std::vector +#include Component::Component(const std::vector& directions): m_directions(directions) @@ -38,4 +38,4 @@ bool Component::work(Current::Ptr current, std::vector& currentVec } } return false; -} \ No newline at end of file +} diff --git a/src/ConditionalUnit.cpp b/src/components/ConditionalUnit.cpp similarity index 96% rename from src/ConditionalUnit.cpp rename to src/components/ConditionalUnit.cpp index 1dad9eb..fceb1b4 100644 --- a/src/ConditionalUnit.cpp +++ b/src/components/ConditionalUnit.cpp @@ -22,8 +22,8 @@ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ -#include -#include +#include +#include ConditionalUnit::ConditionalUnit(const std::vector& directions, var_t targetValue, bool isInverted, bool checkEqual, bool checkLess, bool checkGreater): @@ -51,4 +51,4 @@ bool ConditionalUnit::work(Current::Ptr current, std::vector& curr defaultLogger.log(LogType::INFO, "(ConditionalUnit) Comparing {} with {}. Result: {}. (invert: {}, checkequal: {}, checkless: {}, checkgreater: {})", top, m_targetValue, result, m_inverted, m_checkEqual, m_checkLess, m_checkGreater); return result && Cable::work(current, currentVector); -} \ No newline at end of file +} diff --git a/src/ConstantAdder.cpp b/src/components/ConstantAdder.cpp similarity index 96% rename from src/ConstantAdder.cpp rename to src/components/ConstantAdder.cpp index 922e8f4..dd27b19 100644 --- a/src/ConstantAdder.cpp +++ b/src/components/ConstantAdder.cpp @@ -22,8 +22,8 @@ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ -#include -#include +#include +#include ConstantAdder::ConstantAdder(const std::vector& directions, var_t constant): Cable(directions), m_constant(constant) @@ -47,4 +47,4 @@ bool ConstantAdder::work(Current::Ptr current, std::vector& curren defaultLogger.log(LogType::INFO, "(ConstantAdder) Added {} to the top value.", m_constant); return Cable::work(current, currentVector); -} \ No newline at end of file +} diff --git a/src/ConstantPusher.cpp b/src/components/ConstantPusher.cpp similarity index 95% rename from src/ConstantPusher.cpp rename to src/components/ConstantPusher.cpp index 89f3941..afe9177 100644 --- a/src/ConstantPusher.cpp +++ b/src/components/ConstantPusher.cpp @@ -22,8 +22,8 @@ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ -#include -#include +#include +#include ConstantPusher::ConstantPusher(const std::vector& directions, var_t constant): Cable(directions), m_constant(constant) @@ -39,4 +39,4 @@ bool ConstantPusher::work(Current::Ptr current, std::vector& curre current->stackPtr->push(m_constant); defaultLogger.log(LogType::INFO, "(ConstantPusher) Pushed {} to the stack.", m_constant); return Cable::work(current, currentVector); -} \ No newline at end of file +} diff --git a/src/Eraser.cpp b/src/components/Eraser.cpp similarity index 96% rename from src/Eraser.cpp rename to src/components/Eraser.cpp index 47d6e26..38e8325 100644 --- a/src/Eraser.cpp +++ b/src/components/Eraser.cpp @@ -22,8 +22,8 @@ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ -#include -#include +#include +#include Eraser::Eraser(const std::vector& directions): Cable(directions) @@ -44,4 +44,4 @@ bool Eraser::work(Current::Ptr current, std::vector& currentVector var_t popped_value = Global::popStack(current->stackPtr); defaultLogger.log(LogType::INFO, "(Eraser) Removed {} from stack.", popped_value); return Cable::work(current, currentVector); -} \ No newline at end of file +} diff --git a/src/FileCloser.cpp b/src/components/FileCloser.cpp similarity index 94% rename from src/FileCloser.cpp rename to src/components/FileCloser.cpp index 38005f5..b8ecd7c 100644 --- a/src/FileCloser.cpp +++ b/src/components/FileCloser.cpp @@ -21,9 +21,10 @@ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ -#include -#include -#include + +#include +#include +#include FileCloser::FileCloser(const std::vector& directions): Cable(directions) @@ -54,4 +55,4 @@ bool FileCloser::work(Current::Ptr current, std::vector& currentVe } return Cable::work(current, currentVector); -} \ No newline at end of file +} diff --git a/src/FileOpener.cpp b/src/components/FileOpener.cpp similarity index 95% rename from src/FileOpener.cpp rename to src/components/FileOpener.cpp index 7bd98ec..5d43214 100644 --- a/src/FileOpener.cpp +++ b/src/components/FileOpener.cpp @@ -21,9 +21,10 @@ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ -#include -#include -#include + +#include +#include +#include FileOpener::FileOpener(const std::vector& directions, bool appendMode): Cable(directions), m_appendMode(appendMode) @@ -71,4 +72,4 @@ bool FileOpener::work(Current::Ptr current, std::vector& currentVe current->stackPtr->push( static_cast(fileId.value_or(0)) ); return Cable::work(current, currentVector); -} \ No newline at end of file +} diff --git a/src/FileReader.cpp b/src/components/FileReader.cpp similarity index 97% rename from src/FileReader.cpp rename to src/components/FileReader.cpp index 9796e9c..9eceaf6 100644 --- a/src/FileReader.cpp +++ b/src/components/FileReader.cpp @@ -21,11 +21,12 @@ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ + #include #include -#include -#include +#include +#include FileReader::FileReader(const std::vector& directions): Cable(directions) diff --git a/src/FileWriter.cpp b/src/components/FileWriter.cpp similarity index 95% rename from src/FileWriter.cpp rename to src/components/FileWriter.cpp index 76ff670..8ed0635 100644 --- a/src/FileWriter.cpp +++ b/src/components/FileWriter.cpp @@ -21,9 +21,10 @@ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ -#include -#include -#include + +#include +#include +#include FileWriter::FileWriter(const std::vector& directions): Cable(directions) diff --git a/src/Key.cpp b/src/components/Key.cpp similarity index 97% rename from src/Key.cpp rename to src/components/Key.cpp index 67019c0..367c5de 100644 --- a/src/Key.cpp +++ b/src/components/Key.cpp @@ -22,8 +22,8 @@ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ -#include -#include +#include +#include Key::Key(const std::vector& directions, const std::vector& activatorDirections, std::vector& sourceCode, char32_t transformTo): Cable(directions), m_activatorDirections(activatorDirections), m_sourceCode(sourceCode), m_transformTo(transformTo) @@ -62,4 +62,4 @@ bool Key::work(Current::Ptr current, std::vector& currentVector) defaultLogger.log(LogType::INFO, "(Key) Key at ({}, {}) is not activated. The current is being moved to ({}, {})", curPos.x, curPos.y, newPos.x, newPos.y); return Cable::work(current, currentVector); -} \ No newline at end of file +} diff --git a/src/NonCloningDynamicComponent.cpp b/src/components/NonCloningDynamicComponent.cpp similarity index 96% rename from src/NonCloningDynamicComponent.cpp rename to src/components/NonCloningDynamicComponent.cpp index dc3272e..ed8ccd2 100644 --- a/src/NonCloningDynamicComponent.cpp +++ b/src/components/NonCloningDynamicComponent.cpp @@ -21,7 +21,8 @@ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ -#include + +#include NonCloningDynamicComponent::NonCloningDynamicComponent(const std::vector& directions, const NonCloningDynamicComponent::WorkFunctionType& workFunction): Component(directions), m_workFunc(workFunction) @@ -39,4 +40,4 @@ bool NonCloningDynamicComponent::work(Current::Ptr current, std::vector -#include +#include +#include Portal::Portal(Position originalPosition): Component({Direction::EAST, Direction::NORTHEAST, Direction::NORTH, Direction::NORTHWEST, Direction::WEST, Direction::SOUTHWEST, Direction::SOUTH, Direction::SOUTHEAST}), m_originalPosition(originalPosition) @@ -60,4 +60,4 @@ bool Portal::work(Current::Ptr current, std::vector& currentVector } return false; -} \ No newline at end of file +} diff --git a/src/Printer.cpp b/src/components/Printer.cpp similarity index 97% rename from src/Printer.cpp rename to src/components/Printer.cpp index 114707c..2ed3f8e 100644 --- a/src/Printer.cpp +++ b/src/components/Printer.cpp @@ -24,8 +24,8 @@ SOFTWARE. #include -#include -#include +#include +#include Printer::Printer(const std::vector& directions, bool printAsChar): Cable(directions), m_printAsChar(printAsChar) diff --git a/src/Reader.cpp b/src/components/Reader.cpp similarity index 97% rename from src/Reader.cpp rename to src/components/Reader.cpp index ee63715..ae59814 100644 --- a/src/Reader.cpp +++ b/src/components/Reader.cpp @@ -25,8 +25,8 @@ SOFTWARE. #include #include -#include -#include +#include +#include Reader::Reader(const std::vector& directions, bool getInputAsChar): Cable(directions), m_getInputAsChar(getInputAsChar) diff --git a/src/Reverser.cpp b/src/components/Reverser.cpp similarity index 96% rename from src/Reverser.cpp rename to src/components/Reverser.cpp index b2363fa..2c198e6 100644 --- a/src/Reverser.cpp +++ b/src/components/Reverser.cpp @@ -22,8 +22,8 @@ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ -#include -#include +#include +#include Reverser::Reverser(const std::vector& directions): Cable(directions) @@ -46,4 +46,4 @@ bool Reverser::work(Current::Ptr current, std::vector& currentVect defaultLogger.log(LogType::INFO, "(Reverser) Reversed the entire stack."); return Cable::work(current, currentVector); -} \ No newline at end of file +} diff --git a/src/StackChecker.cpp b/src/components/StackChecker.cpp similarity index 96% rename from src/StackChecker.cpp rename to src/components/StackChecker.cpp index 978ecc2..5b1aec9 100644 --- a/src/StackChecker.cpp +++ b/src/components/StackChecker.cpp @@ -22,8 +22,8 @@ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ -#include -#include +#include +#include StackChecker::StackChecker(const std::vector& directions, bool passIfEmpty): Cable(directions), m_passIfEmpty(passIfEmpty) @@ -60,4 +60,4 @@ bool StackChecker::work(Current::Ptr current, std::vector& current } return !m_passIfEmpty && Cable::work(current, currentVector); -} \ No newline at end of file +} diff --git a/src/StackSwitcher.cpp b/src/components/StackSwitcher.cpp similarity index 97% rename from src/StackSwitcher.cpp rename to src/components/StackSwitcher.cpp index 2da44a2..f3ac71b 100644 --- a/src/StackSwitcher.cpp +++ b/src/components/StackSwitcher.cpp @@ -24,8 +24,8 @@ SOFTWARE. #include -#include -#include +#include +#include StackSwitcher::StackSwitcher(const std::vector& directions, bool moveForward, std::vector>* stacks, bool moveValue): Cable(directions), m_moveForward(moveForward), m_stacks(stacks), m_moveValue(moveValue) @@ -82,4 +82,4 @@ bool StackSwitcher::work(Current::Ptr current, std::vector& curren defaultLogger.log(LogType::INFO, message, forwardBackwardMessage); return Cable::work(current, currentVector); -} \ No newline at end of file +} diff --git a/src/Swapper.cpp b/src/components/Swapper.cpp similarity index 96% rename from src/Swapper.cpp rename to src/components/Swapper.cpp index cbf2386..753449c 100644 --- a/src/Swapper.cpp +++ b/src/components/Swapper.cpp @@ -22,8 +22,8 @@ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ -#include -#include +#include +#include Swapper::Swapper(const std::vector& directions): Cable(directions) @@ -50,4 +50,4 @@ bool Swapper::work(Current::Ptr current, std::vector& currentVecto defaultLogger.log(LogType::INFO, "(Swapper) Swapping {} and {} on the stack.", first, second); return Cable::work(current, currentVector); -} \ No newline at end of file +} diff --git a/src/Argparser.cpp b/src/utility/Argparser.cpp similarity index 99% rename from src/Argparser.cpp rename to src/utility/Argparser.cpp index 018e03a..be41c46 100644 --- a/src/Argparser.cpp +++ b/src/utility/Argparser.cpp @@ -24,7 +24,7 @@ SOFTWARE. #include -#include +#include ArgParser::ArgParser(const std::vector& args): diff --git a/src/FileDescriptorManager.cpp b/src/utility/FileDescriptorManager.cpp similarity index 97% rename from src/FileDescriptorManager.cpp rename to src/utility/FileDescriptorManager.cpp index 906f710..d8af8e0 100644 --- a/src/FileDescriptorManager.cpp +++ b/src/utility/FileDescriptorManager.cpp @@ -21,7 +21,8 @@ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ -#include + +#include std::unordered_map FileDescriptorManager::fstreamMap{}; diff --git a/src/Global.cpp b/src/utility/Global.cpp similarity index 96% rename from src/Global.cpp rename to src/utility/Global.cpp index 0b9e2f3..00b3d5b 100644 --- a/src/Global.cpp +++ b/src/utility/Global.cpp @@ -22,8 +22,9 @@ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ -#include -#include +#include + +#include namespace Global { diff --git a/src/LineRange.cpp b/src/utility/LineRange.cpp similarity index 98% rename from src/LineRange.cpp rename to src/utility/LineRange.cpp index ff87173..7e876ac 100644 --- a/src/LineRange.cpp +++ b/src/utility/LineRange.cpp @@ -22,7 +22,7 @@ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ -#include "LineRange.hpp" +#include LineRange::LineRange(): m_begin(1), m_end(std::numeric_limits::max()) @@ -71,4 +71,4 @@ void LineRange::setEnd(std::size_t end) std::strong_ordering LineRange::operator<=>(const LineRange& other) const { return m_begin <=> other.m_begin; -} \ No newline at end of file +} diff --git a/src/Logger.cpp b/src/utility/Logger.cpp similarity index 98% rename from src/Logger.cpp rename to src/utility/Logger.cpp index 924ca37..0c27778 100644 --- a/src/Logger.cpp +++ b/src/utility/Logger.cpp @@ -22,7 +22,7 @@ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ -#include +#include #include Logger::Logger() diff --git a/src/StringUtilities.cpp b/src/utility/StringUtilities.cpp similarity index 99% rename from src/StringUtilities.cpp rename to src/utility/StringUtilities.cpp index e0e25de..6650d72 100644 --- a/src/StringUtilities.cpp +++ b/src/utility/StringUtilities.cpp @@ -22,7 +22,7 @@ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ -#include +#include #include namespace sutil