Limo
A simple mod manager
Loading...
Searching...
No Matches
fomod::Dependency Class Reference

Represents a fomod dependency tree node. More...

#include <dependency.h>

Public Member Functions

 Dependency (pugi::xml_node source)
 Recursively builds a dependency tree from given fomod node.
 
 Dependency ()
 Constructs a dummy node.
 
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 tree.
 
std::string toString () const
 

Private Types

enum  Type {
  dummy_node , and_node , or_node , file_leaf ,
  flag_leaf , game_version_leaf , fomm_version_leaf
}
 Represents different dependency types. More...
 

Private Attributes

Type type_
 Type of this dependency.
 
std::string target_
 Value for comparison, e.g. file path for a file dependency.
 
std::string state_ = ""
 State of file or flag.
 
std::vector< Dependencychildren_
 Children of this node.
 

Detailed Description

Represents a fomod dependency tree node.

Member Enumeration Documentation

◆ Type

Represents different dependency types.

Enumerator
dummy_node 

Always evaluates to true.

and_node 

True if all children evaluate to true.

or_node 

True if at least one child evaluates to true.

file_leaf 

File must exist.

flag_leaf 

Flag must be set.

game_version_leaf 

Game version must be == some version.

fomm_version_leaf 

Fomm version must be == some version.

Constructor & Destructor Documentation

◆ Dependency()

Dependency::Dependency ( pugi::xml_node source)

Recursively builds a dependency tree from given fomod node.

Parameters
sourceSource fomod node.

Member Function Documentation

◆ evaluate()

bool Dependency::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 tree.

Parameters
target_pathPath to target files.
flagsFlags to be checked.
eval_game_versionUsed to check if this nodes game version is valid.
eval_fomm_versionUsed to check if this nodes fomm version is valid.
Returns
True if conditions are met, else false.

The documentation for this class was generated from the following files: