Class sh::filesystem::Eurl¶
-
class
sh::filesystem
::
Eurl
: public std::enable_shared_from_this<Eurl>¶ Filesystem paths.
A Extended Uniform Resource Locator is something like a URL.
It is more general since it can also be nested. It is something like
zip:/[]//zippedfolder/zippedfile
.You get Eurl instances only from the factory methods. There will never be two instances with the same textual value.
Please note: Instances can be associated with any kind of elements in the filesystem (files, directories, links, …). It might also point to something which does not exist at all. The documentation sometimes explicitly makes a difference between those kinds (files, directories, links, …; often called ‘node type’). But it often uses the term ‘file’ implicitly while meaning all kinds of elements; assuming that e.g. a directory is just a special kind of a file. It should be clear from the particular context which meaning applies.
Public Functions
-
QString
asString
() const¶ Returns the textual value. This is what Eurl.fromString would expect as parameter.
-
QString
hostname
() const¶ Returns the hostname part (from the outer url of this Eurl). Examples:
"livingroom-pc"
forsmb://livingroom-pc/foo/bar/baz
.""
for.
-
QString
path
() const¶ Returns the path part (from the outer url of this Eurl). Examples:
"/foo/bar/baz"
forsmb://livingroom-pc/foo/bar/baz
."/foo/bar/baz"
for.
"/"
for.
-
QString
basename
() const¶ Returns the last path segment. This is the text behind the last slash. Examples:
"baz"
for.
""
for.
-
QString
scheme
() const¶ Returns the scheme (from the outer url of this shallot.Eurl). This is what comes before the
://
. Example:"file"
for.
-
std::shared_ptr<const Eurl>
outerUrl
() const¶ Returns a new Eurl containing only the outer part of this one (strips the embeddings). Example:
foobar://host/foo/bar/baz
forfoobar:/[zip:/[]//d/e]//foo/bar/baz
.
-
std::shared_ptr<const Eurl>
outermostInnerEurl
() const¶ Returns a new Eurl containing only the embedding of this one. Example:
zip:/[]//d/e
forfoobar:/[zip:/[]//d/e]//foo/bar/baz
.
-
std::shared_ptr<const Eurl>
withAppendedSegment
(QString basename) const¶ Returns a new Eurl from this one with “/basename” appended. The parameter is assumed to be a single path segment.
-
std::shared_ptr<const Eurl>
withAppendedSegments
(QString path) const¶ Returns a new Eurl with path segments “/pa/t/h/” appended. The parameter may contain
"/"
s for dividing path segments.
-
std::shared_ptr<const Eurl>
root
() const¶ Returns the root Eurl from this one. Example:
zip:/[]//
forzip:/[]//foo/bar/baz
.
-
std::shared_ptr<const Eurl>
enwrapWithOuterUrl
(QString scheme, QString hostname, QString path) const¶ Returns a new Eurl containing this one packed as embedding and new outer parts
scheme
,hostname
andpath
. Example:scheme:/[]/hostname/p/a/t/h
for.
-
std::shared_ptr<const Eurl>
parentSegment
() const¶ Returns the parent Eurl. At first, this traverses path segments. For a root path eurl with embeddings, it returns the embedding. If none are available, it returns
0
. Examples:foo://host/foo
forfoo://host/foo/bar
.foo://host/
forfoo://host/boo
.foo:/[bar://host/goo]/anotherhost/
forfoo:/[bar://host/goo]/anotherhost/boo
.bar://host/foo
forfoo:/[bar://host/foo]/host/
.0
forfoo://host/
.
-
bool
hasInnerUrls
() const¶ Checks if this Eurl has embeddings. Examples:
true
forfoo:/[bar:///foo]/host/
.false
forfoo://host/
.
-
bool
outerUrlIsRootDirectory
() const¶ Checks if this Eurl is a root path (with or without embeddings). Examples:
true
forfoo://host/
.false
forfoo://host/a
.true
forfoo:/[bar:///goo]/host/
.false
forfoo:/[bar:///goo]/host/a
.true
forfoo:/[bar:///goo]//
.false
forfoo:/[bar:///goo]//a
.
-
bool
hasParentSegment
() const¶ Checks if this Eurl has a parent segment. This indicates if Eurl.parentSegment would return
0
.
Checks if this Eurl is a prefix of another one. This is not an equivalent to a string comparison but it checks parent relationships according to Eurl.parentSegment.
-
Eurl
(QString eurlstring)¶ Constructed only by the infrastructure and made available otherwise.
-
~Eurl
()¶
Public Static Functions
-
std::shared_ptr<const Eurl>
fromString
(QString eurlstring)¶ Constructs a new Eurl by string (what Eurl.asString would return).
-
std::shared_ptr<const Eurl>
create
(QString scheme, QString hostname, QString path)¶ Constructs a new Eurl by scheme name, hostname and a path.
-
std::shared_ptr<const Eurl>
create
(QString scheme, const Eurl *inner, QString hostname, QString path)¶ Constructs a new Eurl by scheme name, an inner eurl, a hostname and a path.
-
void
filenameCheck
(QString filename)¶ Checks if a name is a valid filename. If not, EurlMisformattedException is thrown.
-
void
doInitialize
()¶
-
void
doShutdown
()¶
Public Static Attributes
-
const QChar
WRAPPER_BEGIN
= '['¶ The character marking the begin of an embedding.
-
const QChar
WRAPPER_END
= ']'¶ The character marking the end of an embedding.
-
const QString
FORBIDDEN_FILENAME_CHARACTERS
= QString("/")¶ Characters which are forbidden in filenames.
Private Members
-
const QString
_eurlstring
¶
-
bool
_cache_outerurl_isthis
= false¶
-
bool
_cache_root_isthis
= false¶
-
QString
_cache_basename
¶
-
QString
_cache_hostname
¶
-
QString
_cache_path
¶
-
QString
_cache_scheme
¶
Private Static Functions
-
QString
check_scheme
(QString scheme)¶
-
QString
check_inner
(QString inner)¶
-
QString
check_hostname
(QString hostname)¶
-
QString
check_path
(QString path)¶
-
QString
check_filename
(QString filename)¶
-
QString
_escape
(QString s)¶
-
QString
_unescape
(QString s)¶
-
QString