|
| 1 | +#include "graphfilebase.hpp" |
| 2 | + |
| 3 | +GraphFileBase::GraphFileBase(std::filesystem::path &path) |
| 4 | +{ |
| 5 | + this->filename = path.filename().string(); |
| 6 | + this->relative = this->reader.relative_path(path.parent_path().string(), this->reader.read_property(FileIO::CONFIG_DB_SOURCE)); |
| 7 | + this->source_absolute = std::filesystem::absolute(path).string(); |
| 8 | +} |
| 9 | + |
| 10 | +void GraphFileBase::to_string() const |
| 11 | +{ |
| 12 | + std::cout << std::string(60, '_') << std::endl; |
| 13 | + std::cout << "Filename: " << this->filename << std::endl; |
| 14 | + std::cout << "Relative: " << this->relative << std::endl; |
| 15 | + std::cout << "New filename: " << this->target_filename << std::endl; |
| 16 | + std::cout << "Source absolute path: " << this->source_absolute << std::endl; |
| 17 | + std::cout << "Target absolute path: " << this->target_absolute << std::endl; |
| 18 | + std::cout << std::string(60, '_') << std::endl; |
| 19 | +} |
| 20 | + |
| 21 | +//getters |
| 22 | + |
| 23 | +const std::string GraphFileBase::get_filename() const |
| 24 | +{ |
| 25 | + return this->filename; |
| 26 | +} |
| 27 | + |
| 28 | +const std::string GraphFileBase::get_relative() const |
| 29 | +{ |
| 30 | + return this->relative; |
| 31 | +} |
| 32 | + |
| 33 | +const std::string GraphFileBase::get_source_absolute() const |
| 34 | +{ |
| 35 | + return this->source_absolute; |
| 36 | +} |
| 37 | + |
| 38 | +const std::string GraphFileBase::get_target_absolute() const |
| 39 | +{ |
| 40 | + return this->target_absolute; |
| 41 | +} |
| 42 | + |
| 43 | +const std::string GraphFileBase::get_target_filename() const |
| 44 | +{ |
| 45 | + return this->target_filename; |
| 46 | +} |
| 47 | + |
| 48 | +const FileReader GraphFileBase::get_reader() const |
| 49 | +{ |
| 50 | + return this->reader; |
| 51 | +} |
| 52 | + |
| 53 | +void GraphFileBase::set_target_absolute(std::string target_absolute) |
| 54 | +{ |
| 55 | + this->target_absolute = std::move(target_absolute); |
| 56 | +} |
| 57 | + |
| 58 | +void GraphFileBase::set_target_filename(std::string target_filename) |
| 59 | +{ |
| 60 | + this->target_filename = std::move(target_filename); |
| 61 | +} |
0 commit comments