Limo
A simple mod manager
Loading...
Searching...
No Matches
dependency.h
1
5
6#pragma once
7
8#include "pugixml.hpp"
9#include <filesystem>
10#include <functional>
11#include <map>
12#include <optional>
13#include <string>
14#include <vector>
15
16
21namespace fomod
22{
27{
46
47
48public:
53 Dependency(pugi::xml_node source);
55 Dependency();
56
66 bool evaluate(
67 const std::filesystem::path& target_path,
68 const std::map<std::string, std::string>& flags,
69 std::function<bool(std::string)> eval_game_version,
70 std::function<bool(std::string)> eval_fomm_version = [](auto s) { return true; }) const;
71 std::string toString() const;
72
73private:
77 std::string target_;
79 std::string state_ = "";
81 std::vector<Dependency> children_;
82};
83}
std::string target_
Value for comparison, e.g. file path for a file dependency.
Definition dependency.h:77
Type
Represents different dependency types.
Definition dependency.h:30
@ game_version_leaf
Game version must be == some version.
Definition dependency.h:42
@ flag_leaf
Flag must be set.
Definition dependency.h:40
@ dummy_node
Always evaluates to true.
Definition dependency.h:32
@ fomm_version_leaf
Fomm version must be == some version.
Definition dependency.h:44
@ file_leaf
File must exist.
Definition dependency.h:38
@ or_node
True if at least one child evaluates to true.
Definition dependency.h:36
@ and_node
True if all children evaluate to true.
Definition dependency.h:34
Type type_
Type of this dependency.
Definition dependency.h:75
Dependency(pugi::xml_node source)
Recursively builds a dependency tree from given fomod node.
Definition dependency.cpp:10
std::string state_
State of file or flag.
Definition dependency.h:79
Dependency()
Constructs a dummy node.
Definition dependency.cpp:66
std::vector< Dependency > children_
Children of this node.
Definition dependency.h:81
bool evaluate(const std::filesystem::path &target_path, const std::map< std::string, std::string > &flags, std::function< bool(std::string)> eval_game_version, std::function< bool(std::string)> eval_fomm_version=[](auto s) { return true;}) const
Checks given flags, files, game version and fomm version fulfill the condition represented by this tr...
Definition dependency.cpp:71
uint8_t flags
Flags indicating compression type.
Definition lspakfilelistentry.h:7
The fomod namespace contains classes used for parsing a FOMOD xml file and for creating an installer.
Definition dependency.h:22