From 3ef6dcd55ea47f0504d47ca67f171aa3beb616e9 Mon Sep 17 00:00:00 2001 From: Emmanuel Benoit Date: Sun, 23 Dec 2018 22:28:33 +0100 Subject: [PATCH] Path style comparison operators --- include/ebcl/Filesystem.hh | 3 +++ include/ebcl/inline/Filesystem.hh | 16 ++++++++++++++++ 2 files changed, 19 insertions(+) diff --git a/include/ebcl/Filesystem.hh b/include/ebcl/Filesystem.hh index 89d4fe1..8c456d9 100644 --- a/include/ebcl/Filesystem.hh +++ b/include/ebcl/Filesystem.hh @@ -66,6 +66,9 @@ class T_FSPathStyle constexpr bool isSeparator( T_Character chr ) 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 diff --git a/include/ebcl/inline/Filesystem.hh b/include/ebcl/inline/Filesystem.hh index 179d24e..5146d0e 100644 --- a/include/ebcl/inline/Filesystem.hh +++ b/include/ebcl/inline/Filesystem.hh @@ -83,6 +83,22 @@ inline constexpr bool T_FSPathStyle::isSeparator( || ( ( 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( )