16 #ifndef GEOS_COMMON_PATH_HPP
17 #define GEOS_COMMON_PATH_HPP
65 std::string::operator=( rhs );
76 std::string::operator=( std::move( rhs ) );
111 size_type
const pos = find_last_of(
'/' );
112 return pos == npos ?
static_cast< std::string >( *this ) : substr( pos + 1 );
121 size_type
const pos = fname.find_last_of(
'.' );
122 return pos == npos ?
"" : fname.substr( pos + 1 );
154 return !path.empty() && path[ 0 ] ==
'/';
172 return ( !path.empty() && path.back() ==
'/' ) ? path.substr( 0, path.size() - 1 ) : path;
188 template<
typename ... ARGS >
191 size_t constexpr numParts =
sizeof...(args);
192 static_assert( numParts > 0,
"Must provide arguments" );
194 std::ostringstream oss;
195 for(
size_t i = 0; i < numParts - 1; ++i )
197 if( !parts[i].empty() )
199 oss << parts[i] <<
'/';
202 oss << parts[numParts - 1];
Class describing a file Path.
Path & operator=(Path &&rhs) noexcept
Move assignment.
std::string filename() const
Path(Path &&rhs) noexcept
Move constructor.
Path()
Default constructor.
Path & operator=(Path const &rhs)
Copy assignment.
static void setPathPrefix(std::string_view p)
Set the path prefix of the file.
std::string extension() const
Path(Path const &rhs)
Copy constructor.
static std::string_view getPathPrefix()
Get the path prefix of the file.
std::istream & operator>>(std::istream &is, Path &p)
Operator use with the class Path while parsing the XML file.
void makeDirectory(std::string const &path)
Create a directory path, where parent directories must already exist.
std::string string
String type.
void makeDirsForPath(std::string const &path)
Make directories for path.
std::string getAbsolutePath(std::string const &path)
Gets the absolute path of a file.
std::string trimPath(std::string const &path)
Remove the trailing slash is if present.
std::pair< std::string, std::string > splitPath(std::string const &path)
Split the path in two parts: directory name and file name.
std::vector< std::string > readDirectory(std::string const &path)
List all the files of one directory.
std::string joinPath(ARGS const &... args)
Join parts of a path.
bool isAbsolutePath(std::string const &path)
Tells whether the path is absolute of not.
std::string_view string_view
String type.