Flow123d
jenkins-Flow123d-windows-release-multijob-285
|
Dedicated class for storing path to input and output files. More...
#include <file_path.hh>
Public Types | |
enum | FileType { input_file, output_file } |
Possible types of file. More... | |
Public Member Functions | |
TYPEDEF_ERR_INFO (EI_Path, string) | |
DECLARE_EXCEPTION (ExcAbsOutputPath,<< "Can not set absolute path "<< EI_Path::qval<< "for an output file.") | |
FilePath () | |
FilePath (string file_path, const FileType ft) | |
operator string () const | |
bool | operator== (const FilePath &other) const |
Equality comparison operators for regions. More... | |
void | create_output_dir () |
Static Public Member Functions | |
static void | set_io_dirs (const string working_dir, const string root_input, const string input, const string output) |
static void | add_placeholder (string key, string value) |
Add new item to place holder. More... | |
static const string | get_absolute_working_dir () |
Private Member Functions | |
void | substitute_value () |
Static Private Member Functions | |
static bool | is_absolute_path (const string path) |
static void | create_dir (string dir) |
static void | create_canonical_path (const string working_dir, const string output) |
Private Attributes | |
string | abs_file_path |
Final absolute path to the file. More... | |
FileType | file_type_ |
File type. More... | |
Static Private Attributes | |
static std::map< string, string > | placeholder |
dictionary of placeholders More... | |
static string | output_dir ="" |
Prefix path for output files. More... | |
static string | root_dir ="" |
Prefix path for input files (directory of the main input file). More... | |
Dedicated class for storing path to input and output files.
FilePath objects are constructed from given absolute or relative path to the file and its type (input or output). Before you create any instance of the class you have to call static method set_io_dirs
to set:
Definition at line 32 of file file_path.hh.
enum FilePath::FileType |
Possible types of file.
Enumerator | |
---|---|
input_file | |
output_file |
Definition at line 40 of file file_path.hh.
|
inline |
Default constructor, necessary when using Input::Record::opt_val() to initialize a FilePath.
Definition at line 48 of file file_path.hh.
FilePath::FilePath | ( | string | file_path, |
const FileType | ft | ||
) |
Translates the given absolute or relative path to a file file_path
depending on the file type ft
.
For input files:
For output files:
Definition at line 21 of file file_path.cc.
|
static |
Add new item to place holder.
Placeholder is extended by adding a single new item. The item can be used in the name of the input or output file name. Currently, the only supported placeholder is ${INPUT}.
[in] | key | Key of new item. |
[in] | value | Value of new item. |
Definition at line 91 of file file_path.cc.
|
staticprivate |
Create canonical path of output directory given by relative path.
Definition at line 145 of file file_path.cc.
|
staticprivate |
Check if directory stored in output_dir doesn't exist and create its
Definition at line 138 of file file_path.cc.
void FilePath::create_output_dir | ( | ) |
For an output filepath, the directory part (up to last separator) is extracted and all subdirectories are created if doesn't exist yet.
Definition at line 128 of file file_path.cc.
FilePath::DECLARE_EXCEPTION | ( | ExcAbsOutputPath | , |
<< "Can not set absolute path "<< EI_Path::qval<< "for an output file." | |||
) |
|
static |
Return absolute path of actual working directory.
Definition at line 118 of file file_path.cc.
|
staticprivate |
Test if get path is absolute for used operating system.
Definition at line 107 of file file_path.cc.
|
inline |
This class is implicitly convertible to string.
Definition at line 78 of file file_path.hh.
|
inline |
Equality comparison operators for regions.
Definition at line 103 of file file_path.hh.
|
static |
Set:
Definition at line 48 of file file_path.cc.
|
private |
Substitutes placeholders in abs_file_path
.
Definition at line 96 of file file_path.cc.
FilePath::TYPEDEF_ERR_INFO | ( | EI_Path | , |
string | |||
) |
|
private |
Final absolute path to the file.
Definition at line 139 of file file_path.hh.
|
private |
File type.
Definition at line 142 of file file_path.hh.
|
staticprivate |
Prefix path for output files.
Definition at line 148 of file file_path.hh.
|
staticprivate |
dictionary of placeholders
Definition at line 145 of file file_path.hh.
|
staticprivate |
Prefix path for input files (directory of the main input file).
Definition at line 151 of file file_path.hh.