ContRap-Core
|
Class Options implements a singleton options container. More...
#include <options.h>
Public Member Functions | |
virtual | ~Options () |
Cleans up memory. | |
void | update_cache () |
Updates the cache information. | |
const std::vector< std::string > & | get_search_paths () const |
Returns the search paths were ContRap looks for plugins. | |
const std::vector< std::string > & | get_template_paths () const |
Returns the search paths were ContRap looks for templates. | |
const std::string & | get_install_path () |
Returns the installation path of ContRap. | |
void | add_template_path (const std::string &path) |
Adds a template path manually. | |
void | set_arguments (int argc, char **argv) |
Sets the command line arguments. | |
int & | get_argc () |
Returns the command line arguments count given by the application. | |
char ** | get_argv () |
Returns the values of the command line arguments. | |
std::string | find_file (const std::string &file_name) |
Returns the full path to a file with the given name within the range of paths interesting for ContRap. | |
std::string | find_icon (const std::string &file_name) |
Returns the full path to an icon with the given name within the range of paths interesting for ContRap. | |
std::string | find_template (const std::string &path) |
Returns the full path to a template with the given name within the range of paths interesting for ContRap. | |
void | set_worksheet (bool status) |
Sets the worksheet mode. | |
bool | is_worksheet () |
Returns true if the core library was initialized in worksheet mode. | |
Static Public Member Functions | |
static Options * | get_instance () |
Returns the singleton instance of the class. | |
Protected Member Functions | |
void | update () |
Updates the options. | |
void | create_options () |
Creates a new options file. | |
std::string | find_file_rec (const std::string &path, const std::string &file_name) |
Recursive file finder. | |
std::string | find_template_rec (const std::string &path, const std::string &file_name) |
Recursive template searcher. | |
Protected Attributes | |
std::vector< std::string > | search_paths |
Search paths. | |
std::vector< std::string > | template_paths |
Template paths. | |
std::vector< std::string > | icon_paths |
Icon search paths. | |
std::map< std::string, std::string > | icon_cache |
Icon cache. | |
int | argc |
Command line arguments. | |
char ** | argv |
bool | worksheet |
Worksheet mode. | |
std::string | install_path |
Install path of contrap. | |
Static Protected Attributes | |
static Options * | options |
Options instance. |
virtual crp::Options::~Options | ( | ) | [virtual] |
Cleans up memory.
void crp::Options::add_template_path | ( | const std::string & | path | ) |
Adds a template path manually.
path | New template search path |
void crp::Options::create_options | ( | ) | [protected] |
Creates a new options file.
std::string crp::Options::find_file | ( | const std::string & | file_name | ) |
Returns the full path to a file with the given name within the range of paths interesting for ContRap.
This method recursively searches several paths to locate the file. The first searched path is the path to the application start folder. The other paths are given by the options.
ContRap does not follow symbolic links when searching for files.
file_name | File name |
std::string crp::Options::find_file_rec | ( | const std::string & | path, |
const std::string & | file_name | ||
) | [protected] |
Recursive file finder.
std::string crp::Options::find_icon | ( | const std::string & | file_name | ) |
Returns the full path to an icon with the given name within the range of paths interesting for ContRap.
This only searches within the icon installation paths of registered libraries.
file_name | File name. |
std::string crp::Options::find_template | ( | const std::string & | path | ) |
Returns the full path to a template with the given name within the range of paths interesting for ContRap.
This only searches within the icon installation paths of registered libraries.
path | Relative file name or a full path. |
std::string crp::Options::find_template_rec | ( | const std::string & | path, |
const std::string & | file_name | ||
) | [protected] |
Recursive template searcher.
int& crp::Options::get_argc | ( | ) | [inline] |
Returns the command line arguments count given by the application.
char** crp::Options::get_argv | ( | ) | [inline] |
Returns the values of the command line arguments.
const std::string& crp::Options::get_install_path | ( | ) |
Returns the installation path of ContRap.
The path is given by a compile-time constant but can be overwritten by the environment variable CONTRAP_INSTALL_PATH.
static Options* crp::Options::get_instance | ( | ) | [static] |
Returns the singleton instance of the class.
const std::vector<std::string>& crp::Options::get_search_paths | ( | ) | const [inline] |
Returns the search paths were ContRap looks for plugins.
const std::vector<std::string>& crp::Options::get_template_paths | ( | ) | const [inline] |
Returns the search paths were ContRap looks for templates.
bool crp::Options::is_worksheet | ( | ) | [inline] |
Returns true if the core library was initialized in worksheet mode.
void crp::Options::set_arguments | ( | int | argc, |
char ** | argv | ||
) |
Sets the command line arguments.
argc | Arguments count |
argv | Argument values |
void crp::Options::set_worksheet | ( | bool | status | ) | [inline] |
Sets the worksheet mode.
In the worksheet mode widgets, images and so on are not shown by default on creation.
status | True if the worksheet mode is on. |
void crp::Options::update | ( | ) | [protected] |
Updates the options.
void crp::Options::update_cache | ( | ) |
Updates the cache information.
int crp::Options::argc [protected] |
Command line arguments.
char** crp::Options::argv [protected] |
std::map<std::string, std::string> crp::Options::icon_cache [protected] |
Icon cache.
std::vector<std::string> crp::Options::icon_paths [protected] |
Icon search paths.
std::string crp::Options::install_path [protected] |
Install path of contrap.
Options* crp::Options::options [static, protected] |
Options instance.
std::vector<std::string> crp::Options::search_paths [protected] |
Search paths.
std::vector<std::string> crp::Options::template_paths [protected] |
Template paths.
bool crp::Options::worksheet [protected] |
Worksheet mode.