T_FSPathStyle - Most methods made constexpr
This commit is contained in:
parent
af1648dcb4
commit
96d81b9cd3
3 changed files with 54 additions and 42 deletions
|
@ -14,28 +14,24 @@ using namespace ebcl;
|
|||
#endif
|
||||
|
||||
|
||||
/*= T_FSPath =================================================================*/
|
||||
/*= T_FSPathStyle ============================================================*/
|
||||
|
||||
bool T_FSPath::IsValidRoot(
|
||||
T_String const& str ) noexcept
|
||||
bool T_FSPathStyle::isValidRoot(
|
||||
T_String const& string ) const noexcept
|
||||
{
|
||||
if ( !str ) {
|
||||
return true;
|
||||
}
|
||||
|
||||
#ifdef _WIN32
|
||||
// TODO: support for network names (\\server\path)
|
||||
if ( str.length( ) == 3 && ( str.endsWith( ":\\" )
|
||||
|| str.endsWith( ":/" ) ) ) {
|
||||
return str[ 0 ].isAlpha( );
|
||||
} else {
|
||||
return ( str == "/" || str == "\\" );
|
||||
}
|
||||
#else
|
||||
return ( str == "/" || str == "\\" );
|
||||
#endif
|
||||
const auto sl( string.length( ) );
|
||||
return ( sl == 0 )
|
||||
|| ( sl == 1 && isSeparator( string[ 0 ] ) )
|
||||
|| ( hasDriveLetter_
|
||||
&& string.length( ) == 3
|
||||
&& string[ 0 ].isAlpha( )
|
||||
&& string[ 1 ] == ':'
|
||||
&& isSeparator( string[ 2 ] ) );
|
||||
}
|
||||
|
||||
|
||||
/*= T_FSPath =================================================================*/
|
||||
|
||||
bool T_FSPath::IsValidComponent(
|
||||
T_String const& str ) noexcept
|
||||
{
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue