te::core::FileSystem Class Reference

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 &)
 
FileSystemoperator= (FileSystem const &)
 
 ~FileSystem ()
 

Detailed Description

A class for handling system files and paths using UTF-8 strings.

Definition at line 50 of file FileSystem.h.

Constructor & Destructor Documentation

te::core::FileSystem::FileSystem ( )
private
te::core::FileSystem::~FileSystem ( )
private
te::core::FileSystem::FileSystem ( FileSystem const &  )
private

Member Function Documentation

std::string te::core::FileSystem::absolutePath ( const std::string &  path)
static
void te::core::FileSystem::copyFile ( const std::string &  from,
const std::string &  to 
)
static

Copies a file.

Parameters
fromPath in UTF-8 for the file to be copied.
toPath 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().

bool te::core::FileSystem::createDirectories ( const std::string &  path)
static

Creates a directory for any element of path that does not exist.

Parameters
pathPath in UTF-8.
Returns
true if a new directory was created, otherwise false.

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().

bool te::core::FileSystem::createDirectory ( const std::string &  path)
static

Creates a directory from a given path in UTF-8.

Parameters
pathPath in UTF-8.
Returns
true if a new directory was created, otherwise false.

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().

std::string te::core::FileSystem::currentPath ( )
static

Retrives the current working directory path in UTF-8.

Returns
String in UTF-8 for the current working directory path.

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().

std::string te::core::FileSystem::executableDirectory ( )
static

Definition at line 104 of file FileSystem.cpp.

References p, and te::core::CharEncoding::toUTF8().

Referenced by te::core::FindInTerraLibPath().

bool te::core::FileSystem::exists ( const std::string &  path)
static

Checks if a given path in UTF-8 exists.

Parameters
pathPath in UTF-8.
Returns
true if exists, otherwise false.

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().

std::string te::core::FileSystem::extension ( const std::string &  path)
static

Retrives the extension of a given file path in UTF-8.

Parameters
pathFile path in UTF-8.
Returns
String in UTF-8 for the extension.

Definition at line 82 of file FileSystem.cpp.

Referenced by BOOST_AUTO_TEST_SUITE(), te::plugin::DefaultFinder::getPlugins(), and main().

uintmax_t te::core::FileSystem::fileSize ( const std::string &  path)
static

Returns the file size of a FILE in UTF-8.

Parameters
pathPath in UTF-8.
Returns
File size.
Exceptions
te::core::Exceptionif 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().

bool te::core::FileSystem::isEmpty ( const std::string &  path)
static

Checks if a given path in UTF-8 is an empty directory.

Parameters
pathPath in UTF-8.
Returns
true if is a empty directory, otherwise false.

Definition at line 93 of file FileSystem.cpp.

References te::core::CharEncoding::fromUTF8().

Referenced by BOOST_AUTO_TEST_SUITE(), and main().

std::vector< std::string > te::core::FileSystem::listDirectory ( const std::string &  path)
static

Lists a directory from a given path in UTF-8.

Parameters
pathPath in UTF-8.
Returns
Vector of strings in UTF-8 for directory content.

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().

FileSystem& te::core::FileSystem::operator= ( FileSystem const &  )
private
void te::core::FileSystem::rename ( const std::string &  old_p,
const std::string &  new_p 
)
static

Renames a file or directory from a given path in UTF-8.

Parameters
old_pOld name in UTF-8.
new_pNew 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().

std::string te::core::FileSystem::systemCompletePath ( const std::string &  path)
static

Composes an absolute path for the given path in UTF-8.

Parameters
pathPath in UTF-8.
Returns
String in UTF-8 for the composed path.

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().

std::string te::core::FileSystem::tempDirectoryPath ( )
static

Retrives the temp directory in UTF-8.

Returns
String in UTF-8 for temp directory.

Definition at line 64 of file FileSystem.cpp.

References te::core::CharEncoding::toUTF8().

Referenced by te::mem::ExpansibleBandBlocksManager::createNewDiskFile().

std::string te::core::FileSystem::uniquePath ( const std::string &  format = "%%%%-%%%%-%%%%-%%%%")
static

Retrives an unique path generated by a given format.

Parameters
formatThe format used to create a unique path. e.g.: "%%%%-%%%%-%%%%-%%%%"
Returns
String in UTF-8 for the generated unique path.

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().


The documentation for this class was generated from the following files: