Core/Database: Include cleanup

This commit is contained in:
Shauren
2017-05-12 18:49:51 +02:00
parent 8fdf0778ca
commit 7e538980a2
86 changed files with 1127 additions and 922 deletions

View File

@@ -16,28 +16,41 @@
*/
#include "UpdateFetcher.h"
#include "Common.h"
#include "DBUpdater.h"
#include "Field.h"
#include "Log.h"
#include "QueryResult.h"
#include "Util.h"
#include "SHA1.h"
#include <boost/filesystem/operations.hpp>
#include <fstream>
#include <chrono>
#include <vector>
#include <sstream>
#include <exception>
#include <unordered_map>
using namespace boost::filesystem;
struct UpdateFetcher::DirectoryEntry
{
DirectoryEntry(Path const& path_, State state_) : path(path_), state(state_) { }
Path const path;
State const state;
};
UpdateFetcher::UpdateFetcher(Path const& sourceDirectory,
std::function<void(std::string const&)> const& apply,
std::function<void(Path const& path)> const& applyFile,
std::function<QueryResult(std::string const&)> const& retrieve) :
_sourceDirectory(sourceDirectory), _apply(apply), _applyFile(applyFile),
_sourceDirectory(Trinity::make_unique<Path>(sourceDirectory)), _apply(apply), _applyFile(applyFile),
_retrieve(retrieve)
{
}
UpdateFetcher::~UpdateFetcher()
{
}
UpdateFetcher::LocaleFileStorage UpdateFetcher::GetFileList() const
{
LocaleFileStorage files;
@@ -95,7 +108,7 @@ UpdateFetcher::DirectoryStorage UpdateFetcher::ReceiveIncludedDirectories() cons
std::string path = fields[0].GetString();
if (path.substr(0, 1) == "$")
path = _sourceDirectory.generic_string() + path.substr(1);
path = _sourceDirectory->generic_string() + path.substr(1);
Path const p(path);
@@ -405,3 +418,8 @@ void UpdateFetcher::UpdateState(std::string const& name, State const state) cons
// Update database
_apply(update);
}
bool UpdateFetcher::PathCompare::operator()(LocaleFileEntry const& left, LocaleFileEntry const& right) const
{
return left.first.filename().string() < right.first.filename().string();
}