Nebula
Loading...
Searching...
No Matches
archivefilesystembase.h
Go to the documentation of this file.
1#pragma once
2//------------------------------------------------------------------------------
12#include "core/refcounted.h"
13#include "core/singleton.h"
14#include "util/dictionary.h"
15#include "io/uri.h"
16
17//------------------------------------------------------------------------------
18namespace IO
19{
20class Archive;
21
23{
26public:
30 virtual ~ArchiveFileSystemBase();
31
33 void Setup();
35 void Discard();
37 bool IsValid() const;
38
40 virtual Ptr<Archive> Mount(const URI& uri);
42 virtual Ptr<Archive> MountEmbedded(const URI& uri, const Util::String& rootPath);
44 virtual void Unmount(const URI& uri);
46 virtual void Unmount(const Ptr<Archive>& archive);
48 bool IsMounted(const URI& uri) const;
49
51 bool HasArchives() const;
52
56 Ptr<Archive> FindArchive(const URI& uri) const;
57
59 virtual Ptr<Archive> FindArchiveWithFile(const URI& fileUri) const;
61 virtual Ptr<Archive> FindArchiveWithDir(const URI& dirUri) const;
63 URI ConvertFileToArchiveURIIfExists(const URI& uri) const;
65 URI ConvertDirToArchiveURIIfExists(const URI& uri) const;
66
67protected:
70 bool isValid;
71};
72
73//------------------------------------------------------------------------------
76inline bool
78{
79 return this->isValid;
80}
81
82} // namespace IO
83//------------------------------------------------------------------------------
The common base class of Nebula.
Definition refcounted.h:38
Definition archivefilesystembase.h:23
bool isValid
Definition archivefilesystembase.h:70
bool HasArchives() const
Any archives mounted?
Definition archivefilesystembase.cc:194
virtual Ptr< Archive > FindArchiveWithDir(const URI &dirUri) const
find first archive which contains the directory path
Definition archivefilesystembase.cc:216
void Setup()
setup the archive file system
Definition archivefilesystembase.cc:46
virtual Ptr< Archive > Mount(const URI &uri)
mount an archive
Definition archivefilesystembase.cc:78
bool IsMounted(const URI &uri) const
return true if an archive is mounted
Definition archivefilesystembase.cc:181
virtual Ptr< Archive > MountEmbedded(const URI &uri, const Util::String &rootPath)
mount an embedded archive
Definition archivefilesystembase.cc:89
Util::Array< Ptr< Archive > > GetMountedArchives() const
get an array of all mounted archives
Definition archivefilesystembase.cc:147
virtual Ptr< Archive > FindArchiveWithFile(const URI &fileUri) const
find first archive which contains the file path
Definition archivefilesystembase.cc:205
bool IsValid() const
return true if archive file system has been setup
Definition archivefilesystembase.h:77
ArchiveFileSystemBase()
constructor
Definition archivefilesystembase.cc:21
Util::Dictionary< Util::String, Ptr< Archive > > archives
Definition archivefilesystembase.h:69
URI ConvertFileToArchiveURIIfExists(const URI &uri) const
transparently convert a URI pointing to a file into a matching archive URI
Definition archivefilesystembase.cc:231
__DeclareInterfaceSingleton(ArchiveFileSystemBase)
virtual void Unmount(const URI &uri)
unmount an archive by URI
Definition archivefilesystembase.cc:130
virtual ~ArchiveFileSystemBase()
destructor
Definition archivefilesystembase.cc:30
Threading::CriticalSection critSect
Definition archivefilesystembase.h:68
Ptr< Archive > FindArchive(const URI &uri) const
find a zip archive by its URI, returns invalid ptr if not mounted
Definition archivefilesystembase.cc:162
URI ConvertDirToArchiveURIIfExists(const URI &uri) const
transparently convert a URI pointing to a directory into a matching archive URI
Definition archivefilesystembase.cc:248
void Discard()
discard the archive file system
Definition archivefilesystembase.cc:57
__DeclareClass(ArchiveFileSystemBase)
Wrapper class for a platform-specific file archive.
An URI object can split a Uniform Resource Identifier string into its components or build a string fr...
Definition uri.h:67
Nebula's smart pointer class which manages the life time of RefCounted objects.
Definition ptr.h:38
Critical section objects are used to protect a portion of code from parallel execution.
Nebula's dynamic array class.
Definition array.h:60
A collection of key/value pairs with quick value retrieval by key at roughly O(log n).
Definition dictionary.h:34
Instances of wrapped stream classes.
Definition orientation.cc:10
Nebula's universal string class.
Definition string.h:50