diff --git a/docs/LOOT Metadata Syntax.html b/docs/LOOT Metadata Syntax.html index 9e145681..678a048a 100644 --- a/docs/LOOT Metadata Syntax.html +++ b/docs/LOOT Metadata Syntax.html @@ -112,7 +112,7 @@ h3{

Please test any changes you make before uploading them. One way of doing this is to run LOOT, another is to copy/paste what you've changed into here, though it won't catch condition syntax errors and doesn't use the same parser as LOOT so may give different results. diff --git a/src/api/api.cpp b/src/api/api.cpp index 5b28eab9..2ccebea7 100644 --- a/src/api/api.cpp +++ b/src/api/api.cpp @@ -36,13 +36,13 @@ #include #include #include +#include +#include +#include -#include #include #include #include -#include -#include const unsigned int loot_ok = loot::error::ok; const unsigned int loot_error_liblo_error = loot::error::liblo_error; diff --git a/src/backend/game.cpp b/src/backend/game.cpp index c36c05ab..de60d962 100644 --- a/src/backend/game.cpp +++ b/src/backend/game.cpp @@ -524,7 +524,7 @@ namespace loot { } } - for (boost::unordered_map::iterator it = plugins.begin(), itend = plugins.end(); it != itend; ++it) { + for (unordered_map::iterator it = plugins.begin(), itend = plugins.end(); it != itend; ++it) { it->second = Plugin(*this, it->second.Name(), headersOnly); } } diff --git a/src/backend/game.h b/src/backend/game.h index 2574306a..b0a63aed 100644 --- a/src/backend/game.h +++ b/src/backend/game.h @@ -29,11 +29,11 @@ #include #include -#include +#include +#include +#include #include -#include -#include #include #include @@ -93,13 +93,13 @@ namespace loot { void LoadPlugins(bool headersOnly); //Loads all installed plugins. //Caches for condition results, active plugins and CRCs. - boost::unordered_map conditionCache; //Holds lowercased strings. - boost::unordered_map crcCache; //Holds lowercased strings. + std::unordered_map conditionCache; //Holds lowercased strings. + std::unordered_map crcCache; //Holds lowercased strings. //Plugin data and metadata lists. MetadataList masterlist; MetadataList userlist; - boost::unordered_map plugins; //Map so that plugin data can be edited. + std::unordered_map plugins; //Map so that plugin data can be edited. espm::Settings espm_settings; @@ -121,7 +121,7 @@ namespace loot { boost::filesystem::path gamePath; //Path to the game's folder. - boost::unordered_set activePlugins; //Holds lowercased strings. + std::unordered_set activePlugins; //Holds lowercased strings. //Creates directory in LOOT folder for LOOT's game-specific files. void CreateLOOTGameFolder(); diff --git a/src/backend/generators.cpp b/src/backend/generators.cpp index 7215895b..a7e82267 100644 --- a/src/backend/generators.cpp +++ b/src/backend/generators.cpp @@ -245,7 +245,7 @@ namespace loot { yout << YAML::BeginMap; yout << YAML::Key << "lootVersion" - << YAML::Value << IntToString(g_version_major) + "." + IntToString(g_version_minor) + "." + IntToString(g_version_patch); + << YAML::Value << std::to_string(g_version_major) + "." + std::to_string(g_version_minor) + "." + std::to_string(g_version_patch); yout << YAML::Key << "masterlist" << YAML::BeginMap diff --git a/src/backend/graph.h b/src/backend/graph.h index 16f27db7..0adfa890 100644 --- a/src/backend/graph.h +++ b/src/backend/graph.h @@ -28,7 +28,8 @@ #include "metadata.h" #include "error.h" -#include +#include + #include #include #include diff --git a/src/backend/helpers.cpp b/src/backend/helpers.cpp index bc921f33..0345bd98 100644 --- a/src/backend/helpers.cpp +++ b/src/backend/helpers.cpp @@ -29,7 +29,6 @@ #include #include #include -#include #include #include #include @@ -38,11 +37,11 @@ #include #include -#include -#include -#include -#include +#include +#include +#include #include +#include #if _WIN32 || _WIN64 # ifndef UNICODE @@ -108,14 +107,14 @@ namespace loot { /// Array used to try each of the expressions defined above using /// an iteration for each of them. - boost::regex version_checks[7] = { - boost::regex(regex1, boost::regex::icase), - boost::regex(regex2, boost::regex::icase), - boost::regex(regex3, boost::regex::icase), - boost::regex(regex4, boost::regex::icase), - boost::regex(regex5, boost::regex::icase), //This incorrectly identifies "OBSE v19" where 19 is any integer. - boost::regex(regex6, boost::regex::icase), //This is responsible for metallicow's false positive. - boost::regex(regex7, boost::regex::icase) + regex version_checks[7] = { + regex(regex1, regex::ECMAScript | regex::icase), + regex(regex2, regex::ECMAScript | regex::icase), + regex(regex3, regex::ECMAScript | regex::icase), + regex(regex4, regex::ECMAScript | regex::icase), + regex(regex5, regex::ECMAScript | regex::icase), //This incorrectly identifies "OBSE v19" where 19 is any integer. + regex(regex6, regex::ECMAScript | regex::icase), //This is responsible for metallicow's false positive. + regex(regex7, regex::ECMAScript | regex::icase) }; ////////////////////////////////////////////////////////////////////////// @@ -154,14 +153,6 @@ namespace loot { return chksum; } - //Converts an integer to a string using BOOST's Spirit.Karma, which is apparently a lot faster than a stringstream conversion... - std::string IntToString(const int n) { - string out; - back_insert_iterator sink(out); - karma::generate(sink,karma::upper[karma::int_],n); - return out; - } - //Converts an integer to a hex string using BOOST's Spirit.Karma, which is apparently a lot faster than a stringstream conversion... std::string IntToHexString(const int n) { string out; @@ -334,7 +325,7 @@ namespace loot { delete [] point; - verString = IntToString(dwLeftMost) + '.' + IntToString(dwSecondLeft) + '.' + IntToString(dwSecondRight) + '.' + IntToString(dwRightMost); + verString = to_string(dwLeftMost) + '.' + to_string(dwSecondLeft) + '.' + to_string(dwSecondRight) + '.' + to_string(dwRightMost); } #else // ensure filename has no quote characters in it to avoid command injection attacks @@ -367,11 +358,11 @@ namespace loot { bool Version::operator < (Version ver) { //Version string could have a wide variety of formats. Use regex to choose specific comparison types. - boost::regex reg1("(\\d+\\.?)+"); //a.b.c.d.e.f.... where the letters are all integers, and 'a' is the shortest possible match. + regex reg1("(\\d+\\.?)+"); //a.b.c.d.e.f.... where the letters are all integers, and 'a' is the shortest possible match. //boost::regex reg2("(\\d+\\.?)+([a-zA-Z\\-]+(\\d+\\.?)*)+"); //Matches a mix of letters and numbers - from "0.99.xx", "1.35Alpha2", "0.9.9MB8b1", "10.52EV-D", "1.62EV" to "10.0EV-D1.62EV". - if (boost::regex_match(verString, reg1) && boost::regex_match(ver.AsString(), reg1)) { + if (regex_match(verString, reg1) && regex_match(ver.AsString(), reg1)) { //First type: numbers separated by periods. If two versions have a different number of numbers, then the shorter should be padded //with zeros. An arbitrary number of numbers should be supported. istringstream parser1(verString); diff --git a/src/backend/helpers.h b/src/backend/helpers.h index 8299ca76..7fcf55f9 100644 --- a/src/backend/helpers.h +++ b/src/backend/helpers.h @@ -27,16 +27,16 @@ #include "metadata.h" -#include +#include #include +#include #include -#include namespace loot { /// Array used to try each of the expressions defined using /// an iteration for each of them. - extern boost::regex version_checks[7]; + extern std::regex version_checks[7]; ////////////////////////////////////////////////////////////////////////// // Helper functions @@ -48,9 +48,6 @@ namespace loot { //Calculate the CRC of the given file for comparison purposes. uint32_t GetCrc32(const boost::filesystem::path& filename); - //Converts an integer to a string using BOOST's Spirit.Karma. Faster than a stringstream conversion. - std::string IntToString(const int n); - //Converts an integer to a hex string using BOOST's Spirit.Karma. Faster than a stringstream conversion. std::string IntToHexString(const int n); diff --git a/src/backend/metadata.cpp b/src/backend/metadata.cpp index 97b29171..f729b2b3 100644 --- a/src/backend/metadata.cpp +++ b/src/backend/metadata.cpp @@ -27,11 +27,12 @@ #include "parsers.h" #include "streams.h" +#include + #include #include #include -#include #include #include @@ -123,7 +124,7 @@ namespace loot { BOOST_LOG_TRIVIAL(trace) << "Evaluating condition: " << _condition; - boost::unordered_map::const_iterator it = game.conditionCache.find(boost::to_lower_copy(_condition)); + unordered_map::const_iterator it = game.conditionCache.find(boost::to_lower_copy(_condition)); if (it != game.conditionCache.end()) return it->second; @@ -371,12 +372,12 @@ namespace loot { BOOST_LOG_TRIVIAL(trace) << name << ": " << "Attempting to read the version from the description."; for(int j = 0; j < 7 && version.empty(); j++) { - boost::smatch what; - while (boost::regex_search(begin, end, what, version_checks[j])) { + smatch what; + while (regex_search(begin, end, what, version_checks[j])) { if (what.empty()) continue; - boost::ssub_match match = what[1]; + ssub_match match = what[1]; if (!match.matched) continue; @@ -608,7 +609,7 @@ namespace loot { //First need to get plugin's CRC. uint32_t crc = 0; - boost::unordered_map::iterator it = game.crcCache.find(boost::to_lower_copy(name)); + unordered_map::iterator it = game.crcCache.find(boost::to_lower_copy(name)); if (it != game.crcCache.end()) crc = it->second; else if (boost::filesystem::exists(game.DataPath() / name)) { diff --git a/src/backend/metadata.h b/src/backend/metadata.h index 53621b10..f7d76591 100644 --- a/src/backend/metadata.h +++ b/src/backend/metadata.h @@ -26,7 +26,7 @@ #include "globals.h" -#include +#include #include #include #include diff --git a/src/backend/network.cpp b/src/backend/network.cpp index 32a6ebeb..226a9b4c 100644 --- a/src/backend/network.cpp +++ b/src/backend/network.cpp @@ -63,9 +63,9 @@ namespace loot { const git_error * last_error = giterr_last(); std::string error_message; if (last_error == NULL) - error_message = IntToString(error_code) + "."; + error_message = to_string(error_code) + "."; else - error_message = IntToString(error_code) + "; " + last_error->message; + error_message = to_string(error_code) + "; " + last_error->message; free(); giterr_clear(); @@ -275,7 +275,7 @@ namespace loot { string revision, date; git.ui_message = "An error occurred while trying to read information on the updated masterlist. If this error happens again, try deleting the \".git\" folder in \"%LOCALAPPDATA%\\LOOT\\" + game.FolderName() + "\"."; do { - string filespec = "refs/remotes/origin/" + game.RepoBranch() + "~" + IntToString(rollbacks); + string filespec = "refs/remotes/origin/" + game.RepoBranch() + "~" + to_string(rollbacks); BOOST_LOG_TRIVIAL(info) << "Getting the Git object for the tree at " << filespec; git.call(git_revparse_single(&git.obj, git.repo, filespec.c_str())); diff --git a/src/backend/parsers.h b/src/backend/parsers.h index 57779778..3a6225fb 100644 --- a/src/backend/parsers.h +++ b/src/backend/parsers.h @@ -38,11 +38,11 @@ #include "helpers.h" #include "error.h" -#include +#include +#include #include -#include #include #include #include @@ -555,7 +555,7 @@ namespace loot { } uint32_t crc; - boost::unordered_map::iterator it = game->crcCache.find(boost::to_lower_copy(file)); + unordered_map::iterator it = game->crcCache.find(boost::to_lower_copy(file)); if (it != game->crcCache.end()) crc = it->second; diff --git a/src/gui/editor.cpp b/src/gui/editor.cpp index 17bde129..a647fa70 100644 --- a/src/gui/editor.cpp +++ b/src/gui/editor.cpp @@ -248,7 +248,7 @@ MiniEditor::MiniEditor(wxWindow *parent, const wxString& title, const std::list< int i = 0; for (list::const_iterator it = _basePlugins.begin(); it != _basePlugins.end(); ++it) { pluginList->InsertItem(i, FromUTF8(it->Name())); - pluginList->SetItem(i, 1, FromUTF8(loot::IntToString(loot::modulo(it->Priority(), loot::max_priority)))); + pluginList->SetItem(i, 1, FromUTF8(to_string(loot::modulo(it->Priority(), loot::max_priority)))); if (abs(it->Priority()) >= loot::max_priority) pluginList->SetItem(i, 2, FromUTF8("\xE2\x9C\x93")); else @@ -286,7 +286,7 @@ void MiniEditor::OnPluginSelect(wxListEvent& event) { if (!currentPlugin.empty()) { ApplyEdits(currentPlugin, pluginList); //Also update the item's priority value in the plugins list in case it has changed. - pluginList->SetItem(pluginList->FindItem(-1, currentPlugin), 1, FromUTF8(loot::IntToString(prioritySpin->GetValue()))); + pluginList->SetItem(pluginList->FindItem(-1, currentPlugin), 1, FromUTF8(to_string(prioritySpin->GetValue()))); if (priorityCheckbox->IsChecked()) pluginList->SetItem(pluginList->FindItem(-1, currentPlugin), 2, FromUTF8("\xE2\x9C\x93")); else @@ -382,7 +382,7 @@ void MiniEditor::OnFilterToggle(wxCommandEvent& event) { //or which load a BSA (if the selected plugin loads a BSA). if (*it == *pos || !it->MustLoadAfter(*pos) && (pos->DoFormIDsOverlap(*it) || (loadsBSA && it->LoadsBSA(_game)))) { pluginList->InsertItem(i, FromUTF8(it->Name())); - pluginList->SetItem(i, 1, FromUTF8(loot::IntToString(it->Priority()))); + pluginList->SetItem(i, 1, FromUTF8(to_string(it->Priority()))); if (it->FormIDs().empty()) { pluginList->SetItemTextColour(i, wxColour(122, 122, 122)); } @@ -402,7 +402,7 @@ void MiniEditor::OnFilterToggle(wxCommandEvent& event) { int i = 0; for (list::const_iterator it = plugins.begin(); it != plugins.end(); ++it) { pluginList->InsertItem(i, FromUTF8(it->Name())); - pluginList->SetItem(i, 1, FromUTF8(loot::IntToString(it->Priority()))); + pluginList->SetItem(i, 1, FromUTF8(to_string(it->Priority()))); if (it->FormIDs().empty()) { pluginList->SetItemTextColour(i, wxColour(122, 122, 122)); } @@ -732,7 +732,7 @@ void Editor::OnPluginSelect(wxListEvent& event) { pluginList->SetItem(pluginList->FindItem(-1, currentPlugin), 0, FromUTF8("\xE2\x9C\x97")); } //Also update the item's priority value in the plugins list in case it has changed. - pluginList->SetItem(pluginList->FindItem(-1, currentPlugin), 2, FromUTF8(loot::IntToString(prioritySpin->GetValue()))); + pluginList->SetItem(pluginList->FindItem(-1, currentPlugin), 2, FromUTF8(to_string(prioritySpin->GetValue()))); if (priorityCheckbox->IsChecked()) pluginList->SetItem(pluginList->FindItem(-1, currentPlugin), 3, FromUTF8("\xE2\x9C\x93")); else @@ -826,9 +826,9 @@ void Editor::OnPluginSelect(wxListEvent& event) { i=0; for (set::const_iterator it=dirtyInfo.begin(), endit=dirtyInfo.end(); it != endit; ++it) { dirtyList->InsertItem(i, FromUTF8(loot::IntToHexString(it->CRC()))); - dirtyList->SetItem(i, 1, FromUTF8(loot::IntToString(it->ITMs()))); - dirtyList->SetItem(i, 2, FromUTF8(loot::IntToString(it->UDRs()))); - dirtyList->SetItem(i, 3, FromUTF8(loot::IntToString(it->DeletedNavmeshes()))); + dirtyList->SetItem(i, 1, FromUTF8(to_string(it->ITMs()))); + dirtyList->SetItem(i, 2, FromUTF8(to_string(it->UDRs()))); + dirtyList->SetItem(i, 3, FromUTF8(to_string(it->DeletedNavmeshes()))); dirtyList->SetItem(i, 4, FromUTF8(it->CleaningUtility())); ++i; } @@ -1038,9 +1038,9 @@ void Editor::OnAddRow(wxCommandEvent& event) { long i = tagsList->GetItemCount(); dirtyList->InsertItem(i, rowDialog->GetCRC()); - dirtyList->SetItem(i, 1, FromUTF8(loot::IntToString(rowDialog->GetITMs()))); - dirtyList->SetItem(i, 2, FromUTF8(loot::IntToString(rowDialog->GetUDRs()))); - dirtyList->SetItem(i, 3, FromUTF8(loot::IntToString(rowDialog->GetDeletedNavmeshes()))); + dirtyList->SetItem(i, 1, FromUTF8(to_string(rowDialog->GetITMs()))); + dirtyList->SetItem(i, 2, FromUTF8(to_string(rowDialog->GetUDRs()))); + dirtyList->SetItem(i, 3, FromUTF8(to_string(rowDialog->GetDeletedNavmeshes()))); dirtyList->SetItem(i, 4, rowDialog->GetUtility()); } } @@ -1134,9 +1134,9 @@ void Editor::OnEditRow(wxCommandEvent& event) { } dirtyList->SetItem(i, 0, rowDialog->GetCRC()); - dirtyList->SetItem(i, 1, FromUTF8(loot::IntToString(rowDialog->GetITMs()))); - dirtyList->SetItem(i, 2, FromUTF8(loot::IntToString(rowDialog->GetUDRs()))); - dirtyList->SetItem(i, 3, FromUTF8(loot::IntToString(rowDialog->GetDeletedNavmeshes()))); + dirtyList->SetItem(i, 1, FromUTF8(to_string(rowDialog->GetITMs()))); + dirtyList->SetItem(i, 2, FromUTF8(to_string(rowDialog->GetUDRs()))); + dirtyList->SetItem(i, 3, FromUTF8(to_string(rowDialog->GetDeletedNavmeshes()))); dirtyList->SetItem(i, 4, rowDialog->GetUtility()); } } @@ -1458,7 +1458,7 @@ void Editor::AddPluginToList(const loot::Plugin& plugin, int position) { pluginList->InsertItem(position, ""); pluginList->SetItem(position, 1, FromUTF8(plugin.Name())); - pluginList->SetItem(position, 2, FromUTF8(loot::IntToString(loot::modulo(plugin.Priority(), loot::max_priority)))); + pluginList->SetItem(position, 2, FromUTF8(to_string(loot::modulo(plugin.Priority(), loot::max_priority)))); if (abs(plugin.Priority()) >= loot::max_priority) pluginList->SetItem(position, 3, FromUTF8("\xE2\x9C\x93")); else diff --git a/src/gui/main.cpp b/src/gui/main.cpp index c9ac6db7..daabc993 100644 --- a/src/gui/main.cpp +++ b/src/gui/main.cpp @@ -42,6 +42,7 @@ #include #include #include +#include #include #include @@ -54,8 +55,7 @@ #include #include #include -#include -#include +#include #include #include @@ -632,7 +632,7 @@ void Launcher::OnAbout(wxCommandEvent& event) { BOOST_LOG_TRIVIAL(debug) << "Opening About dialog."; wxAboutDialogInfo aboutInfo; aboutInfo.SetName("LOOT"); - aboutInfo.SetVersion(IntToString(g_version_major) + "." + IntToString(g_version_minor) + "." + IntToString(g_version_patch)); + aboutInfo.SetVersion(to_string(g_version_major) + "." + to_string(g_version_minor) + "." + to_string(g_version_patch)); aboutInfo.SetDescription(translate("Load order optimisation for Oblivion, Skyrim, Fallout 3 and Fallout: New Vegas.")); aboutInfo.SetCopyright("Copyright (C) 2012-2014 LOOT Team."); aboutInfo.SetWebSite("http://loot.github.io"); @@ -1003,7 +1003,7 @@ void Launcher::OnEditMetadata(wxCommandEvent& event) { list loadOrder; _game->GetLoadOrder(loadOrder); for (list::const_iterator it = loadOrder.begin(), itend = loadOrder.end(); it != itend; ++it) { - boost::unordered_map::const_iterator pos = _game->plugins.find(*it); + unordered_map::const_iterator pos = _game->plugins.find(*it); if (pos != _game->plugins.end()) installed.push_back(pos->second);