refactoring seems to be done, added ability to specify files as dependencies
This commit is contained in:
parent
b07d017f86
commit
2b913d1d42
21 changed files with 148 additions and 793 deletions
|
@ -1,66 +0,0 @@
|
|||
#pragma once
|
||||
|
||||
#include <string>
|
||||
#include <filesystem>
|
||||
#include <fstream>
|
||||
#include <memory>
|
||||
#include <exception>
|
||||
#include <optional>
|
||||
#include <functional>
|
||||
#include <array>
|
||||
#include <string_view>
|
||||
#include <nlohmann/json.hpp>
|
||||
|
||||
#include "loggable.h"
|
||||
#include "loggger.h"
|
||||
|
||||
class Collection;
|
||||
|
||||
class Component : protected Loggable {
|
||||
public:
|
||||
class WrongState;
|
||||
enum State {
|
||||
initial,
|
||||
reading,
|
||||
ready,
|
||||
building,
|
||||
error,
|
||||
done
|
||||
};
|
||||
|
||||
enum Type {
|
||||
unknown,
|
||||
file,
|
||||
directory,
|
||||
mason
|
||||
};
|
||||
|
||||
Component(
|
||||
const std::filesystem::path& path,
|
||||
const std::weak_ptr<Collection>& collection,
|
||||
const std::shared_ptr<Logger>& logger
|
||||
);
|
||||
|
||||
Type getType() const;
|
||||
State getState() const;
|
||||
|
||||
void read();
|
||||
void build(const std::filesystem::path& destination, const std::string& target);
|
||||
|
||||
private:
|
||||
void tryReadingBuildScenarios();
|
||||
bool readAsMason();
|
||||
bool errorScenario(const std::string& message);
|
||||
|
||||
private:
|
||||
State state;
|
||||
Type type;
|
||||
std::weak_ptr<Collection> collection;
|
||||
std::filesystem::path location;
|
||||
std::optional<nlohmann::json> scenario;
|
||||
};
|
||||
|
||||
class Component::WrongState : public std::runtime_error {
|
||||
public:
|
||||
explicit WrongState(State state, const std::string& action);
|
||||
};
|
Loading…
Add table
Add a link
Reference in a new issue