OGS
FileTools.cpp File Reference

Detailed Description

Filename manipulation routines implementation.

Author
Lars Bilke
Date
Apr. 2010

Definition in file FileTools.cpp.

#include "FileTools.h"
#include <spdlog/fmt/bundled/core.h>
#include <boost/algorithm/string/predicate.hpp>
#include <boost/endian/conversion.hpp>
#include <boost/interprocess/file_mapping.hpp>
#include <boost/interprocess/mapped_region.hpp>
#include <filesystem>
#include <fstream>
#include <typeindex>
#include <unordered_map>
#include "BaseLib/Logging.h"
#include "Error.h"
Include dependency graph for FileTools.cpp:

Go to the source code of this file.

Namespaces

namespace  anonymous_namespace{FileTools.cpp}
 
namespace  BaseLib
 

Functions

bool BaseLib::isProjectDirectorySet ()
 Returns true if the project directory is set.
 
bool BaseLib::IsFileExisting (const std::string &strFilename)
 Returns true if given file exists.
 
std::tuple< std::string, std::string::size_type, std::string::size_type > BaseLib::getParenthesizedString (std::string const &in, char const open_char, char const close_char, std::string::size_type pos)
 
std::string BaseLib::containsKeyword (std::string const &str, std::string const &keyword)
 
template<typename T >
bool BaseLib::substituteKeyword (std::string &result, std::string const &parenthesized_string, std::string::size_type const begin, std::string::size_type const end, std::string const &keyword, T &data)
 
std::string BaseLib::constructFormattedFileName (std::string const &format_specification, std::string const &mesh_name, int const timestep, double const t, int const iteration)
 
double BaseLib::swapEndianness (double const &v)
 
std::string BaseLib::dropFileExtension (std::string const &filename)
 
std::string BaseLib::extractBaseName (std::string const &pathname)
 
std::string BaseLib::extractBaseNameWithoutExtension (std::string const &pathname)
 
std::string BaseLib::getFileExtension (const std::string &path)
 
bool BaseLib::hasFileExtension (std::string const &extension, std::string const &filename)
 
std::string BaseLib::extractPath (std::string const &pathname)
 
std::string BaseLib::joinPaths (std::string const &pathA, std::string const &pathB)
 
std::string const & BaseLib::getProjectDirectory ()
 Returns the directory where the prj file resides.
 
void BaseLib::setProjectDirectory (std::string const &dir)
 Sets the project directory.
 
void BaseLib::unsetProjectDirectory ()
 Unsets the project directory.
 
void BaseLib::removeFile (std::string const &filename)
 
void BaseLib::removeFiles (std::vector< std::string > const &files)
 
bool BaseLib::createOutputDirectory (std::string const &dir)
 
std::vector< double > BaseLib::readDoublesFromBinaryFile (const std::string &filename)
 
template<typename T >
BaseLib::readBinaryValue (std::istream &in)
 
template float BaseLib::readBinaryValue< float > (std::istream &)
 
template double BaseLib::readBinaryValue< double > (std::istream &)
 
template<typename T >
std::vector< T > BaseLib::readBinaryVector (std::string const &filename, std::size_t const start_element, std::size_t const num_elements)
 
template std::vector< float > BaseLib::readBinaryVector< float > (std::string const &, std::size_t const, std::size_t const)
 
template std::vector< double > BaseLib::readBinaryVector< double > (std::string const &, std::size_t const, std::size_t const)
 
template<typename T >
void BaseLib::writeValueBinary (std::ostream &out, T const &val)
 write value as binary into the given output stream
 
template void BaseLib::writeValueBinary< std::size_t > (std::ostream &, std::size_t const &)
 

Variables

std::string anonymous_namespace{FileTools.cpp}::project_directory
 The directory where the prj file resides.
 
bool anonymous_namespace{FileTools.cpp}::project_directory_is_set = false
 Whether the project directory has already been set.