Limo
A simple mod manager
Loading...
Searching...
No Matches
Bg3PakFile Class Reference

Parses and represents plugin data contained in a .pak file used in Baldurs Gate 3. More...

#include <bg3pakfile.h>

Public Member Functions

 Bg3PakFile ()=default
 Default constructor.
 
 Bg3PakFile (const std::filesystem::path &source_file, const std::filesystem::path &prefix)
 Reads all plugins from the given .pak file.
 
 Bg3PakFile (const Json::Value &json_value, const std::filesystem::path &prefix)
 Deserializes data from the given json object.
 
const std::vector< Bg3Plugin > & getPlugins () const
 Returns a vector of plugins contained in this pak file.
 
Json::Value toJson () const
 Serializes this object.
 
std::filesystem::path getSourceFile () const
 Returns the path to this object's source file.
 
bool timestampsMatch ()
 Checks if this file's timestamp matches the modification time on disk.
 
std::string getPluginName (const std::string &uuid) const
 Returns the name of the plugin matching the given UUID.
 
bool hasPlugin (const std::string &uuid) const
 Checks whether a plugin with the given UUID exists.
 
bool pluginConflictsWith (const std::string &plugin_uuid, const Bg3PakFile &other_file, const std::string &other_plugin_uuid)
 Checks whether the given plugin conflicts with the given plugin in the given file.
 
bool conflictsWith (const Bg3PakFile &other)
 Checks whether the any files conflcits with the given pak archive.
 

Private Member Functions

void init ()
 Initializes this object from the source file.
 
std::time_t getTimestamp (const std::filesystem::path &file)
 Reads the file modification time from the given file.
 

Private Attributes

std::vector< Bg3Pluginplugins_
 Contains all plugins in the source file.
 
std::filesystem::path source_file_
 Path to the source file.
 
std::time_t modified_time_
 Time at which the source file was modified.
 
std::vector< std::filesystem::path > file_list_
 Contains paths to files in the source file.
 
std::filesystem::path source_path_prefix_
 Prefix for the source file path.
 

Detailed Description

Parses and represents plugin data contained in a .pak file used in Baldurs Gate 3.

Constructor & Destructor Documentation

◆ Bg3PakFile() [1/2]

Bg3PakFile::Bg3PakFile ( const std::filesystem::path & source_file,
const std::filesystem::path & prefix )

Reads all plugins from the given .pak file.

Parameters
source_fileSource .pak file.

◆ Bg3PakFile() [2/2]

Bg3PakFile::Bg3PakFile ( const Json::Value & json_value,
const std::filesystem::path & prefix )

Deserializes data from the given json object.

Parameters
json_valuesource json object.

Member Function Documentation

◆ conflictsWith()

bool Bg3PakFile::conflictsWith ( const Bg3PakFile & other)

Checks whether the any files conflcits with the given pak archive.

Parameters
otherArchive to check.
Returns
True if a conflict exists.

◆ getPluginName()

std::string Bg3PakFile::getPluginName ( const std::string & uuid) const

Returns the name of the plugin matching the given UUID.

Parameters
uuidUUID to check.
Returns
The name, or an empty string of the UUID could not be matched.

◆ getPlugins()

const std::vector< Bg3Plugin > & Bg3PakFile::getPlugins ( ) const

Returns a vector of plugins contained in this pak file.

Returns
The vector.

◆ getSourceFile()

std::filesystem::path Bg3PakFile::getSourceFile ( ) const

Returns the path to this object's source file.

Returns
The path.

◆ hasPlugin()

bool Bg3PakFile::hasPlugin ( const std::string & uuid) const

Checks whether a plugin with the given UUID exists.

Parameters
uuidUUID to check.
Returns
True if a plugin exists.

◆ pluginConflictsWith()

bool Bg3PakFile::pluginConflictsWith ( const std::string & plugin_uuid,
const Bg3PakFile & other_file,
const std::string & other_plugin_uuid )

Checks whether the given plugin conflicts with the given plugin in the given file.

Parameters
plugin_uuidPlugin UUID in this file to check.
other_fileOther file containing other_plugin.
other_plugin_uuidPlugin UUID in other_file.
Returns
True if a conflict exists.

◆ timestampsMatch()

bool Bg3PakFile::timestampsMatch ( )

Checks if this file's timestamp matches the modification time on disk.

Returns
True of the times match.

◆ toJson()

Json::Value Bg3PakFile::toJson ( ) const

Serializes this object.

Returns
Json object containing serialized data.

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