1
0
Fork 1
mirror of https://github.com/TES3MP/openmw-tes3mp.git synced 2025-01-31 10:45:32 +00:00
openmw-tes3mp/components/files/configurationmanager.hpp
cc9cii b920e1bde7 Support MSVC 2015. Tested(*) with updated dependencies:
- Microsoft Visual Studio Community 2015 Version 14.0.23107.0 D14REL
- Qt 5.5, commit 1d3966833b5f27fb262f2d3727557ef2c8947828
- SDL2 default branch, Changeset: 9834 (d3fa6d0d3793)
- Ogre default branch, Changeset: 8048 (19479be2c7c5)
- Boost 1.59, commit 9a02cf8eb34eb31f0858c223ce95319f103addfa
- OpenAL commit 8fa4f276f89985be44007ce166109837cbfd5763

(*) only tested compilation and startup of the each app
2015-08-12 06:50:22 +10:00

82 lines
2.4 KiB
C++

#ifndef COMPONENTS_FILES_CONFIGURATIONMANAGER_HPP
#define COMPONENTS_FILES_CONFIGURATIONMANAGER_HPP
#if defined(_WIN32) && !defined(__MINGW32__)
#if (_MSC_VER >= 1900)
#include <unordered_map>
#else
#include <boost/unordered_map.hpp>
#endif
#elif defined HAVE_UNORDERED_MAP
#include <unordered_map>
#else
#include <tr1/unordered_map>
#endif
#include <boost/program_options.hpp>
#include <components/files/fixedpath.hpp>
#include <components/files/collections.hpp>
/**
* \namespace Files
*/
namespace Files
{
/**
* \struct ConfigurationManager
*/
struct ConfigurationManager
{
ConfigurationManager(bool silent=false); /// @param silent Emit log messages to cout?
virtual ~ConfigurationManager();
void readConfiguration(boost::program_options::variables_map& variables,
boost::program_options::options_description& description, bool quiet=false);
void processPaths(Files::PathContainer& dataDirs, bool create = false);
///< \param create Try creating the directory, if it does not exist.
/**< Fixed paths */
const boost::filesystem::path& getGlobalPath() const;
const boost::filesystem::path& getUserConfigPath() const;
const boost::filesystem::path& getLocalPath() const;
const boost::filesystem::path& getGlobalDataPath() const;
const boost::filesystem::path& getUserDataPath() const;
const boost::filesystem::path& getLocalDataPath() const;
const boost::filesystem::path& getInstallPath() const;
const boost::filesystem::path& getCachePath() const;
const boost::filesystem::path& getLogPath() const;
private:
typedef Files::FixedPath<> FixedPathType;
typedef const boost::filesystem::path& (FixedPathType::*path_type_f)() const;
#if defined HAVE_UNORDERED_MAP
typedef std::unordered_map<std::string, path_type_f> TokensMappingContainer;
#else
typedef std::tr1::unordered_map<std::string, path_type_f> TokensMappingContainer;
#endif
void loadConfig(const boost::filesystem::path& path,
boost::program_options::variables_map& variables,
boost::program_options::options_description& description);
void setupTokensMapping();
FixedPathType mFixedPath;
boost::filesystem::path mLogPath;
TokensMappingContainer mTokensMapping;
bool mSilent;
};
} /* namespace Cfg */
#endif /* COMPONENTS_FILES_CONFIGURATIONMANAGER_HPP */