OpenWalnut 1.2.5
Classes | Public Member Functions | Static Public Member Functions | Protected Member Functions | Private Attributes | Static Private Attributes
WPathHelper Class Reference

Singleton class helping to find files and paths. More...

#include <WPathHelper.h>

List of all members.

Classes

struct  Fonts
 Paths to all known fonts. More...

Public Member Functions

virtual ~WPathHelper ()
 Destructor.
void setAppPath (boost::filesystem::path appPath)
 Set the current application path.

Static Public Member Functions

static boost::shared_ptr
< WPathHelper
getPathHelper ()
 Returns instance of the path helper.
static boost::filesystem::path getAppPath ()
 The path where the binary file resides in.
static boost::filesystem::path getFontPath ()
 The path where font files reside in.
static Fonts getAllFonts ()
 The paths to all fonts supported.
static boost::filesystem::path getShaderPath ()
 The path to the global shaders.
static boost::filesystem::path getModulePath ()
 The path to the globally installed modules.
static std::vector
< boost::filesystem::path > 
getAllModulePaths ()
 This returns a list of search paths for modules.
static boost::filesystem::path getLibPath ()
 The path to the OW libs.
static boost::filesystem::path getSharePath ()
 The path where shared files reside in.
static boost::filesystem::path getDocPath ()
 The path where the doc files reside in.
static boost::filesystem::path getConfigPath ()
 The path where the config files reside in.

Protected Member Functions

 WPathHelper ()
 Constructors are protected because this is a Singleton.

Private Attributes

boost::filesystem::path m_appPath
 Application path.
boost::filesystem::path m_sharePath
 The path where all the shared files reside in.
boost::filesystem::path m_docPath
 The path where all the documentation files reside in.
boost::filesystem::path m_configPath
 The path where all the config files reside in.
boost::filesystem::path m_modulePath
 The path to the globally installed modules.
boost::filesystem::path m_libPath
 The path to the OW libs.

Static Private Attributes

static boost::shared_ptr
< WPathHelper
m_instance = boost::shared_ptr< WPathHelper >()
 Singleton instance of WPathHelper.

Detailed Description

Singleton class helping to find files and paths.

It is a useful to to search for resources and the central place to "hardcode" relative paths. It contains global paths only. Modules have their OWN local paths.

Definition at line 43 of file WPathHelper.h.


Constructor & Destructor Documentation

WPathHelper::~WPathHelper ( ) [virtual]

Destructor.

Definition at line 41 of file WPathHelper.cpp.

WPathHelper::WPathHelper ( ) [protected]

Constructors are protected because this is a Singleton.

Definition at line 36 of file WPathHelper.cpp.

Referenced by getPathHelper().


Member Function Documentation

WPathHelper::Fonts WPathHelper::getAllFonts ( ) [static]

The paths to all fonts supported.

Returns:
the file paths to all fonts

Definition at line 81 of file WPathHelper.cpp.

References WPathHelper::Fonts::Bold, WPathHelper::Fonts::Default, getFontPath(), WPathHelper::Fonts::Italic, and WPathHelper::Fonts::Regular.

Referenced by wge::addLabel(), WGELabel::WGELabel(), and WGETextureHud::WGETextureHudEntry::WGETextureHudEntry().

std::vector< boost::filesystem::path > WPathHelper::getAllModulePaths ( ) [static]

This returns a list of search paths for modules.

This list is defined by the environment variable "OW_MODULE_PATH". All of these directories CAN contain modules. On startup, they get searched in the specified order.

Returns:
list of search paths for modules

Definition at line 117 of file WPathHelper.cpp.

References getModulePath().

Referenced by WModuleLoader::load().

boost::filesystem::path WPathHelper::getAppPath ( ) [static]

The path where the binary file resides in.

This is for example /usr/bin.

Returns:
the application path.

Definition at line 66 of file WPathHelper.cpp.

References getPathHelper().

boost::filesystem::path WPathHelper::getConfigPath ( ) [static]

The path where the config files reside in.

Returns:
the config file path.

