ConfigPageManager¶

class ConfigPageManager

Bases: ConfigFlags

A global object that maintains the set of ConfigPages everywhere in the world, and keeps them in sorted order.

Inheritance diagram

bool delete_explicit_page(ConfigPage *page)

Removes a previously-constructed ConfigPage from the set of active pages, and deletes it. The ConfigPage object is no longer valid after this call. Returns true if the page is successfully deleted, or false if it was unknown (which should never happen if the page was legitimately constructed).

ConfigPage *get_explicit_page(std::size_t n) const

Returns the nth explicit ConfigPage in the world. See get_num_explicit_pages().

static ConfigPageManager *get_global_ptr(void)
ConfigPage *get_implicit_page(std::size_t n) const

Returns the nth implicit ConfigPage in the world. See get_num_implicit_pages().

std::size_t get_num_explicit_pages(void) const

Returns the current number of explicitly-loaded ConfigPages in the world. These represent pages that were loaded dynamically at runtime by explicit calls to ConfigPageManager::make_explicit_page().

std::size_t get_num_implicit_pages(void) const

Returns the current number of implicitly-loaded ConfigPages in the world. These represent files that were automatically discovered on the disk as .prc files.

std::size_t get_num_prc_encrypted_patterns(void) const

Returns the number of patterns, like *.pre, that are compiled in that will be searched for as special config files that are understood to be encrypted.

std::size_t get_num_prc_executable_patterns(void) const

Returns the number of patterns, like *.exe, that are compiled in that will be searched for as special config files that are to be executed as a program, and their output taken to be input. This is normally empty.

std::size_t get_num_prc_patterns(void) const

Returns the number of patterns, like *.prc, that are compiled in that will be searched for as default config filenames. Normally there is only one pattern, and it is *.prc, but others may be specified with the PRC_FILENAME variable in Config.pp.

std::string get_prc_encrypted_pattern(std::size_t n) const

Returns the nth filename pattern that will be considered a match as a valid encrypted config file. See get_num_prc_encrypted_patterns().

std::string get_prc_executable_pattern(std::size_t n) const

Returns the nth filename pattern that will be considered a match as a valid executable-style config file. See get_num_prc_executable_patterns().

std::string get_prc_pattern(std::size_t n) const

Returns the nth filename pattern that will be considered a match as a valid config file. See get_num_prc_patterns().

DSearchPath &get_search_path(void)

Returns the search path used to locate implicit .prc files. This is determined by the PRC_DIR and PRC_PATH environment variables. The object returned by this method may be modified to change the path at runtime, and then reload_implicit_pages() called.

void load_implicit_pages(void)

Searches the PRC_DIR and/or PRC_PATH directories for *.prc files and loads them in as pages. This is normally called automatically at startup time, when the first variable’s value is referenced. See also reload_implicit_pages().

bool loaded_implicit_pages(void) const

Returns true if the implicit *.prc files have already been loaded, false otherwise. Normally this will only be false briefly before startup.

ConfigPage *make_explicit_page(std::string const &name)

Creates and returns a new, empty ConfigPage. This page will be stacked on top of any pages that were created before; it may shadow variable declarations that are defined in previous pages.

void output(std::ostream &out) const
void reload_implicit_pages(void)

Searches the PRC_DIR and/or PRC_PATH directories for *.prc files and loads them in as pages.

This may be called after startup, to force the system to re-read all of the implicit prc files.

void write(std::ostream &out) const