jaulib v1.2.0
Jau Support Library (C++, Java, ..)
Classes | Public Member Functions | List of all members
jau::fs::dir_item Class Reference

Representing a directory item split into dirname() and basename(). More...

#include <file_util.hpp>

Collaboration diagram for jau::fs::dir_item:

Public Member Functions

 dir_item () noexcept
 Empty item w/ . More...
 
 dir_item (const std::string_view &path_) noexcept
 Create a dir_item where path is split into dirname and basename after . More...
 
 dir_item (std::string dirname__, std::string basename__) noexcept
 Create a dir_item with already cleaned dirname and basename without any further processing nor validation. More...
 
const std::string & basename () const noexcept
 Return the basename, shall not be empty nor contain a dirname. More...
 
const std::string & dirname () const noexcept
 Returns the dirname, shall not be empty and denotes . More...
 
bool empty () const noexcept
 Returns true if bot, dirname() and basename() refer to . More...
 
bool operator!= (const dir_item &rhs) const noexcept
 
bool operator== (const dir_item &rhs) const noexcept
 
std::string path () const noexcept
 Returns a full unix path representation combining dirname() and basename(). More...
 
std::string to_string () const noexcept
 Returns a comprehensive string representation of this item. More...
 

Detailed Description

Representing a directory item split into dirname() and basename().

Definition at line 90 of file file_util.hpp.

Constructor & Destructor Documentation

◆ dir_item() [1/3]

dir_item::dir_item ( )
noexcept

Empty item w/ .

set for both, dirname and basename. empty() will return true;

Definition at line 313 of file file_util.cpp.

◆ dir_item() [2/3]

dir_item::dir_item ( const std::string_view &  path_)
noexcept

Create a dir_item where path is split into dirname and basename after .

and .. has been reduced.

empty() will return true if given path_ is empty

Parameters
path_the raw path

Definition at line 316 of file file_util.cpp.

◆ dir_item() [3/3]

dir_item::dir_item ( std::string  dirname__,
std::string  basename__ 
)
noexcept

Create a dir_item with already cleaned dirname and basename without any further processing nor validation.

empty() will return true if both, given dirname_ and basename_ is empty

Parameters
dirname__
basename__
See also
reduce()
jau::fs::dirname()
jau::fs::basename()

Definition at line 309 of file file_util.cpp.

Member Function Documentation

◆ dirname()

const std::string & jau::fs::dir_item::dirname ( ) const
inlinenoexcept

Returns the dirname, shall not be empty and denotes .

for current working director.

Definition at line 196 of file file_util.hpp.

Here is the caller graph for this function:

◆ basename()

const std::string & jau::fs::dir_item::basename ( ) const
inlinenoexcept

Return the basename, shall not be empty nor contain a dirname.

Definition at line 199 of file file_util.hpp.

Here is the caller graph for this function:

◆ path()

std::string dir_item::path ( ) const
noexcept

Returns a full unix path representation combining dirname() and basename().

Definition at line 321 of file file_util.cpp.

Here is the caller graph for this function:

◆ empty()

bool jau::fs::dir_item::empty ( ) const
inlinenoexcept

Returns true if bot, dirname() and basename() refer to .

, e.g.. default ctor.

Definition at line 209 of file file_util.hpp.

Here is the caller graph for this function:

◆ operator==()

bool jau::fs::dir_item::operator== ( const dir_item rhs) const
inlinenoexcept

Definition at line 211 of file file_util.hpp.

◆ operator!=()

bool jau::fs::dir_item::operator!= ( const dir_item rhs) const
inlinenoexcept

Definition at line 215 of file file_util.hpp.

◆ to_string()

std::string dir_item::to_string ( ) const
noexcept

Returns a comprehensive string representation of this item.

Definition at line 334 of file file_util.cpp.

Here is the caller graph for this function:

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