Definition at line 112 of file WPathHelper.cpp.

References getPathHelper().

boost::filesystem::path WPathHelper::getDocPath ( ) [static]

The path where the doc files reside in.

Returns:
the doc file path.

Definition at line 107 of file WPathHelper.cpp.

References getPathHelper().

boost::filesystem::path WPathHelper::getFontPath ( ) [static]

The path where font files reside in.

Returns:
the font path.

Definition at line 71 of file WPathHelper.cpp.

References getPathHelper().

Referenced by getAllFonts(), and WGraphicsEngine::WGraphicsEngine().

boost::filesystem::path WPathHelper::getLibPath ( ) [static]

The path to the OW libs.

You normally should not need this.

Returns:
the path to the libs.

Definition at line 97 of file WPathHelper.cpp.

References getPathHelper().

boost::filesystem::path WPathHelper::getModulePath ( ) [static]

The path to the globally installed modules.

This does not respect any environment variables or config options! Use this only to search global modules. To get a list of all module search paths, including user defined ones, use getAllModulePaths().

Returns:
path to globally installed modules.

Definition at line 92 of file WPathHelper.cpp.

References getPathHelper().

Referenced by getAllModulePaths().

boost::shared_ptr< WPathHelper > WPathHelper::getPathHelper ( ) [static]

Returns instance of the path helper.

If it does not exists, it will be created.

Returns:
the running path helper instance.

Definition at line 46 of file WPathHelper.cpp.

References m_instance, and WPathHelper().

Referenced by getAppPath(), getConfigPath(), getDocPath(), getFontPath(), getLibPath(), getModulePath(), getShaderPath(), and getSharePath().

boost::filesystem::path WPathHelper::getShaderPath ( ) [static]

The path to the global shaders.

Modules usually have their own local shader directory.

Returns:
global shader path.

Definition at line 76 of file WPathHelper.cpp.

References getPathHelper().

Referenced by WGEShader::processShaderRecursive().

boost::filesystem::path WPathHelper::getSharePath ( ) [static]

The path where shared files reside in.

Returns:
the shared files path.

Definition at line 102 of file WPathHelper.cpp.

References getPathHelper().

void WPathHelper::setAppPath ( boost::filesystem::path  appPath)

Set the current application path.

This should be called only once.

Parameters:
appPaththe application path

Definition at line 56 of file WPathHelper.cpp.

References m_appPath, m_configPath, m_docPath, m_libPath, m_modulePath, and m_sharePath.


Member Data Documentation

boost::filesystem::path WPathHelper::m_appPath [private]

Application path.

NOT the path of the binary. The application path is the directory in which the binary is placed. The binary path is m_appPath+"/openwalnut".

Definition at line 178 of file WPathHelper.h.

Referenced by setAppPath().

boost::filesystem::path WPathHelper::m_configPath [private]

The path where all the config files reside in.

Definition at line 193 of file WPathHelper.h.

Referenced by setAppPath().

boost::filesystem::path WPathHelper::m_docPath [private]

The path where all the documentation files reside in.

Definition at line 188 of file WPathHelper.h.

Referenced by setAppPath().

boost::shared_ptr< WPathHelper > WPathHelper::m_instance = boost::shared_ptr< WPathHelper >() [static, private]

Singleton instance of WPathHelper.

Definition at line 208 of file WPathHelper.h.

Referenced by getPathHelper().

boost::filesystem::path WPathHelper::m_libPath [private]

The path to the OW libs.

Definition at line 203 of file WPathHelper.h.

Referenced by setAppPath().

boost::filesystem::path WPathHelper::m_modulePath [private]

The path to the globally installed modules.

Definition at line 198 of file WPathHelper.h.

Referenced by setAppPath().

boost::filesystem::path WPathHelper::m_sharePath [private]

The path where all the shared files reside in.

Definition at line 183 of file WPathHelper.h.

Referenced by setAppPath().


The documentation for this class was generated from the following files:
 All Classes Namespaces Functions Variables Typedefs Enumerations Enumerator Friends