diff options
author | rtk0c <[email protected]> | 2022-06-30 21:38:53 -0700 |
---|---|---|
committer | rtk0c <[email protected]> | 2022-06-30 21:38:53 -0700 |
commit | 7fe47a9d5b1727a61dc724523b530762f6d6ba19 (patch) | |
tree | e95be6e66db504ed06d00b72c579565bab873277 /app/source/Cplt/Model/Workflow/Values/List.hpp | |
parent | 2cf952088d375ac8b2f45b144462af0953436cff (diff) |
Restructure project
Diffstat (limited to 'app/source/Cplt/Model/Workflow/Values/List.hpp')
-rw-r--r-- | app/source/Cplt/Model/Workflow/Values/List.hpp | 50 |
1 files changed, 50 insertions, 0 deletions
diff --git a/app/source/Cplt/Model/Workflow/Values/List.hpp b/app/source/Cplt/Model/Workflow/Values/List.hpp new file mode 100644 index 0000000..cc8e061 --- /dev/null +++ b/app/source/Cplt/Model/Workflow/Values/List.hpp @@ -0,0 +1,50 @@ +#pragma once + +#include <Cplt/Model/Workflow/Value.hpp> + +#include <memory> +#include <vector> + +class ListValue : public BaseValue +{ +public: + class Iterator + { + private: + std::vector<std::unique_ptr<BaseValue>>::iterator mIter; + + public: + BaseValue* operator*() const; + BaseValue* operator->() const; + + Iterator& operator++(); + Iterator operator++(int) const; + Iterator& operator--(); + Iterator operator--(int) const; + + friend bool operator==(const Iterator& a, const Iterator& b); + + private: + friend class ListValue; + Iterator(decltype(mIter) iter); + }; + +private: + std::vector<std::unique_ptr<BaseValue>> mElements; + +public: + static bool IsInstance(const BaseValue* value); + ListValue(); + + int GetCount() const; + BaseValue* GetElement(int i) const; + + void Append(std::unique_ptr<BaseValue> element); + void Insert(int i, std::unique_ptr<BaseValue> element); + void Insert(Iterator iter, std::unique_ptr<BaseValue> element); + void Remove(int i); + void Remove(Iterator iter); + + Iterator begin(); + Iterator end(); +}; |