Nebula
Loading...
Searching...
No Matches
archivebase.h
Go to the documentation of this file.
1#pragma once
2//------------------------------------------------------------------------------
13#include "core/refcounted.h"
14#include "io/uri.h"
15
16//------------------------------------------------------------------------------
17namespace IO
18{
20{
22public:
26 virtual ~ArchiveBase();
27
29 bool Setup(const URI& archiveURI, const Util::String& rootPath);
31 void Discard();
33 bool IsValid() const;
35 const URI& GetURI() const;
36
38 Util::Array<Util::String> ListFiles(const Util::String& dirPathInArchive, const Util::String& pattern) const;
40 Util::Array<Util::String> ListDirectories(const Util::String& dirPathInArchive, const Util::String& pattern) const;
42 URI ConvertToArchiveURI(const URI& fileURI) const;
45
46protected:
47 bool isValid;
49};
50
51//------------------------------------------------------------------------------
54inline bool
56{
57 return this->isValid;
58}
59
60//------------------------------------------------------------------------------
63inline const URI&
65{
66 return this->uri;
67}
68
69} // namespace IO
70//------------------------------------------------------------------------------
71
72
The common base class of Nebula.
Definition refcounted.h:38
Base class of file archives.
Definition archivebase.h:20
const URI & GetURI() const
get the URI of the archive
Definition archivebase.h:64
URI ConvertToArchiveURI(const URI &fileURI) const
convert a "file:" URI into a archive-specific URI pointing into this archive
Definition archivebase.cc:88
bool isValid
Definition archivebase.h:47
virtual ~ArchiveBase()
destructor
Definition archivebase.cc:27
Util::Array< Util::String > ListDirectories(const Util::String &dirPathInArchive, const Util::String &pattern) const
list all subdirectories in a directory in the archive
Definition archivebase.cc:74
bool IsValid() const
return true if archive is valid
Definition archivebase.h:55
void Discard()
discard the archive
Definition archivebase.cc:51
__DeclareClass(ArchiveBase)
ArchiveBase()
constructor
Definition archivebase.cc:18
Util::String ConvertToPathInArchive(const Util::String &absPath) const
convert an absolute path to local path inside archive, returns empty string if absPath doesn't point ...
Definition archivebase.cc:101
bool Setup(const URI &archiveURI, const Util::String &rootPath)
setup the archive from an URI (without file extension)
Definition archivebase.cc:39
Util::Array< Util::String > ListFiles(const Util::String &dirPathInArchive, const Util::String &pattern) const
list all files in a directory in the archive
Definition archivebase.cc:62
URI uri
Definition archivebase.h:48
An URI object can split a Uniform Resource Identifier string into its components or build a string fr...
Definition uri.h:67
Nebula's dynamic array class.
Definition array.h:60
Instances of wrapped stream classes.
Definition orientation.cc:10
Nebula's universal string class.
Definition string.h:50