// Copyright (c) 2023 Dominic Masters // // This software is released under the MIT License. // https://opensource.org/licenses/MIT #pragma once #include "VNEvent.hpp" namespace Dawn { class VNIfEvent : public VNEvent, public IVNEventParent { public: std::string key; std::string value; VNEvent *ifTrue = nullptr; VNEvent *ifEnd = nullptr; protected: void onStart() override { assertNotNull(ifTrue); assertNotNull(ifEnd); if(this->manager->getFlag(key) == value) { useEvent([&]{ if(ifEnd->getNextEvent() == nullptr) this->next(); }, ifEnd->eventFinished); ifTrue->start(this, nullptr); } else { this->next(); } } }; }