1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65
|
#pragma once
#include "imodule.h"
#include <vector>
namespace radiant
{
class ApplicationContextBase :
public IApplicationContext
{
private:
// The app + home paths
std::string _appPath;
std::string _homePath;
std::string _settingsPath;
std::string _cachePath;
std::string _bitmapsPath;
// The path where the .map files are stored
std::string _mapsPath;
// Command line arguments
std::vector<std::string> _cmdLineArgs;
// A function pointer to a global error handler, used for ASSERT_MESSAGE
ErrorHandlingFunction _errorHandler;
protected:
static const std::string PLUGINS_DIR; ///< name of plugins directory
static const std::string MODULES_DIR; ///< name of modules directory
public:
/**
* Initialises the context with the arguments given to main().
*/
virtual void initialise(int argc, char* argv[]);
/* ApplicationContext implementation */
virtual std::string getApplicationPath() const override;
virtual std::vector<std::string> getLibraryPaths() const override;
virtual std::string getRuntimeDataPath() const override;
virtual std::string getHTMLPath() const override;
virtual std::string getSettingsPath() const override;
virtual std::string getCacheDataPath() const override;
virtual std::string getBitmapsPath() const override;
const ArgumentList& getCmdLineArgs() const override;
const ErrorHandlingFunction& getErrorHandlingFunction() const override;
protected:
void setErrorHandlingFunction(const ErrorHandlingFunction& function);
// The platform-specific path where any library folders like modules/ and plugins/ are stored
std::string getLibraryBasePath() const;
private:
// Sets up the bitmap path and settings path
void initPaths();
// Initialises the arguments
void initArgs(int argc, char* argv[]);
};
} // namespace radiant
|