Lowercase boss->loot in source files.

This commit is contained in:
WrinklyNinja
2014-03-06 20:18:49 +00:00
parent 6970a955f2
commit 1806918010
27 changed files with 645 additions and 645 deletions
+143 -143
View File
File diff suppressed because it is too large Load Diff
+60 -60
View File
@@ -42,7 +42,7 @@
Data returned by a function lasts until a function is called which returns data of the same type (eg. a string is stored until the client calls another function which returns a string, an integer array lasts until another integer array is returned, etc.).
All allocated memory is freed when boss_destroy_db() is called, except the string allocated by boss_get_error_message(), which must be freed by calling boss_cleanup().
All allocated memory is freed when loot_destroy_db() is called, except the string allocated by loot_get_error_message(), which must be freed by calling loot_cleanup().
*/
#ifndef __LOOT_API_H__
@@ -94,17 +94,17 @@ extern "C"
@brief A structure that holds all game-specific data used by the LOOT API.
@details Used to keep each game's data independent. Abstracts the definition of the API's internal state while still providing type safety across the library. Multiple handles can also be made for each game, though it should be kept in mind that the API is not thread-safe.
*/
typedef struct _boss_db_int * boss_db;
typedef struct _loot_db_int * loot_db;
/**
@brief A structure that holds the type of a message and the message string itself.
@var boss_message::type The type of the message, specified using one of the message type codes given below.
@var boss_message::message The message string itself.
@var loot_message::type The type of the message, specified using one of the message type codes given below.
@var loot_message::message The message string itself.
*/
typedef struct {
unsigned int type;
const char * message;
} boss_message;
} loot_message;
/*********************//**
@@ -113,81 +113,81 @@ typedef struct {
*************************/
///@{
LOOT_API extern const unsigned int boss_ok; ///< The function completed successfully.
LOOT_API extern const unsigned int boss_error_liblo_error; ///< There was an error in performing a load order operation.
LOOT_API extern const unsigned int boss_error_file_write_fail; ///< A file could not be written to.
LOOT_API extern const unsigned int boss_error_parse_fail; ///< There was an error parsing the file.
LOOT_API extern const unsigned int boss_error_condition_eval_fail; ///< There was an error evaluating the conditionals in a metadata file.
LOOT_API extern const unsigned int boss_error_regex_eval_fail; ///< There was an error evaluating the regular expressions in a metadata file.
LOOT_API extern const unsigned int boss_error_no_mem; ///< The API was unable to allocate the required memory.
LOOT_API extern const unsigned int boss_error_invalid_args; ///< Invalid arguments were given for the function.
LOOT_API extern const unsigned int boss_error_no_tag_map; ///< No Bash Tag map has been generated yet.
LOOT_API extern const unsigned int boss_error_path_not_found; ///< A file or folder path could not be found.
LOOT_API extern const unsigned int boss_error_no_game_detected; ///< The given game could not be found.
LOOT_API extern const unsigned int boss_error_windows_error; ///< An error occurred during a call to the Windows API.
LOOT_API extern const unsigned int boss_error_sorting_error; ///< An error occurred while sorting plugins.
LOOT_API extern const unsigned int loot_ok; ///< The function completed successfully.
LOOT_API extern const unsigned int loot_error_liblo_error; ///< There was an error in performing a load order operation.
LOOT_API extern const unsigned int loot_error_file_write_fail; ///< A file could not be written to.
LOOT_API extern const unsigned int loot_error_parse_fail; ///< There was an error parsing the file.
LOOT_API extern const unsigned int loot_error_condition_eval_fail; ///< There was an error evaluating the conditionals in a metadata file.
LOOT_API extern const unsigned int loot_error_regex_eval_fail; ///< There was an error evaluating the regular expressions in a metadata file.
LOOT_API extern const unsigned int loot_error_no_mem; ///< The API was unable to allocate the required memory.
LOOT_API extern const unsigned int loot_error_invalid_args; ///< Invalid arguments were given for the function.
LOOT_API extern const unsigned int loot_error_no_tag_map; ///< No Bash Tag map has been generated yet.
LOOT_API extern const unsigned int loot_error_path_not_found; ///< A file or folder path could not be found.
LOOT_API extern const unsigned int loot_error_no_game_detected; ///< The given game could not be found.
LOOT_API extern const unsigned int loot_error_windows_error; ///< An error occurred during a call to the Windows API.
LOOT_API extern const unsigned int loot_error_sorting_error; ///< An error occurred while sorting plugins.
/**
@brief Matches the value of the highest-numbered return code.
@details Provided in case clients wish to incorporate additional return codes in their implementation and desire some method of avoiding value conflicts.
*/
LOOT_API extern const unsigned int boss_return_max;
LOOT_API extern const unsigned int loot_return_max;
///@}
/*******************//**
@name Game Codes
@brief Used with boss_create_db().
@brief Used with loot_create_db().
***********************/
///@{
LOOT_API extern const unsigned int boss_game_tes4; ///< Game code for The Elder Scrolls IV: Oblivion.
LOOT_API extern const unsigned int boss_game_tes5; ///< Game code for The Elder Scrolls V: Skyrim.
LOOT_API extern const unsigned int boss_game_fo3; ///< Game code for Fallout 3.
LOOT_API extern const unsigned int boss_game_fonv; ///< Game code for Fallout: New Vegas.
LOOT_API extern const unsigned int loot_game_tes4; ///< Game code for The Elder Scrolls IV: Oblivion.
LOOT_API extern const unsigned int loot_game_tes5; ///< Game code for The Elder Scrolls V: Skyrim.
LOOT_API extern const unsigned int loot_game_fo3; ///< Game code for Fallout 3.
LOOT_API extern const unsigned int loot_game_fonv; ///< Game code for Fallout: New Vegas.
///@}
/***************************//**
@name Message Type Codes
@brief Used with the boss_message structure.
@brief Used with the loot_message structure.
*******************************/
///@{
LOOT_API extern const unsigned int boss_message_say; ///< Denotes a generic note-type message.
LOOT_API extern const unsigned int boss_message_warn; ///< Denotes a warning message.
LOOT_API extern const unsigned int boss_message_error; ///< Denotes an error message.
LOOT_API extern const unsigned int loot_message_say; ///< Denotes a generic note-type message.
LOOT_API extern const unsigned int loot_message_warn; ///< Denotes a warning message.
LOOT_API extern const unsigned int loot_message_error; ///< Denotes an error message.
/**
@brief Denites a Bash Tag suggestion message.
@details This type should never be seen client-side as it is only used during conversion between internal Bash Tag and message structures, but it is provided just in case.
*/
LOOT_API extern const unsigned int boss_message_tag;
LOOT_API extern const unsigned int loot_message_tag;
///@}
/*******************************//**
@name Message Language Codes
@brief Used with boss_eval_lists().
@brief Used with loot_eval_lists().
***********************************/
///@{
LOOT_API extern const unsigned int boss_lang_any; ///< Tells the API to select messages of any language.
LOOT_API extern const unsigned int boss_lang_english; ///< Tells the API to preferentially select English messages.
LOOT_API extern const unsigned int boss_lang_spanish; ///< Tells the API to preferentially select Spanish messages.
LOOT_API extern const unsigned int boss_lang_russian; ///< Tells the API to preferentially select Russian messages.
LOOT_API extern const unsigned int boss_lang_french; ///< Tells the API to preferentially select French messages.
LOOT_API extern const unsigned int boss_lang_chinese; ///< Tells the API to preferentially select Chinese messages.
LOOT_API extern const unsigned int boss_lang_polish; ///< Tells the API to preferentially select Polish messages.
LOOT_API extern const unsigned int boss_lang_brazilian_portuguese; ///< Tells the API to preferentially select Polish messages.
LOOT_API extern const unsigned int loot_lang_any; ///< Tells the API to select messages of any language.
LOOT_API extern const unsigned int loot_lang_english; ///< Tells the API to preferentially select English messages.
LOOT_API extern const unsigned int loot_lang_spanish; ///< Tells the API to preferentially select Spanish messages.
LOOT_API extern const unsigned int loot_lang_russian; ///< Tells the API to preferentially select Russian messages.
LOOT_API extern const unsigned int loot_lang_french; ///< Tells the API to preferentially select French messages.
LOOT_API extern const unsigned int loot_lang_chinese; ///< Tells the API to preferentially select Chinese messages.
LOOT_API extern const unsigned int loot_lang_polish; ///< Tells the API to preferentially select Polish messages.
LOOT_API extern const unsigned int loot_lang_brazilian_portuguese; ///< Tells the API to preferentially select Polish messages.
///@}
/*********************************//**
@name Plugin Cleanliness Codes
@brief Used with boss_get_dirty_message().
@brief Used with loot_get_dirty_message().
*************************************/
///@{
LOOT_API extern const unsigned int boss_needs_cleaning_no; ///< Denotes that the plugin queried does not need cleaning.
LOOT_API extern const unsigned int boss_needs_cleaning_yes; ///< Denotes that the plugin queried needs cleaning.
LOOT_API extern const unsigned int boss_needs_cleaning_unknown; ///< Denotes that the API is unable to determine whether or not the plugin queried needs cleaning.
LOOT_API extern const unsigned int loot_needs_cleaning_no; ///< Denotes that the plugin queried does not need cleaning.
LOOT_API extern const unsigned int loot_needs_cleaning_yes; ///< Denotes that the plugin queried needs cleaning.
LOOT_API extern const unsigned int loot_needs_cleaning_unknown; ///< Denotes that the API is unable to determine whether or not the plugin queried needs cleaning.
///@}
@@ -203,12 +203,12 @@ LOOT_API extern const unsigned int boss_needs_cleaning_unknown; ///< Denotes th
@param details A pointer to the error details string outputted by the function.
@returns A return code.
*/
LOOT_API unsigned int boss_get_error_message (const char ** const message);
LOOT_API unsigned int loot_get_error_message (const char ** const message);
/**
@brief Frees the memory allocated to the last error details string.
*/
LOOT_API void boss_cleanup ();
LOOT_API void loot_cleanup ();
///@}
@@ -226,7 +226,7 @@ LOOT_API void boss_cleanup ();
@param versionPatch The patch version number to check.
@returns True if the API versions are compatible, false otherwise.
*/
LOOT_API bool boss_is_compatible (const unsigned int versionMajor, const unsigned int versionMinor, const unsigned int versionPatch);
LOOT_API bool loot_is_compatible (const unsigned int versionMajor, const unsigned int versionMinor, const unsigned int versionPatch);
/**
@brief Gets the API version.
@@ -235,7 +235,7 @@ LOOT_API bool boss_is_compatible (const unsigned int versionMajor, const unsigne
@param versionMinor A pointer to the minor version number.
@param versionPatch A pointer to the patch version number.
*/
LOOT_API unsigned int boss_get_version (unsigned int * const versionMajor, unsigned int * const versionMinor, unsigned int * const versionPatch);
LOOT_API unsigned int loot_get_version (unsigned int * const versionMajor, unsigned int * const versionMinor, unsigned int * const versionPatch);
/***************************************//**
@@ -251,14 +251,14 @@ LOOT_API unsigned int boss_get_version (unsigned int * const versionMajor, unsig
@param gamePath The relative or absolute path to the game folder, ot `NULL`. If `NULL`, the API will attempt to detect the data path of the specified game.
@returns A return code.
*/
LOOT_API unsigned int boss_create_db (boss_db * const db, const unsigned int clientGame, const char * const gamePath);
LOOT_API unsigned int loot_create_db (loot_db * const db, const unsigned int clientGame, const char * const gamePath);
/**
@brief Destroy an existing database handle.
@details Destroys the given database handle, freeing up memory allocated during its use, excluding any memory allocated to error messages.
@param db The database handle to destroy.
*/
LOOT_API void boss_destroy_db (boss_db db);
LOOT_API void loot_destroy_db (loot_db db);
///@}
@@ -276,7 +276,7 @@ LOOT_API void boss_destroy_db (boss_db db);
@param userlistPath A string containing the relative or absolute path to the userlist file that should be loaded, or `NULL`. If `NULL`, no userlist will be loaded. The API only upports loading v3 userlists.
@returns A return code.
*/
LOOT_API unsigned int boss_load_lists (boss_db db, const char * const masterlistPath,
LOOT_API unsigned int loot_load_lists (loot_db db, const char * const masterlistPath,
const char * const userlistPath);
/**
@@ -286,7 +286,7 @@ LOOT_API unsigned int boss_load_lists (boss_db db, const char * const masterlist
@param language The language code that is used for message language comparisons.
@returns A return code.
*/
LOOT_API unsigned int boss_eval_lists (boss_db db, const unsigned int language);
LOOT_API unsigned int loot_eval_lists (loot_db db, const unsigned int language);
///@}
@@ -298,17 +298,17 @@ LOOT_API unsigned int boss_eval_lists (boss_db db, const unsigned int language);
/**
@brief Outputs an array of the Bash Tags that are suggested in the database.
@details This function must be called prior to calling boss_get_plugin_tags() to ensure that the latter can return the Tags using the correct array indicies.
@details This function must be called prior to calling loot_get_plugin_tags() to ensure that the latter can return the Tags using the correct array indicies.
@param db The database the function acts on.
@param tagMap A pointer to the outputted array of Bash Tags. The array functions as a map where the indicies are the keys, allowing the API to use them as UIDs for Bash Tags instead of passing their names as strings every time boss_get_plugin_tags() is called. If no Bash Tags are suggested, this will be `NULL`.
@param tagMap A pointer to the outputted array of Bash Tags. The array functions as a map where the indicies are the keys, allowing the API to use them as UIDs for Bash Tags instead of passing their names as strings every time loot_get_plugin_tags() is called. If no Bash Tags are suggested, this will be `NULL`.
@param numTags A pointer to the size of the outputted array. If no Bash Tags are suggested, this will be `0`.
@returns A return code.
*/
LOOT_API unsigned int boss_get_tag_map (boss_db db, char *** const tagMap, size_t * const numTags);
LOOT_API unsigned int loot_get_tag_map (loot_db db, char *** const tagMap, size_t * const numTags);
/**
@brief Outputs the Bash Tags suggested for addition and removal by the database for the given plugin.
@details boss_get_tag_map() must be called before this to ensure that the Bash Tag UIDs outputted by this function can be matched up to name strings.
@details loot_get_tag_map() must be called before this to ensure that the Bash Tag UIDs outputted by this function can be matched up to name strings.
@param db The database the function acts on.
@param plugin The filename of the plugin to look up Bash Tag suggestions for.
@param tags_added A pointer to the outputted array of UIDs of the Bash Tags suggested for addition to the specified plugin. `NULL` if no Bash Tag additions are suggested.
@@ -318,7 +318,7 @@ LOOT_API unsigned int boss_get_tag_map (boss_db db, char *** const tagMap, size_
@param userlistModified `true` if the Bash Tag suggestions were modified by the data in the userlist, `false` otherwise.
@returns A return code.
*/
LOOT_API unsigned int boss_get_plugin_tags (boss_db db, const char * const plugin,
LOOT_API unsigned int loot_get_plugin_tags (loot_db db, const char * const plugin,
unsigned int ** const tags_added,
size_t * const numTags_added,
unsigned int ** const tags_removed,
@@ -329,12 +329,12 @@ LOOT_API unsigned int boss_get_plugin_tags (boss_db db, const char * const plugi
@brief Outputs the messages associated with the given plugin in the database.
@param db The database the function acts on.
@param plugin The filename of the plugin to look up messages for.
@param messages A pointer to the outputted array of messages associated with the specified plugin, given as boss_message structures. `NULL` if the plugin has no messages associated with it.
@param messages A pointer to the outputted array of messages associated with the specified plugin, given as loot_message structures. `NULL` if the plugin has no messages associated with it.
@param numMessages A pointer to the size of the outputted array. If no messages are outputted, this will be `0`.
@returns A return code.
*/
LOOT_API unsigned int boss_get_plugin_messages (boss_db db, const char * const plugin,
boss_message ** const messages,
LOOT_API unsigned int loot_get_plugin_messages (loot_db db, const char * const plugin,
loot_message ** const messages,
size_t * const numMessages);
/**
@@ -347,7 +347,7 @@ LOOT_API unsigned int boss_get_plugin_messages (boss_db db, const char * const p
@returns A return code.
*/
LOOT_API unsigned int boss_get_dirty_info (boss_db db, const char * const plugin,
LOOT_API unsigned int loot_get_dirty_info (loot_db db, const char * const plugin,
unsigned int * const needsCleaning);
/**
@@ -357,7 +357,7 @@ LOOT_API unsigned int boss_get_dirty_info (boss_db db, const char * const plugin
@param overwrite If `false` and `outputFile` already exists, no data will be written. Otherwise, data will be written.
@returns A return code.
*/
LOOT_API unsigned int boss_write_minimal_list (boss_db db, const char * const outputFile, const bool overwrite);
LOOT_API unsigned int loot_write_minimal_list (loot_db db, const char * const outputFile, const bool overwrite);
///@}
+1 -1
View File
@@ -28,7 +28,7 @@
#include <exception>
#include <string>
namespace boss {
namespace loot {
class error : public std::exception {
public:
+17 -17
View File
@@ -36,7 +36,7 @@ using namespace std;
namespace fs = boost::filesystem;
namespace lc = boost::locale;
namespace boss {
namespace loot {
std::vector<Game> GetGames(const YAML::Node& settings) {
vector<Game> games;
@@ -65,34 +65,34 @@ namespace boss {
if (Id() == g_game_tes4) {
_name = "TES IV: Oblivion";
registryKey = "Software\\Bethesda Softworks\\Oblivion\\Installed Path";
bossFolderName = "Oblivion";
lootFolderName = "Oblivion";
_masterFile = "Oblivion.esm";
espm_settings = espm::Settings("tes4");
_repositoryURL = "https://github.com/boss-developers/boss-oblivion.git";
_repositoryURL = "https://github.com/loot-developers/loot-oblivion.git";
_repositoryBranch = "gh-pages";
} else if (Id() == g_game_tes5) {
_name = "TES V: Skyrim";
registryKey = "Software\\Bethesda Softworks\\Skyrim\\Installed Path";
bossFolderName = "Skyrim";
lootFolderName = "Skyrim";
_masterFile = "Skyrim.esm";
espm_settings = espm::Settings("tes5");
_repositoryURL = "https://github.com/boss-developers/boss-skyrim.git";
_repositoryURL = "https://github.com/loot-developers/loot-skyrim.git";
_repositoryBranch = "gh-pages";
} else if (Id() == g_game_fo3) {
_name = "Fallout 3";
registryKey = "Software\\Bethesda Softworks\\Fallout3\\Installed Path";
bossFolderName = "Fallout3";
lootFolderName = "Fallout3";
_masterFile = "Fallout3.esm";
espm_settings = espm::Settings("fo3");
_repositoryURL = "https://github.com/boss-developers/boss-fallout3.git";
_repositoryURL = "https://github.com/loot-developers/loot-fallout3.git";
_repositoryBranch = "gh-pages";
} else if (Id() == g_game_fonv) {
_name = "Fallout: New Vegas";
registryKey = "Software\\Bethesda Softworks\\FalloutNV\\Installed Path";
bossFolderName = "FalloutNV";
lootFolderName = "FalloutNV";
_masterFile = "FalloutNV.esm";
espm_settings = espm::Settings("fonv");
_repositoryURL = "https://github.com/boss-developers/boss-fallout-new-vegas.git";
_repositoryURL = "https://github.com/loot-developers/loot-fallout-new-vegas.git";
_repositoryBranch = "gh-pages";
} else {
BOOST_LOG_TRIVIAL(error) << "Invalid game ID supplied.";
@@ -100,7 +100,7 @@ namespace boss {
}
if (!folder.empty())
bossFolderName = folder;
lootFolderName = folder;
}
Game& Game::SetDetails(const std::string& name, const std::string& masterFile,
@@ -186,7 +186,7 @@ namespace boss {
}
bool Game::operator == (const Game& rhs) const {
return (boost::iequals(_name, rhs.Name()) || boost::iequals(bossFolderName, rhs.FolderName()));
return (boost::iequals(_name, rhs.Name()) || boost::iequals(lootFolderName, rhs.FolderName()));
}
unsigned int Game::Id() const {
@@ -198,7 +198,7 @@ namespace boss {
}
string Game::FolderName() const {
return bossFolderName;
return lootFolderName;
}
std::string Game::Master() const {
@@ -226,15 +226,15 @@ namespace boss {
}
fs::path Game::MasterlistPath() const {
return g_path_local / bossFolderName / "masterlist.yaml";
return g_path_local / lootFolderName / "masterlist.yaml";
}
fs::path Game::UserlistPath() const {
return g_path_local / bossFolderName / "userlist.yaml";
return g_path_local / lootFolderName / "userlist.yaml";
}
fs::path Game::ReportPath() const {
return g_path_local / bossFolderName / "report.html";
return g_path_local / lootFolderName / "report.html";
}
void Game::RefreshActivePluginsList() {
@@ -483,8 +483,8 @@ namespace boss {
void Game::CreateLOOTGameFolder() {
//Make sure that the LOOT game path exists.
try {
if (fs::exists(g_path_local) && !fs::exists(g_path_local / bossFolderName))
fs::create_directory(g_path_local / bossFolderName);
if (fs::exists(g_path_local) && !fs::exists(g_path_local / lootFolderName))
fs::create_directory(g_path_local / lootFolderName);
} catch (fs::filesystem_error& e) {
BOOST_LOG_TRIVIAL(error) << "Could not create LOOT folder for game. Details: " << e.what();
throw error(error::path_write_fail, lc::translate("Could not create LOOT folder for game. Details:").str() + " " + e.what());
+3 -3
View File
@@ -38,14 +38,14 @@
#include <src/libespm.h>
#include <yaml-cpp/yaml.h>
namespace boss {
namespace loot {
class Plugin;
class Game {
public:
Game(); //Sets game to LOOT_g_game_autodetect, with all other vars being empty.
Game(const unsigned int baseGameCode, const std::string& bossFolder = "");
Game(const unsigned int baseGameCode, const std::string& lootFolder = "");
Game& SetDetails(const std::string& name, const std::string& masterFile,
const std::string& repositoryURL, const std::string& repositoryBranch,
@@ -91,7 +91,7 @@ namespace boss {
std::string registryKey;
std::string bossFolderName;
std::string lootFolderName;
std::string _repositoryURL;
std::string _repositoryBranch;
+25 -25
View File
@@ -39,7 +39,7 @@
#include <boost/filesystem.hpp>
#include <boost/locale.hpp>
namespace boss {
namespace loot {
//LOOT Report generation stuff.
@@ -260,7 +260,7 @@ namespace boss {
note.append_attribute("id").set_value("noChanges");
note.text().set(boost::locale::translate("No change in details since last run.").str().c_str());
*/
messages.push_front(boss::Message(boss::g_message_say, boost::locale::translate("There have been no changes in the Details tab since LOOT was last run for this game.").str()));
messages.push_front(loot::Message(loot::g_message_say, boost::locale::translate("There have been no changes in the Details tab since LOOT was last run for this game.").str()));
}
if (!messages.empty()) {
@@ -393,7 +393,7 @@ namespace boss {
else if (jt->ITMs() > 0 && jt->UDRs() > 0 && jt->DeletedNavmeshes() == 0)
f = boost::format(boost::locale::translate("Contains %1% ITM records and %2% UDR records. Clean with %3%.")) % jt->ITMs() % jt->UDRs() % jt->CleaningUtility();
messages.push_back(boss::Message(boss::g_message_warn, f.str()));
messages.push_back(loot::Message(loot::g_message_warn, f.str()));
}
AppendMessages(plugin, messages, warnNo, errorNo);
@@ -562,7 +562,7 @@ namespace boss {
AppendScripts(body);
//PugiXML's save_file doesn't handle Unicode paths right (it can't open them right), so use a stream instead.
boost::filesystem::path outpath(file);
boss::ofstream out(outpath);
loot::ofstream out(outpath);
doc.save(out, "\t", pugi::format_default | pugi::format_no_declaration | pugi::format_raw);
out.close();
@@ -588,7 +588,7 @@ namespace boss {
games.push_back(Game(g_game_tes5));
games.push_back(Game(g_game_fo3));
games.push_back(Game(g_game_fonv));
games.push_back(Game(g_game_tes4, "Nehrim").SetDetails("Nehrim - At Fate's Edge", "Nehrim.esm", "https://github.com/boss-developers/boss-oblivion.git", "gh-pages", "", "Software\\Microsoft\\Windows\\CurrentVersion\\Uninstall\\Nehrim - At Fate's Edge_is1"));
games.push_back(Game(g_game_tes4, "Nehrim").SetDetails("Nehrim - At Fate's Edge", "Nehrim.esm", "https://github.com/loot-developers/loot-oblivion.git", "gh-pages", "", "Software\\Microsoft\\Windows\\CurrentVersion\\Uninstall\\Nehrim - At Fate's Edge_is1"));
root["Games"] = games;
@@ -598,7 +598,7 @@ namespace boss {
yout << root;
boost::filesystem::path p(file);
boss::ofstream out(p);
loot::ofstream out(p);
out << yout.c_str();
out.close();
}
@@ -616,7 +616,7 @@ namespace YAML {
return out;
}
inline Emitter& operator << (Emitter& out, const boss::PluginDirtyInfo& rhs) {
inline Emitter& operator << (Emitter& out, const loot::PluginDirtyInfo& rhs) {
out << BeginMap
<< Key << "crc" << Value << Hex << rhs.CRC() << Dec
<< Key << "util" << Value << rhs.CleaningUtility();
@@ -633,7 +633,7 @@ namespace YAML {
return out;
}
inline Emitter& operator << (Emitter& out, const boss::Game& rhs) {
inline Emitter& operator << (Emitter& out, const loot::Game& rhs) {
out << BeginMap
<< Key << "folder" << Value << rhs.FolderName()
<< Key << "name" << Value << rhs.Name()
@@ -643,24 +643,24 @@ namespace YAML {
<< Key << "path" << Value << rhs.GamePath().string()
<< Key << "registry" << Value << rhs.RegistryKey();
if (rhs.Id() == boss::g_game_tes4)
out << Key << Value << boss::Game(boss::g_game_tes4).FolderName();
else if (rhs.Id() == boss::g_game_tes5)
out << Key << Value << boss::Game(boss::g_game_tes5).FolderName();
else if (rhs.Id() == boss::g_game_fo3)
out << Key << Value << boss::Game(boss::g_game_fo3).FolderName();
else if (rhs.Id() == boss::g_game_fonv)
out << Key << Value << boss::Game(boss::g_game_fonv).FolderName();
if (rhs.Id() == loot::g_game_tes4)
out << Key << Value << loot::Game(loot::g_game_tes4).FolderName();
else if (rhs.Id() == loot::g_game_tes5)
out << Key << Value << loot::Game(loot::g_game_tes5).FolderName();
else if (rhs.Id() == loot::g_game_fo3)
out << Key << Value << loot::Game(loot::g_game_fo3).FolderName();
else if (rhs.Id() == loot::g_game_fonv)
out << Key << Value << loot::Game(loot::g_game_fonv).FolderName();
out << EndMap;
return out;
}
inline Emitter& operator << (Emitter& out, const boss::MessageContent& rhs) {
inline Emitter& operator << (Emitter& out, const loot::MessageContent& rhs) {
out << BeginMap;
out << Key << "lang" << Value << boss::Language(rhs.Language()).Locale();
out << Key << "lang" << Value << loot::Language(rhs.Language()).Locale();
out << Key << "str" << Value << rhs.Str();
@@ -669,17 +669,17 @@ namespace YAML {
return out;
}
inline Emitter& operator << (Emitter& out, const boss::Message& rhs) {
inline Emitter& operator << (Emitter& out, const loot::Message& rhs) {
out << BeginMap;
if (rhs.Type() == boss::g_message_say)
if (rhs.Type() == loot::g_message_say)
out << Key << "type" << Value << "say";
else if (rhs.Type() == boss::g_message_warn)
else if (rhs.Type() == loot::g_message_warn)
out << Key << "type" << Value << "warn";
else
out << Key << "type" << Value << "error";
if (rhs.Content().size() == 1 && rhs.Content().front().Language() == boss::g_lang_any)
if (rhs.Content().size() == 1 && rhs.Content().front().Language() == loot::g_lang_any)
out << Key << "content" << Value << rhs.Content().front().Str();
else
out << Key << "content" << Value << rhs.Content();
@@ -692,7 +692,7 @@ namespace YAML {
return out;
}
inline Emitter& operator << (Emitter& out, const boss::File& rhs) {
inline Emitter& operator << (Emitter& out, const loot::File& rhs) {
if (!rhs.IsConditional() && rhs.DisplayName().empty())
out << rhs.Name();
else {
@@ -711,7 +711,7 @@ namespace YAML {
return out;
}
inline Emitter& operator << (Emitter& out, const boss::Tag& rhs) {
inline Emitter& operator << (Emitter& out, const loot::Tag& rhs) {
if (!rhs.IsConditional()) {
if (rhs.IsAddition())
out << rhs.Name();
@@ -731,7 +731,7 @@ namespace YAML {
return out;
}
inline Emitter& operator << (Emitter& out, const boss::Plugin& rhs) {
inline Emitter& operator << (Emitter& out, const loot::Plugin& rhs) {
if (!rhs.HasNameOnly()) {
out << BeginMap
+1 -1
View File
@@ -25,7 +25,7 @@
#include "globals.h"
#include "helpers.h"
namespace boss {
namespace loot {
//Game values.
const unsigned int g_game_autodetect = 0;
+1 -1
View File
@@ -26,7 +26,7 @@
#include <boost/filesystem.hpp>
namespace boss {
namespace loot {
//Game values.
extern const unsigned int g_game_autodetect;
+15 -15
View File
@@ -35,7 +35,7 @@ using namespace std;
namespace lc = boost::locale;
namespace boss {
namespace loot {
cycle_detector::cycle_detector() {}
@@ -44,7 +44,7 @@ namespace boss {
vertex_t vTarget = boost::target(e, g);
BOOST_LOG_TRIVIAL(error) << "Cyclic interaction detected between plugins \"" << g[vSource].Name() << "\" and \"" << g[vTarget].Name() << "\".";
throw boss::error(boss::error::sorting_error, (boost::format(lc::translate("Cyclic interaction detected between plugins \"%1%\" and \"%2%\".")) % g[vSource].Name() % g[vTarget].Name()).str());
throw loot::error(loot::error::sorting_error, (boost::format(lc::translate("Cyclic interaction detected between plugins \"%1%\" and \"%2%\".")) % g[vSource].Name() % g[vTarget].Name()).str());
}
bool GetVertexByName(const PluginGraph& graph, const std::string& name, vertex_t& vertex) {
@@ -77,7 +77,7 @@ namespace boss {
boost::topological_sort(graph, std::front_inserter(sortedVertices), boost::vertex_index_map(v_index_map));
BOOST_LOG_TRIVIAL(info) << "Calculated order: ";
list<boss::Plugin> tempPlugins;
list<loot::Plugin> tempPlugins;
for (std::list<vertex_t>::iterator it = sortedVertices.begin(), endit = sortedVertices.end(); it != endit; ++it) {
BOOST_LOG_TRIVIAL(info) << '\t' << graph[*it].Name();
tempPlugins.push_back(graph[*it]);
@@ -95,13 +95,13 @@ namespace boss {
BGL_FORALL_VERTICES(v, graph, PluginGraph)
put(v_index_map, v, i++);
boss::cycle_detector vis;
loot::cycle_detector vis;
boost::depth_first_search(graph, visitor(vis).vertex_index_map(v_index_map));
}
void AddSpecificEdges(PluginGraph& graph) {
//Add edges for all relationships that aren't overlaps or priority differences.
boss::vertex_it vit, vitend;
loot::vertex_it vit, vitend;
for (boost::tie(vit, vitend) = boost::vertices(graph); vit != vitend; ++vit) {
vertex_t parentVertex;
@@ -109,7 +109,7 @@ namespace boss {
BOOST_LOG_TRIVIAL(trace) << "Adding edges for master flag differences.";
boss::vertex_it vit2 = vit;
loot::vertex_it vit2 = vit;
++vit2;
while (vit2 != vitend) {
@@ -139,7 +139,7 @@ namespace boss {
BOOST_LOG_TRIVIAL(trace) << "Adding in-edges for masters.";
vector<string> strVec(graph[*vit].Masters());
for (vector<string>::const_iterator it=strVec.begin(), itend=strVec.end(); it != itend; ++it) {
if (boss::GetVertexByName(graph, *it, parentVertex) &&
if (loot::GetVertexByName(graph, *it, parentVertex) &&
!boost::edge(parentVertex, *vit, graph).second) {
BOOST_LOG_TRIVIAL(trace) << "Adding edge from \"" << graph[parentVertex].Name() << "\" to \"" << graph[*vit].Name() << "\".";
@@ -150,8 +150,8 @@ namespace boss {
BOOST_LOG_TRIVIAL(trace) << "Adding in-edges for requirements.";
set<File> fileset(graph[*vit].Reqs());
for (set<File>::const_iterator it=fileset.begin(), itend=fileset.end(); it != itend; ++it) {
if (boss::IsPlugin(it->Name()) &&
boss::GetVertexByName(graph, it->Name(), parentVertex) &&
if (loot::IsPlugin(it->Name()) &&
loot::GetVertexByName(graph, it->Name(), parentVertex) &&
!boost::edge(parentVertex, *vit, graph).second) {
BOOST_LOG_TRIVIAL(trace) << "Adding edge from \"" << graph[parentVertex].Name() << "\" to \"" << graph[*vit].Name() << "\".";
@@ -163,8 +163,8 @@ namespace boss {
BOOST_LOG_TRIVIAL(trace) << "Adding in-edges for 'load after's.";
fileset = graph[*vit].LoadAfter();
for (set<File>::const_iterator it=fileset.begin(), itend=fileset.end(); it != itend; ++it) {
if (boss::IsPlugin(it->Name()) &&
boss::GetVertexByName(graph, it->Name(), parentVertex) &&
if (loot::IsPlugin(it->Name()) &&
loot::GetVertexByName(graph, it->Name(), parentVertex) &&
!boost::edge(parentVertex, *vit, graph).second) {
BOOST_LOG_TRIVIAL(trace) << "Adding edge from \"" << graph[parentVertex].Name() << "\" to \"" << graph[*vit].Name() << "\".";
@@ -176,7 +176,7 @@ namespace boss {
}
void AddPriorityEdges(PluginGraph& graph) {
boss::vertex_it vit, vitend;
loot::vertex_it vit, vitend;
for (boost::tie(vit, vitend) = boost::vertices(graph); vit != vitend; ++vit) {
BOOST_LOG_TRIVIAL(trace) << "Adding priority difference edges to vertex for \"" << graph[*vit].Name() << "\".";
@@ -185,7 +185,7 @@ namespace boss {
//as they are for loading BSAs, and in Skyrim that means the resources they load can
//be affected by load order.
boss::vertex_it vit2, vitend2;
loot::vertex_it vit2, vitend2;
for (boost::tie(vit2, vitend2) = boost::vertices(graph); vit2 != vitend2; ++vit2) {
if (graph[*vit].Priority() == graph[*vit2].Priority() || (!graph[*vit].FormIDs().empty() && !graph[*vit2].FormIDs().empty() && !graph[*vit].DoFormIDsOverlap(graph[*vit2]))) {
@@ -215,7 +215,7 @@ namespace boss {
}
void AddOverlapEdges(PluginGraph& graph) {
boss::vertex_it vit, vitend;
loot::vertex_it vit, vitend;
for (boost::tie(vit, vitend) = boost::vertices(graph); vit != vitend; ++vit) {
@@ -226,7 +226,7 @@ namespace boss {
continue;
}
boss::vertex_it vit2, vitend2;
loot::vertex_it vit2, vitend2;
for (boost::tie(vit2, vitend2) = boost::vertices(graph); vit2 != vitend2; ++vit2) {
if (vit == vit2 || boost::edge(*vit, *vit2, graph).second || boost::edge(*vit2, *vit, graph).second)
//Vertices are the same or are already linked.
+2 -2
View File
@@ -34,9 +34,9 @@
#include <boost/graph/topological_sort.hpp>
#include <boost/graph/graphviz.hpp>
namespace boss {
namespace loot {
typedef boost::adjacency_list<boost::listS, boost::listS, boost::bidirectionalS, boss::Plugin> PluginGraph;
typedef boost::adjacency_list<boost::listS, boost::listS, boost::bidirectionalS, loot::Plugin> PluginGraph;
typedef boost::graph_traits<PluginGraph>::vertex_descriptor vertex_t;
typedef boost::graph_traits<PluginGraph>::vertex_iterator vertex_it;
typedef boost::graph_traits<PluginGraph>::edge_descriptor edge_t;
+2 -2
View File
@@ -56,7 +56,7 @@
#endif
#define BUFSIZE 4096
namespace boss {
namespace loot {
using namespace std;
using boost::algorithm::replace_all;
using boost::algorithm::replace_first;
@@ -127,7 +127,7 @@ namespace boss {
uint32_t chksum = 0;
static const size_t buffer_size = 8192;
char buffer[buffer_size];
boss::ifstream ifile(filename, ios::binary);
loot::ifstream ifile(filename, ios::binary);
BOOST_LOG_TRIVIAL(trace) << "Calculating CRC for: " << filename.string();
boost::crc_32_type result;
if (ifile) {
+1 -1
View File
@@ -32,7 +32,7 @@
#include <boost/filesystem.hpp>
#include <boost/regex.hpp>
namespace boss {
namespace loot {
/// Array used to try each of the expressions defined using
/// an iteration for each of them.
+5 -5
View File
@@ -53,7 +53,7 @@
#include <boost/regex.hpp>
#include <boost/log/trivial.hpp>
namespace boss {
namespace loot {
namespace qi = boost::spirit::qi;
namespace unicode = boost::spirit::unicode;
namespace phoenix = boost::phoenix;
@@ -400,7 +400,7 @@ namespace boss {
if (it == varConditionMap.end()) {
BOOST_LOG_TRIVIAL(error) << "The variable \"" << var << "\" was not previously defined.";
throw boss::error(boss::error::condition_eval_fail, "The variable \"" + var + "\" was not previously defined."); //Isn't used by LOOT application, so don't need to translate.
throw loot::error(loot::error::condition_eval_fail, "The variable \"" + var + "\" was not previously defined."); //Isn't used by LOOT application, so don't need to translate.
}
if (ifIfnotStr == "if ")
@@ -792,7 +792,7 @@ namespace boss {
boost::trim(context);
BOOST_LOG_TRIVIAL(error) << "Error parsing at \"" << context << "\", expected \"" << what.tag << "\".";
throw boss::error(boss::error::condition_eval_fail, "Expected \"" + what.tag + "\" at \"" + context + "\"."); //Isn't used by LOOT application, so don't need to translate.
throw loot::error(loot::error::condition_eval_fail, "Expected \"" + what.tag + "\" at \"" + context + "\"."); //Isn't used by LOOT application, so don't need to translate.
}
};
@@ -804,7 +804,7 @@ namespace boss {
grammar.SetGlobalMessageBuffer(&globalMessages);
boss::ifstream ifile(file);
loot::ifstream ifile(file);
ifile.unsetf(std::ios::skipws); // No white space skipping!
std::copy(
@@ -820,7 +820,7 @@ namespace boss {
if (!r || begin != end) {
BOOST_LOG_TRIVIAL(error) << "Failed to read file: " << file.string();
throw boss::error(boss::error::path_read_fail, file.string());
throw loot::error(loot::error::path_read_fail, file.string());
}
}
}
+8 -8
View File
@@ -36,7 +36,7 @@
using namespace std;
namespace boss {
namespace loot {
namespace lc = boost::locale;
@@ -116,7 +116,7 @@ namespace boss {
return _condition;
}
bool ConditionStruct::EvalCondition(boss::Game& game) const {
bool ConditionStruct::EvalCondition(loot::Game& game) const {
if (_condition.empty())
return true;
@@ -138,14 +138,14 @@ namespace boss {
bool r;
try {
r = boost::spirit::qi::phrase_parse(begin, end, grammar, skipper, eval);
} catch (boss::error& e) {
} catch (loot::error& e) {
BOOST_LOG_TRIVIAL(error) << "Failed to parse condition \"" << _condition << "\": " << e.what();
throw boss::error(boss::error::path_read_fail, (boost::format(lc::translate("Failed to parse condition \"%1%\": %2%")) % _condition % e.what()).str());
throw loot::error(loot::error::path_read_fail, (boost::format(lc::translate("Failed to parse condition \"%1%\": %2%")) % _condition % e.what()).str());
}
if (!r || begin != end) {
BOOST_LOG_TRIVIAL(error) << "Failed to parse condition \"" << _condition << "\".";
throw boss::error(boss::error::path_read_fail, (boost::format(lc::translate("Failed to parse condition \"%1%\".")) % _condition).str());
throw loot::error(loot::error::path_read_fail, (boost::format(lc::translate("Failed to parse condition \"%1%\".")) % _condition).str());
}
game.conditionCache.emplace(boost::to_lower_copy(_condition), eval);
@@ -196,7 +196,7 @@ namespace boss {
return (_type == rhs.Type() && _content == rhs.Content());
}
bool Message::EvalCondition(boss::Game& game, const unsigned int language) {
bool Message::EvalCondition(loot::Game& game, const unsigned int language) {
BOOST_LOG_TRIVIAL(trace) << "Choosing message language.";
@@ -303,7 +303,7 @@ namespace boss {
name = name.substr(0, name.length() - 6);
}
Plugin::Plugin(boss::Game& game, const std::string& n, const bool headerOnly)
Plugin::Plugin(loot::Game& game, const std::string& n, const bool headerOnly)
: name(n), enabled(true), priority(0), isMaster(false), crc(0), numOverrideRecords(0), _isPriorityExplicit(false) {
// Get data from file contents using libespm. Assumes libespm has already been initialised.
@@ -563,7 +563,7 @@ namespace boss {
_dirtyInfo = dirtyInfo;
}
void Plugin::EvalAllConditions(boss::Game& game, const unsigned int language) {
void Plugin::EvalAllConditions(loot::Game& game, const unsigned int language) {
for (set<File>::iterator it = loadAfter.begin(); it != loadAfter.end();) {
if (!it->EvalCondition(game))
loadAfter.erase(it++);
+5 -5
View File
@@ -33,7 +33,7 @@
#include <list>
#include <set>
namespace boss {
namespace loot {
//A FormID is a 32 bit unsigned integer of the form xxYYYYYY in hex. The xx is the position in the masters list of the plugin that the FormID is from, and the YYYYYY is the rest of the FormID. Here the xx bit is stored as the corresponding filename to allow comparison between FormIDs from different plugins.
@@ -79,7 +79,7 @@ namespace boss {
ConditionStruct(const std::string& condition);
bool IsConditional() const;
bool EvalCondition(boss::Game& game) const;
bool EvalCondition(loot::Game& game) const;
std::string Condition() const;
private:
@@ -112,7 +112,7 @@ namespace boss {
bool operator < (const Message& rhs) const;
bool operator == (const Message& rhs) const;
bool EvalCondition(boss::Game& game, const unsigned int language);
bool EvalCondition(loot::Game& game, const unsigned int language);
unsigned int Type() const;
std::vector<MessageContent> Content() const;
@@ -157,7 +157,7 @@ namespace boss {
public:
Plugin();
Plugin(const std::string& name);
Plugin(boss::Game& game, const std::string& name, const bool headerOnly);
Plugin(loot::Game& game, const std::string& name, const bool headerOnly);
//Merges from the given plugin into this one, unless there is already equal metadata present.
//For 'enabled' and 'priority' metadata, use the given plugin's values, but if the 'priority' user value is zero, ignore it.
@@ -195,7 +195,7 @@ namespace boss {
void Tags(const std::set<Tag>& tags);
void DirtyInfo(const std::set<PluginDirtyInfo>& info);
void EvalAllConditions(boss::Game& game, const unsigned int language);
void EvalAllConditions(loot::Game& game, const unsigned int language);
bool HasNameOnly() const;
bool IsRegexPlugin() const;
bool LoadsBSA(const Game& game) const;
+11 -11
View File
@@ -39,7 +39,7 @@ using namespace std;
namespace fs = boost::filesystem;
namespace lc = boost::locale;
namespace boss {
namespace loot {
struct pointers_struct {
pointers_struct() : repo(NULL), remote(NULL), cfg(NULL), obj(NULL), commit(NULL) {}
@@ -73,7 +73,7 @@ namespace boss {
giterr_clear();
BOOST_LOG_TRIVIAL(error) << "Git operation failed. Error: " << error_message;
throw boss::error(boss::error::git_error, (boost::format(lc::translate("Git operation failed. Error: %1%")) % error_message).str());
throw loot::error(loot::error::git_error, (boost::format(lc::translate("Git operation failed. Error: %1%")) % error_message).str());
}
int progress_cb(const char *str, int len, void *data) {
@@ -201,7 +201,7 @@ namespace boss {
BOOST_LOG_TRIVIAL(trace) << "Adding the masterlist to the list of files to be checked out.";
boss::ofstream out(game.MasterlistPath().parent_path() / ".git/info/sparse-checkout");
loot::ofstream out(game.MasterlistPath().parent_path() / ".git/info/sparse-checkout");
out << "masterlist.yaml";
@@ -282,23 +282,23 @@ namespace boss {
BOOST_LOG_TRIVIAL(trace) << "Testing masterlist parsing.";
//Now try parsing the masterlist.
list<boss::Message> messages;
list<boss::Plugin> plugins;
list<loot::Message> messages;
list<loot::Plugin> plugins;
try {
boss::ifstream in(game.MasterlistPath());
loot::ifstream in(game.MasterlistPath());
YAML::Node mlist = YAML::Load(in);
in.close();
if (mlist["globals"])
messages = mlist["globals"].as< list<boss::Message> >();
messages = mlist["globals"].as< list<loot::Message> >();
if (mlist["plugins"])
plugins = mlist["plugins"].as< list<boss::Plugin> >();
plugins = mlist["plugins"].as< list<loot::Plugin> >();
for (list<boss::Plugin>::iterator it=plugins.begin(), endIt=plugins.end(); it != endIt; ++it) {
for (list<loot::Plugin>::iterator it=plugins.begin(), endIt=plugins.end(); it != endIt; ++it) {
it->EvalAllConditions(game, g_lang_any);
}
for (list<boss::Message>::iterator it=messages.begin(), endIt=messages.end(); it != endIt; ++it) {
for (list<loot::Message>::iterator it=messages.begin(), endIt=messages.end(); it != endIt; ++it) {
it->EvalCondition(game, g_lang_any);
}
@@ -311,7 +311,7 @@ namespace boss {
//Roll back one revision if there's an error.
BOOST_LOG_TRIVIAL(error) << "Masterlist parsing failed. Masterlist revision " + string(revision) + ": " + e.what();
parsingErrors.push_back(boss::Message(boss::g_message_error, boost::locale::translate("Masterlist revision").str() + " " + string(revision) + ": " + e.what() + " " + boost::locale::translate("Rolled back to the previous revision.").str()));
parsingErrors.push_back(loot::Message(loot::g_message_error, boost::locale::translate("Masterlist revision").str() + " " + string(revision) + ": " + e.what() + " " + boost::locale::translate("Rolled back to the previous revision.").str()));
}
} while (parsingFailed);
+1 -1
View File
@@ -31,7 +31,7 @@
#include "game.h"
#include "metadata.h"
namespace boss {
namespace loot {
std::string UpdateMasterlist(Game& game, std::list<Message>& parsingErrors, std::list<Plugin>& plugins, std::list<Message>& messages);
}
+64 -64
View File
@@ -60,11 +60,11 @@ namespace YAML {
///////////////////////
template<>
struct convert<boss::Game> {
static Node encode(const boss::Game& rhs) {
struct convert<loot::Game> {
static Node encode(const loot::Game& rhs) {
Node node;
node["type"] = boss::Game(rhs.Id()).FolderName();
node["type"] = loot::Game(rhs.Id()).FolderName();
node["name"] = rhs.Name();
node["folder"] = rhs.FolderName();
node["master"] = rhs.Master();
@@ -76,18 +76,18 @@ namespace YAML {
return node;
}
static bool decode(const Node& node, boss::Game& rhs) {
static bool decode(const Node& node, loot::Game& rhs) {
if (!node.IsMap() || !node["folder"] || !node["type"])
return false;
if (node["type"].as<std::string>() == boss::Game(boss::g_game_tes4).FolderName())
rhs = boss::Game(boss::g_game_tes4, node["folder"].as<std::string>());
else if (node["type"].as<std::string>() == boss::Game(boss::g_game_tes5).FolderName())
rhs = boss::Game(boss::g_game_tes5, node["folder"].as<std::string>());
else if (node["type"].as<std::string>() == boss::Game(boss::g_game_fo3).FolderName())
rhs = boss::Game(boss::g_game_fo3, node["folder"].as<std::string>());
else if (node["type"].as<std::string>() == boss::Game(boss::g_game_fonv).FolderName())
rhs = boss::Game(boss::g_game_fonv, node["folder"].as<std::string>());
if (node["type"].as<std::string>() == loot::Game(loot::g_game_tes4).FolderName())
rhs = loot::Game(loot::g_game_tes4, node["folder"].as<std::string>());
else if (node["type"].as<std::string>() == loot::Game(loot::g_game_tes5).FolderName())
rhs = loot::Game(loot::g_game_tes5, node["folder"].as<std::string>());
else if (node["type"].as<std::string>() == loot::Game(loot::g_game_fo3).FolderName())
rhs = loot::Game(loot::g_game_fo3, node["folder"].as<std::string>());
else if (node["type"].as<std::string>() == loot::Game(loot::g_game_fonv).FolderName())
rhs = loot::Game(loot::g_game_fonv, node["folder"].as<std::string>());
else
return false;
@@ -112,8 +112,8 @@ namespace YAML {
};
template<>
struct convert<boss::PluginDirtyInfo> {
static Node encode(const boss::PluginDirtyInfo& rhs) {
struct convert<loot::PluginDirtyInfo> {
static Node encode(const loot::PluginDirtyInfo& rhs) {
Node node;
node["crc"] = rhs.CRC();
node["util"] = rhs.CleaningUtility();
@@ -128,7 +128,7 @@ namespace YAML {
return node;
}
static bool decode(const Node& node, boss::PluginDirtyInfo& rhs) {
static bool decode(const Node& node, loot::PluginDirtyInfo& rhs) {
if (!node.IsMap() || !node["crc"] || !node["util"])
return false;
@@ -144,45 +144,45 @@ namespace YAML {
std::string utility = node["util"].as<std::string>();
rhs = boss::PluginDirtyInfo(crc, itm, udr, nav, utility);
rhs = loot::PluginDirtyInfo(crc, itm, udr, nav, utility);
return true;
}
};
template<>
struct convert<boss::MessageContent> {
static Node encode(const boss::MessageContent& rhs) {
struct convert<loot::MessageContent> {
static Node encode(const loot::MessageContent& rhs) {
Node node;
node["str"] = rhs.Str();
node["lang"] = boss::Language(rhs.Language()).Locale();
node["lang"] = loot::Language(rhs.Language()).Locale();
return node;
}
static bool decode(const Node& node, boss::MessageContent& rhs) {
static bool decode(const Node& node, loot::MessageContent& rhs) {
if (!node.IsMap() || !node["str"] || !node["lang"])
return false;
std::string str = node["str"].as<std::string>();
unsigned int lang = boss::Language(node["lang"].as<std::string>()).Code();
unsigned int lang = loot::Language(node["lang"].as<std::string>()).Code();
rhs = boss::MessageContent(str, lang);
rhs = loot::MessageContent(str, lang);
return true;
}
};
template<>
struct convert<boss::Message> {
static Node encode(const boss::Message& rhs) {
struct convert<loot::Message> {
static Node encode(const loot::Message& rhs) {
Node node;
node["condition"] = rhs.Condition();
node["content"] = rhs.Content();
if (rhs.Type() == boss::g_message_say)
if (rhs.Type() == loot::g_message_say)
node["type"] = "say";
else if (rhs.Type() == boss::g_message_warn)
else if (rhs.Type() == loot::g_message_warn)
node["type"] = "warn";
else
node["type"] = "error";
@@ -190,7 +190,7 @@ namespace YAML {
return node;
}
static bool decode(const Node& node, boss::Message& rhs) {
static bool decode(const Node& node, loot::Message& rhs) {
if(!node.IsMap() || !node["type"] || !node["content"])
return false;
@@ -200,25 +200,25 @@ namespace YAML {
type = node["type"].as<std::string>();
if (boost::iequals(type, "say"))
typeNo = boss::g_message_say;
typeNo = loot::g_message_say;
else if (boost::iequals(type, "warn"))
typeNo = boss::g_message_warn;
typeNo = loot::g_message_warn;
else
typeNo = boss::g_message_error;
typeNo = loot::g_message_error;
}
std::vector<boss::MessageContent> content;
std::vector<loot::MessageContent> content;
if (node["content"].IsSequence())
content = node["content"].as< std::vector<boss::MessageContent> >();
content = node["content"].as< std::vector<loot::MessageContent> >();
else {
content.push_back(boss::MessageContent(node["content"].as<std::string>()));
content.push_back(loot::MessageContent(node["content"].as<std::string>()));
}
//Check now that at least one item in content is English if there are multiple items.
if (content.size() > 1) {
bool found = false;
for (std::vector<boss::MessageContent>::const_iterator it=content.begin(), endit=content.end(); it != endit; ++it) {
if (it->Language() == boss::g_lang_english)
for (std::vector<loot::MessageContent>::const_iterator it=content.begin(), endit=content.end(); it != endit; ++it) {
if (it->Language() == loot::g_lang_english)
found = true;
}
if (!found)
@@ -229,14 +229,14 @@ namespace YAML {
if (node["condition"])
condition = node["condition"].as<std::string>();
rhs = boss::Message(typeNo, content, condition);
rhs = loot::Message(typeNo, content, condition);
return true;
}
};
template<>
struct convert<boss::File> {
static Node encode(const boss::File& rhs) {
struct convert<loot::File> {
static Node encode(const loot::File& rhs) {
Node node;
node["condition"] = rhs.Condition();
node["name"] = rhs.Name();
@@ -244,7 +244,7 @@ namespace YAML {
return node;
}
static bool decode(const Node& node, boss::File& rhs) {
static bool decode(const Node& node, loot::File& rhs) {
if(node.IsMap()) {
std::string condition, name, display;
if (node["condition"])
@@ -253,16 +253,16 @@ namespace YAML {
name = node["name"].as<std::string>();
if (node["display"])
display = node["display"].as<std::string>();
rhs = boss::File(name, display, condition);
rhs = loot::File(name, display, condition);
} else
rhs = boss::File(node.as<std::string>());
rhs = loot::File(node.as<std::string>());
return true;
}
};
template<>
struct convert<boss::Tag> {
static Node encode(const boss::Tag& rhs) {
struct convert<loot::Tag> {
static Node encode(const loot::Tag& rhs) {
Node node;
node["condition"] = rhs.Condition();
if (rhs.IsAddition())
@@ -272,7 +272,7 @@ namespace YAML {
return node;
}
static bool decode(const Node& node, boss::Tag& rhs) {
static bool decode(const Node& node, loot::Tag& rhs) {
std::string condition, tag;
if(node.IsMap()) {
if (node["condition"])
@@ -283,9 +283,9 @@ namespace YAML {
tag = node.as<std::string>();
if (tag[0] == '-')
rhs = boss::Tag(tag.substr(1), false, condition);
rhs = loot::Tag(tag.substr(1), false, condition);
else
rhs = boss::Tag(tag, true, condition);
rhs = loot::Tag(tag, true, condition);
return true;
}
@@ -315,8 +315,8 @@ namespace YAML {
};
template<>
struct convert<boss::Plugin> {
static Node encode(const boss::Plugin& rhs) {
struct convert<loot::Plugin> {
static Node encode(const loot::Plugin& rhs) {
Node node;
node["name"] = rhs.Name();
node["enabled"] = rhs.Enabled();
@@ -331,12 +331,12 @@ namespace YAML {
return node;
}
static bool decode(const Node& node, boss::Plugin& rhs) {
static bool decode(const Node& node, loot::Plugin& rhs) {
if(!node.IsMap())
return false;
if (node["name"])
rhs = boss::Plugin(node["name"].as<std::string>());
rhs = loot::Plugin(node["name"].as<std::string>());
if (node["enabled"])
rhs.Enabled(node["enabled"].as<bool>());
@@ -346,24 +346,24 @@ namespace YAML {
}
if (node["after"])
rhs.LoadAfter(node["after"].as< std::set<boss::File> >());
rhs.LoadAfter(node["after"].as< std::set<loot::File> >());
if (node["req"])
rhs.Reqs(node["req"].as< std::set<boss::File> >());
rhs.Reqs(node["req"].as< std::set<loot::File> >());
if (node["inc"])
rhs.Incs(node["inc"].as< std::set<boss::File> >());
rhs.Incs(node["inc"].as< std::set<loot::File> >());
if (node["msg"])
rhs.Messages(node["msg"].as< std::list<boss::Message> >());
rhs.Messages(node["msg"].as< std::list<loot::Message> >());
if (node["tag"])
rhs.Tags(node["tag"].as< std::set<boss::Tag> >());
rhs.Tags(node["tag"].as< std::set<loot::Tag> >());
if (node["dirty"])
rhs.DirtyInfo(node["dirty"].as< std::set<boss::PluginDirtyInfo> >());
rhs.DirtyInfo(node["dirty"].as< std::set<loot::PluginDirtyInfo> >());
return true;
}
};
}
namespace boss {
namespace loot {
///////////////////////////////
// Condition parser/evaluator
@@ -444,7 +444,7 @@ namespace boss {
qi::on_error<qi::fail>(invalidPathChars, phoenix::bind(&condition_grammar::SyntaxError, this, qi::labels::_1, qi::labels::_2, qi::labels::_3, qi::labels::_4));
}
void SetGame(boss::Game& g) {
void SetGame(loot::Game& g) {
game = &g;
}
@@ -453,7 +453,7 @@ namespace boss {
qi::rule<Iterator, std::string()> quotedStr, filePath, comparator;
qi::rule<Iterator, char()> invalidPathChars;
boss::Game * game;
loot::Game * game;
//Eval's exact paths. Check for files and ghosted plugins.
void CheckFile(bool& result, const std::string& file) {
@@ -467,7 +467,7 @@ namespace boss {
if (!IsSafePath(file)) {
BOOST_LOG_TRIVIAL(error) << "Invalid file path: " << file;
throw boss::error(boss::error::invalid_args, boost::locale::translate("Invalid file path:").str() + " " + file);
throw loot::error(loot::error::invalid_args, boost::locale::translate("Invalid file path:").str() + " " + file);
}
if (IsPlugin(file))
@@ -515,7 +515,7 @@ namespace boss {
if (boost::contains(parent, "../../")){
BOOST_LOG_TRIVIAL(error) << "Invalid folder path: " << parent;
throw boss::error(boss::error::invalid_args, boost::locale::translate("Invalid folder path:").str() + " " + parent);
throw loot::error(loot::error::invalid_args, boost::locale::translate("Invalid folder path:").str() + " " + parent);
}
//Now we have a valid parent path and a regex filename. Check that
@@ -532,7 +532,7 @@ namespace boss {
regex = boost::regex(filename, boost::regex::perl|boost::regex::icase);
} catch (boost::regex_error& e) {
BOOST_LOG_TRIVIAL(error) << "Invalid regex string:" << filename;
throw boss::error(boss::error::invalid_args, boost::locale::translate("Invalid regex string:").str() + " " + filename);
throw loot::error(loot::error::invalid_args, boost::locale::translate("Invalid regex string:").str() + " " + filename);
}
for (boost::filesystem::directory_iterator itr(parent_path); itr != boost::filesystem::directory_iterator(); ++itr) {
@@ -550,7 +550,7 @@ namespace boss {
if (!IsSafePath(file)) {
BOOST_LOG_TRIVIAL(error) << "Invalid file path: " << file;
throw boss::error(boss::error::invalid_args, boost::locale::translate("Invalid file path:").str() + " " + file);
throw loot::error(loot::error::invalid_args, boost::locale::translate("Invalid file path:").str() + " " + file);
}
uint32_t crc;
@@ -627,7 +627,7 @@ namespace boss {
BOOST_LOG_TRIVIAL(error) << "Expected \"" << what.tag << "\" at \"" << context << "\".";
throw boss::error(boss::error::condition_eval_fail, (boost::format(boost::locale::translate("Expected \"%1%\" at \"%2%\".")) % what.tag % context).str());
throw loot::error(loot::error::condition_eval_fail, (boost::format(boost::locale::translate("Expected \"%1%\" at \"%2%\".")) % what.tag % context).str());
}
//Checks that the path (not regex) doesn't go outside any game folders.
+1 -1
View File
@@ -27,7 +27,7 @@
#include <boost/iostreams/stream.hpp>
#include <boost/iostreams/device/file_descriptor.hpp>
namespace boss {
namespace loot {
typedef boost::iostreams::stream< boost::iostreams::file_descriptor_sink > ofstream;
typedef boost::iostreams::stream< boost::iostreams::file_descriptor_source > ifstream;
typedef boost::iostreams::stream< boost::iostreams::file_descriptor > fstream;
+104 -104
View File
File diff suppressed because it is too large Load Diff

Some files were not shown because too many files have changed in this diff Show More