Limo
A simple mod manager
Loading...
Searching...
No Matches
plugin.h
Go to the documentation of this file.
1
5
6#pragma once
7
8#include "file.h"
9#include "plugindependency.h"
10#include "plugintype.h"
11#include <filesystem>
12#include <map>
13#include <vector>
14
15
20namespace fomod
21{
23struct Plugin
24{
26 std::string name;
28 std::string description;
30 std::filesystem::path image_path;
36 std::vector<PluginDependency> potential_types;
38 std::map<std::string, std::string> flags;
40 std::vector<File> files;
41
50 const std::filesystem::path& target_path,
51 const std::map<std::string, std::string>& current_flags,
52 std::function<bool(std::string)> version_eval_fun,
53 std::function<bool(std::string)> fomm_eval_fun = [](auto s) { return true; })
54 {
55 for(const auto& cur_type : potential_types)
56 {
57 if(cur_type.dependencies.evaluate(
58 target_path, current_flags, version_eval_fun, fomm_eval_fun))
59 {
60 type = cur_type.type;
61 return;
62 }
63 }
65 }
66};
67}
Header for the File struct.
The fomod namespace contains classes used for parsing a FOMOD xml file and for creating an installer.
Definition dependency.h:22
PluginType
Describes how a plugin is presented.
Definition plugintype.h:20
Header for the PluginDependency struct.
Header for the PluginType enum.
Represents one selectable option during installation.
Definition plugin.h:24
PluginType default_type
Fallback type if this has potential types but none are valid.
Definition plugin.h:34
PluginType type
Affects how this plugin is displayed.
Definition plugin.h:32
std::vector< PluginDependency > potential_types
Plugin takes the first type for which the condition is fulfilled.
Definition plugin.h:36
std::filesystem::path image_path
Path to an image representing this plugin.
Definition plugin.h:30
void updateType(const std::filesystem::path &target_path, const std::map< std::string, std::string > &current_flags, std::function< bool(std::string)> version_eval_fun, std::function< bool(std::string)> fomm_eval_fun=[](auto s) { return true;})
Updates type according to potential_types.
Definition plugin.h:49
std::string name
Plugin name.
Definition plugin.h:26
std::string description
Plugin description.
Definition plugin.h:28
std::vector< File > files
Files to be installed when this is selected.
Definition plugin.h:40
std::map< std::string, std::string > flags
Flags to be set when this is selected.
Definition plugin.h:38