ConfigVariableFilename

class ConfigVariableFilename

Bases: ConfigVariable

This is a convenience class to specialize ConfigVariable as a Filename type. It is almost the same thing as ConfigVariableString, except it handles an implicit Filename::expand_from() operation so that the user may put OS-specific filenames, or filenames based on environment variables, in the prc file.

Inheritance diagram

Inheritance diagram of ConfigVariableFilename

explicit ConfigVariableFilename(std::string const &name)
ConfigVariableFilename(std::string const &name, Filename const &default_value, std::string const &description = string(), int flags = 0)
ConfigVariableFilename(ConfigVariableFilename const&) = default
char const *c_str(void) const

These methods help the ConfigVariableFilename act like a Filename object.

bool empty(void) const
std::string get_basename(void) const

Returns the basename part of the filename. This is everything in the filename after the rightmost slash, including any extensions.

std::string get_basename_wo_extension(void) const

Returns the basename part of the filename, without the file extension.

Filename get_default_value(void) const

Returns the variable’s default value.

std::string get_dirname(void) const

Returns the directory part of the filename. This is everything in the filename up to, but not including the rightmost slash.

std::string get_extension(void) const

Returns the file extension. This is everything after the rightmost dot, if there is one, or the empty string if there is not.

std::string get_fullpath(void) const

Returns the entire filename: directory, basename, extension. This is the same thing returned by the string typecast operator, so this function is a little redundant.

std::string get_fullpath_wo_extension(void) const

Returns the full filename–directory and basename parts–except for the extension.

Filename get_value(void) const

Returns the variable’s value.

Filename get_word(std::size_t n) const

Returns the variable’s nth value.

std::size_t length(void) const
void set_value(Filename const &value)

Reassigns the variable’s local value.

void set_word(std::size_t n, Filename const &value)

Reassigns the variable’s nth value. This makes a local copy of the variable’s overall value.