corelib/include/ebcl/inline/Filesystem.hh

171 lines
3.5 KiB
C++
Raw Normal View History

2017-12-27 10:49:31 +01:00
/******************************************************************************/
/* FILESYSTEM ABSTRACTION - INLINE CODE ***************************************/
/******************************************************************************/
#ifndef _H_EBCL_INLINE_FILESYSTEM
#define _H_EBCL_INLINE_FILESYSTEM
#include <ebcl/Filesystem.hh>
namespace ebcl {
/*= T_FSPath =================================================================*/
inline T_FSPath::T_FSPath( ) noexcept
: root_{ } , components_{ } , valid_{ true }
{ }
/*----------------------------------------------------------------------------*/
inline T_FSPath::T_FSPath(
T_FSPath const& other ) noexcept
: root_{ other.root_ } , components_{ other.components_ } ,
valid_{ other.valid_ }
{ }
inline T_FSPath& T_FSPath::operator =(
T_FSPath const& other ) noexcept
{
root_ = other.root_;
components_ = other.components_;
valid_ = other.valid_;
return *this;
}
/*----------------------------------------------------------------------------*/
inline T_FSPath::T_FSPath( T_FSPath&& other ) noexcept
: T_FSPath{ }
{
swap( other );
}
inline T_FSPath& T_FSPath::operator =(
T_FSPath&& other ) noexcept
{
root_ = T_String{ };
components_.free( );
valid_ = true;
return swap( other );
}
/*----------------------------------------------------------------------------*/
inline T_FSPath& T_FSPath::swap(
T_FSPath& other ) noexcept
{
using std::swap;
swap( root_ , other.root_ );
swap( components_ , other.components_ );
swap( valid_ , other.valid_ );
return *this;
}
inline M_DEFINE_SWAP( T_FSPath )
{
lhs.swap( rhs );
}
/*----------------------------------------------------------------------------*/
inline bool T_FSPath::isValid( ) const noexcept
{
return valid_;
}
inline T_String const& T_FSPath::root( ) const noexcept
{
return root_;
}
inline T_FSPath::T_Components const& T_FSPath::components( ) const noexcept
{
return components_;
}
inline bool T_FSPath::isRelative( ) const noexcept
{
return !root_;
}
inline bool T_FSPath::isAbsolute( ) const noexcept
{
return bool( root_ );
}
/*----------------------------------------------------------------------------*/
inline T_String T_FSPath::toString( ) const noexcept
{
T_StringBuilder sb;
appendTo( sb );
return T_String{ std::move( sb ) };
}
inline M_DEFINE_HASH( T_FSPath )
{
return item.computeHash( );
}
inline M_LSHIFT_OP( T_StringBuilder , T_FSPath const& )
{
value.appendTo( obj );
return obj;
}
/*----------------------------------------------------------------------------*/
inline bool T_FSPath::operator ==(
T_FSPath const& other ) const noexcept
{
return compareTo( other ) == 0;
}
inline bool T_FSPath::operator !=(
T_FSPath const& other ) const noexcept
{
return compareTo( other ) != 0;
}
inline bool T_FSPath::operator <(
T_FSPath const& other ) const noexcept
{
return compareTo( other ) < 0;
}
inline bool T_FSPath::operator <=(
T_FSPath const& other ) const noexcept
{
return compareTo( other ) <= 0;
}
inline bool T_FSPath::operator >(
T_FSPath const& other ) const noexcept
{
return compareTo( other ) > 0;
}
inline bool T_FSPath::operator >=(
T_FSPath const& other ) const noexcept
{
return compareTo( other ) >= 0;
}
/*----------------------------------------------------------------------------*/
inline bool T_FSPath::isChildOf(
T_FSPath const& other ) const noexcept
{
return other.isParentOf( *this );
}
inline bool T_FSPath::isUnder(
T_FSPath const& other ) const noexcept
{
return other.isAbove( *this );
}
} // namespace ebcl
#endif // _H_EBCL_INLINE_FILESYSTEM