ref.reset( new UrlBase());
ref->config("require_host", "m"); // host is mandatory
addUrlByScheme("nfs", ref);
+ addUrlByScheme("nfs4", ref);
addUrlByScheme("smb", ref);
addUrlByScheme("cifs", ref);
addUrlByScheme("http", ref);
}
+ ///////////////////////////////////////////////////////////////////
+ namespace
+ {
+ inline bool isInList( const char ** begin_r, const char ** end_r, const std::string & scheme_r )
+ {
+ for ( ; begin_r != end_r; ++begin_r )
+ if ( scheme_r == *begin_r )
+ return true;
+ return false;
+ }
+ }
+ bool Url::schemeIsLocal( const std::string & scheme_r )
+ {
+ static const char * val[] = { "cd", "dvd", "dir", "hd", "iso", "file" };
+ return isInList( arrayBegin(val), arrayEnd(val), scheme_r );
+ }
+
+ bool Url::schemeIsRemote( const std::string & scheme_r )
+ {
+ static const char * val[] = { "http", "https", "nfs", "nfs4", "smb", "cifs", "ftp", "sftp" };
+ return isInList( arrayBegin(val), arrayEnd(val), scheme_r );
+ }
+
+ bool Url::schemeIsVolatile( const std::string & scheme_r )
+ {
+ static const char * val[] = { "cd", "dvd" };
+ return isInList( arrayBegin(val), arrayEnd(val), scheme_r );
+ }
+
+ bool Url::schemeIsDownloading( const std::string & scheme_r )
+ {
+ static const char * val[] = { "http", "https", "ftp", "sftp" };
+ return isInList( arrayBegin(val), arrayEnd(val), scheme_r );
+ }
+ ///////////////////////////////////////////////////////////////////
+
// -----------------------------------------------------------------
bool
Url::isValid() const
isValidScheme(const std::string &scheme) const;
+ /** hd cd dvd dir file iso */
+ static bool schemeIsLocal( const std::string & scheme_r );
+ /** \overload nonstatic version */
+ bool schemeIsLocal() const { return schemeIsLocal( getScheme() ); }
+
+ /** nfs nfs4 smb cifs http https ftp sftp */
+ static bool schemeIsRemote( const std::string & scheme_r );
+ /** \overload nonstatic version */
+ bool schemeIsRemote() const { return schemeIsRemote( getScheme() ); }
+
+ /** cd dvd */
+ static bool schemeIsVolatile( const std::string & scheme_r );
+ /** \overload nonstatic version */
+ bool schemeIsVolatile() const { return schemeIsVolatile( getScheme() ); }
+
+ /** http https ftp sftp */
+ static bool schemeIsDownloading( const std::string & scheme_r );
+ /** \overload nonstatic version */
+ bool schemeIsDownloading() const { return schemeIsDownloading( getScheme() ); }
+
/**
* \brief Verifies the Url.
*