Path style comparison operators

This commit is contained in:
Emmanuel BENOîT 2018-12-23 22:28:33 +01:00
parent f519387dad
commit 3ef6dcd55e
2 changed files with 19 additions and 0 deletions

View file

@ -66,6 +66,9 @@ class T_FSPathStyle
constexpr bool isSeparator( T_Character chr ) const noexcept; constexpr bool isSeparator( T_Character chr ) const noexcept;
bool isValidRoot( T_String const& string ) const noexcept; bool isValidRoot( T_String const& string ) const noexcept;
constexpr bool operator ==( T_FSPathStyle const& other ) const noexcept;
constexpr bool operator !=( T_FSPathStyle const& other ) const noexcept;
//---------------------------------------------------------------------- //----------------------------------------------------------------------
// Pre-initialised styles // Pre-initialised styles

View file

@ -83,6 +83,22 @@ inline constexpr bool T_FSPathStyle::isSeparator(
|| ( ( pathSeparators_ & E_FSPathSeparator::SLASH ) && chr == '\\' ); || ( ( pathSeparators_ & E_FSPathSeparator::SLASH ) && chr == '\\' );
} }
inline constexpr bool T_FSPathStyle::operator ==(
T_FSPathStyle const& other ) const noexcept
{
return pathSeparators_ == other.pathSeparators_
&& caseSensitive_ == other.caseSensitive_
&& hasDriveLetter_ == other.hasDriveLetter_;
}
inline constexpr bool T_FSPathStyle::operator !=(
T_FSPathStyle const& other ) const noexcept
{
return pathSeparators_ != other.pathSeparators_
|| caseSensitive_ != other.caseSensitive_
|| hasDriveLetter_ != other.hasDriveLetter_;
}
/*----------------------------------------------------------------------------*/ /*----------------------------------------------------------------------------*/
inline constexpr T_FSPathStyle T_FSPathStyle::Unix( ) inline constexpr T_FSPathStyle T_FSPathStyle::Unix( )