A class for handling system files and paths using UTF-8 strings. More...
#include <FileSystem.h>
Static Public Member Functions | |
| static std::string | absolutePath (const std::string &path) |
| Retrives the absolute path for the given path in UTF-8. More... | |
| static void | copyFile (const std::string &from, const std::string &to) |
| Copies a file. More... | |
| static bool | createDirectories (const std::string &path) |
| Creates a directory for any element of path that does not exist. More... | |
| static bool | createDirectory (const std::string &path) |
| Creates a directory from a given path in UTF-8. More... | |
| static std::string | currentPath () |
| Retrives the current working directory path in UTF-8. More... | |
| static std::string | executableDirectory () |
| static bool | exists (const std::string &path) |
| Checks if a given path in UTF-8 exists. More... | |
| static std::string | extension (const std::string &path) |
| Retrives the extension of a given file path in UTF-8. More... | |
| static uintmax_t | fileSize (const std::string &path) |
| Returns the file size of a FILE in UTF-8. More... | |
| static bool | isDirectory (const std::string &path) |
| Checks if a given path in UTF-8 is a directory. More... | |
| static bool | isEmpty (const std::string &path) |
| Checks if a given path in UTF-8 is an empty directory. More... | |
| static bool | isRegularFile (const std::string &path) |
| Checks if a given path in UTF-8 is a regular file. More... | |
| static std::vector< std::string > | listDirectory (const std::string &path) |
| Lists a directory from a given path in UTF-8. More... | |
| static bool | remove (const std::string &path) |
| Removes a file or directory from a given path in UTF-8. More... | |
| static void | rename (const std::string &old_p, const std::string &new_p) |
| Renames a file or directory from a given path in UTF-8. More... | |
| static std::string | systemCompletePath (const std::string &path) |
| Composes an absolute path for the given path in UTF-8. More... | |
| static std::string | tempDirectoryPath () |
| Retrives the temp directory in UTF-8. More... | |
| static std::string | uniquePath (const std::string &format="%%%%-%%%%-%%%%-%%%%") |
| Retrives an unique path generated by a given format. More... | |
Private Member Functions | |
| FileSystem () | |
| FileSystem (FileSystem const &) | |
| FileSystem & | operator= (FileSystem const &) |
| ~FileSystem () | |
A class for handling system files and paths using UTF-8 strings.
Definition at line 50 of file FileSystem.h.
|
private |
|
private |
|
private |
|
static |
Retrives the absolute path for the given path in UTF-8.
| path | Path in UTF-8. |
Definition at line 76 of file FileSystem.cpp.
References te::core::CharEncoding::toUTF8().
Referenced by te::vm::python::VirtualMachine::execute(), exportRastertoGPKG(), te::core::CppPluginEngine::load(), te::qt::plugins::terramobile::ReadStyle(), te::qt::widgets::StyleControllerWidget::readStyle(), te::qt::plugins::terramobile::WriteStyle(), and te::qt::widgets::StyleControllerWidget::writeStyle().
|
static |
Copies a file.
| from | Path in UTF-8 for the file to be copied. |
| to | Path in UTF-8 for the copy output. |
Definition at line 159 of file FileSystem.cpp.
References te::core::CharEncoding::fromUTF8().
Referenced by BOOST_AUTO_TEST_SUITE(), te::gdal::Transactor::cloneDataSet(), and main().
|
static |
Creates a directory for any element of path that does not exist.
| path | Path in UTF-8. |
Definition at line 153 of file FileSystem.cpp.
References te::core::CharEncoding::fromUTF8().
Referenced by te::sqlite::DataSource::create(), te::qt::af::ApplicationController::initialize(), te::qt::af::AppCtrlSingleton::prepareQtEnvironment(), te::ws::ogc::WCSClient::WCSClient(), and te::ws::ogc::WMSClient::WMSClient().
|
static |
Creates a directory from a given path in UTF-8.
| path | Path in UTF-8. |
Definition at line 147 of file FileSystem.cpp.
References te::core::CharEncoding::fromUTF8().
Referenced by BOOST_AUTO_TEST_SUITE(), te::gdal::DataSource::create(), te::gpkg::DataSource::createDataSet(), te::ogr::DataSource::createOGRDataSource(), and main().
|
static |
Retrives the current working directory path in UTF-8.
Definition at line 50 of file FileSystem.cpp.
References te::core::CharEncoding::toUTF8().
Referenced by te::core::CppPluginEngine::load(), and te::qt::af::InternalSettingsDialog::setPaths().
|
static |
Definition at line 104 of file FileSystem.cpp.
References p, and te::core::CharEncoding::toUTF8().
Referenced by te::core::FindInTerraLibPath().
|
static |
Checks if a given path in UTF-8 exists.
| path | Path in UTF-8. |
Definition at line 142 of file FileSystem.cpp.
References te::core::CharEncoding::fromUTF8().
Referenced by BOOST_AUTO_TEST_SUITE(), CalculateGrid(), te::sqlite::DataSource::create(), te::gpkg::DataSource::createDataSet(), te::gdal::Transactor::createDataSet(), CreateIsolines(), te::ogr::DataSource::createOGRDataSource(), te::qt::widgets::VectorizationWizard::execute(), te::qt::widgets::RasterizationWizard::execute(), te::sqlite::DataSource::exists(), te::gpkg::DataSource::exists(), te::ogr::DataSource::exists(), te::ado::DataSource::exists(), te::gdal::DataSource::exists(), te::qt::widgets::OutputRasterWidget::fileExists(), te::qt::widgets::RasterInfoWidget::fileExists(), te::core::FindInTerraLibPath(), GenerateIso(), GenerateTIN(), te::qt::af::ApplicationController::initialize(), te::core::JSONPluginInfoSerializer(), main(), te::mnt::SmoothIsolinesDialog::onOkPushButtonClicked(), te::mnt::SlopeDialog::onOkPushButtonClicked(), te::vp::PolygonToLineDialog::onOkPushButtonClicked(), te::mnt::CreateIsolinesDialog::onOkPushButtonClicked(), te::vp::LineToPolygonDialog::onOkPushButtonClicked(), te::mnt::TINGenerationDialog::onOkPushButtonClicked(), te::mnt::MNTGenerationDialog::onOkPushButtonClicked(), te::attributefill::VectorToRasterDialog::onOkPushButtonClicked(), te::vp::MultipartToSinglepartDialog::onOkPushButtonClicked(), te::mnt::ImageGenerationDialog::onOkPushButtonClicked(), te::vp::IntersectionDialog::onOkPushButtonClicked(), te::addressgeocoding::MainWindowDialog::onOkPushButtonClicked(), te::vp::GeometricOpDialog::onOkPushButtonClicked(), te::vp::MergeDialog::onOkPushButtonClicked(), te::vp::BufferDialog::onOkPushButtonClicked(), te::attributefill::RasterToVectorDialog::onOkPushButtonClicked(), te::vp::UnionDialog::onOkPushButtonClicked(), te::vp::DifferenceDialog::onOkPushButtonClicked(), te::vp::IdentityDialog::onOkPushButtonClicked(), te::attributefill::VectorToVectorDialog::onOkPushButtonClicked(), te::vp::DissolveDialog::onOkPushButtonClicked(), te::ogr::DataSource::open(), te::gpkg::DataSource::open(), te::qt::af::AppCtrlSingleton::prepareQtEnvironment(), RasterToVectorInSHP(), SaveTIN_shp(), TINCalculateGrid(), te::qt::plugins::terralib4::TL4ConverterWizard::validateCurrentPage(), te::qt::plugins::terralib4::TL4ConverterWizard::validLayerNames(), VectorToRaster(), te::core::FileWatcher::watch(), te::ws::ogc::WCSClient::WCSClient(), and te::ws::ogc::WMSClient::WMSClient().
|
static |
Retrives the extension of a given file path in UTF-8.
| path | File path in UTF-8. |
Definition at line 82 of file FileSystem.cpp.
Referenced by BOOST_AUTO_TEST_SUITE(), te::plugin::DefaultFinder::getPlugins(), and main().
|
static |
Returns the file size of a FILE in UTF-8.
| path | Path in UTF-8. |
| te::core::Exception | if the given path doesn't exists or its used in a directory. |
Definition at line 195 of file FileSystem.cpp.
References te::core::CharEncoding::fromUTF8().
Referenced by te::core::FileWatcher::watch().
|
static |
Checks if a given path in UTF-8 is a directory.
| path | Path in UTF-8. |
Definition at line 87 of file FileSystem.cpp.
References te::core::CharEncoding::fromUTF8().
Referenced by te::plugin::DefaultFinder::addPluginsDir(), BOOST_AUTO_TEST_SUITE(), te::gdal::DataSource::create(), te::gdal::Transactor::createDataSet(), te::gdal::DataSource::exists(), exportRastertoGPKG(), te::core::GetAppLocalDataLocation(), te::gdal::Transactor::getDataSetNames(), te::gdal::Transactor::getDataSetType(), te::plugin::DefaultFinder::getDefaultDirs(), te::plugin::DefaultFinder::getPlugins(), GetPluginsInfo(), te::rp::FeederConstRasterDirectory::initialize(), te::gdal::DataSource::isValid(), listDirectory(), main(), mmain(), te::qt::plugins::gdal::GDALConnectorDialog::setConnectionInfo(), te::gdal::TERRALIB_CPP_PLUGIN_BEGIN(), te::ogr::TERRALIB_CPP_PLUGIN_BEGIN(), te::ws::ogc::WCSClient::WCSClient(), and te::ws::ogc::WMSClient::WMSClient().
|
static |
Checks if a given path in UTF-8 is an empty directory.
| path | Path in UTF-8. |
Definition at line 93 of file FileSystem.cpp.
References te::core::CharEncoding::fromUTF8().
Referenced by BOOST_AUTO_TEST_SUITE(), and main().
|
static |
Checks if a given path in UTF-8 is a regular file.
| path | File path in UTF-8. |
Definition at line 98 of file FileSystem.cpp.
References te::core::CharEncoding::fromUTF8().
Referenced by BOOST_AUTO_TEST_SUITE(), te::gdal::Transactor::cloneDataSet(), te::gdal::Transactor::createDataSet(), te::gdal::Transactor::dropDataSet(), te::gdal::Transactor::getDataSetNames(), te::gdal::Transactor::getDataSetType(), te::plugin::GetInstalledPlugin(), te::plugin::DefaultFinder::getPlugins(), GetPluginsInfo(), te::rp::FeederConstRasterDirectory::initialize(), te::gdal::DataSource::isValid(), te::common::ApplicationSettings::load(), main(), msearch(), MSearch(), te::serialize::xml::ReadDataSourceInfo(), te::gdal::Transactor::renameDataSet(), te::qt::plugins::gdal::GDALConnectorDialog::setConnectionInfo(), and te::qt::widgets::RasterInfoWidget::updateRawRasterFileName().
|
static |
Lists a directory from a given path in UTF-8.
| path | Path in UTF-8. |
Definition at line 178 of file FileSystem.cpp.
References te::core::CharEncoding::fromUTF8(), isDirectory(), p, and te::core::CharEncoding::toUTF8().
Referenced by BOOST_AUTO_TEST_SUITE(), GetPluginsInfo(), and main().
|
private |
|
static |
Removes a file or directory from a given path in UTF-8.
| path | Path in UTF-8. |
Definition at line 166 of file FileSystem.cpp.
References te::core::CharEncoding::fromUTF8().
Referenced by BOOST_AUTO_TEST_SUITE(), CalculateGrid(), CreateIsolines(), te::sqlite::DataSource::drop(), te::ado::DataSource::drop(), te::gdal::DataSource::drop(), te::gdal::Transactor::dropDataSet(), exportRastertoGPKG(), GenerateIso(), GenerateTIN(), main(), te::mnt::VolumeResultDialog::onSavePushButtonClicked(), te::mnt::ImageGenerationDialog::onTargetFileToolButtonPressed(), te::qt::plugins::terramobile::ReadStyle(), SaveTIN_shp(), TINCalculateGrid(), te::common::ApplicationSettings::update(), te::qt::widgets::RasterInfoWidget::updateRawRasterFileName(), and te::qt::plugins::terramobile::WriteStyle().
|
static |
Renames a file or directory from a given path in UTF-8.
| old_p | Old name in UTF-8. |
| new_p | New name in UTF-8. |
Definition at line 171 of file FileSystem.cpp.
References te::core::CharEncoding::fromUTF8().
Referenced by BOOST_AUTO_TEST_SUITE(), main(), and te::gdal::Transactor::renameDataSet().
|
static |
Composes an absolute path for the given path in UTF-8.
| path | Path in UTF-8. |
Definition at line 56 of file FileSystem.cpp.
References te::core::CharEncoding::fromUTF8(), and te::core::CharEncoding::toUTF8().
Referenced by te::plugin::DefaultFinder::addPluginsDir(), te::plugin::DefaultFinder::getDefaultDirs(), and GetDefaultLookupDirs().
|
static |
Retrives the temp directory in UTF-8.
Definition at line 64 of file FileSystem.cpp.
References te::core::CharEncoding::toUTF8().
Referenced by te::mem::ExpansibleBandBlocksManager::createNewDiskFile().
|
static |
Retrives an unique path generated by a given format.
| format | The format used to create a unique path. e.g.: "%%%%-%%%%-%%%%-%%%%" |
Definition at line 70 of file FileSystem.cpp.
References te::core::CharEncoding::toUTF8().
Referenced by te::mem::ExpansibleBandBlocksManager::createNewDiskFile(), and te::rp::Matrix< TemplateElementType >::createNewDiskFile().