Flow123d
jenkins-Flow123d-windows32-release-multijob-51
|
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 (const string file_path, const FileType ft) | |
operator string () const | |
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 bool | create_output_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... | |
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 | ( | const 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 85 of file file_path.cc.
|
staticprivate |
Create canonical path of output directory given by relative path.
Definition at line 130 of file file_path.cc.
|
staticprivate |
Check if directory stored in output_dir doesn't exist and create its
Definition at line 121 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 112 of file file_path.cc.
|
staticprivate |
Test if get path is absolute for used operating system.
Definition at line 101 of file file_path.cc.
|
inline |
This class is implicitly convertible to string.
Definition at line 75 of file file_path.hh.
|
static |
Set:
Definition at line 42 of file file_path.cc.
|
private |
Substitutes placeholders in abs_file_path
.
Definition at line 90 of file file_path.cc.
FilePath::TYPEDEF_ERR_INFO | ( | EI_Path | , |
string | |||
) |
|
private |
Final absolute path to the file.
Definition at line 126 of file file_path.hh.
|
staticprivate |
Prefix path for output files.
Definition at line 132 of file file_path.hh.
|
staticprivate |
dictionary of placeholders
Definition at line 129 of file file_path.hh.
|
staticprivate |
Prefix path for input files (directory of the main input file).
Definition at line 135 of file file_path.hh.