mason/src/project.h

45 lines
954 B
C
Raw Normal View History

2023-08-30 20:54:59 +00:00
#pragma once
#include <filesystem>
#include <string>
#include <fstream>
#include <list>
2023-08-31 20:06:02 +00:00
#include <map>
#include <stdint.h>
#include <nlohmann/json.hpp>
#include "dependency.h"
2023-08-30 20:54:59 +00:00
class Project {
public:
typedef std::string LogMessage;
typedef std::list<LogMessage> Log;
enum class Status {
unknown,
read,
error
};
Project(const std::filesystem::path& location);
bool read();
Status getStatus() const;
Log getLog() const;
std::string getName() const;
2023-08-31 20:06:02 +00:00
uint32_t dependenciesCount() const;
2023-08-30 20:54:59 +00:00
private:
void log(const std::string& message) const;
2023-08-31 20:06:02 +00:00
void parse(const nlohmann::json& json);
void createDepencencyFromString(const std::string& entry);
void createDepencencyFromObject(const nlohmann::json& entry);
2023-08-30 20:54:59 +00:00
private:
std::filesystem::path location;
Status status;
std::string name;
mutable Log logStorage;
2023-08-31 20:06:02 +00:00
std::map<std::string, Dependency> dependencies;
2023-08-30 20:54:59 +00:00
};