Nebula
Loading...
Searching...
No Matches
zipfileentry.h
Go to the documentation of this file.
1#pragma once
2//------------------------------------------------------------------------------
14#include "io/stream.h"
15#include "minizip/unzip.h"
16#include "util/stringatom.h"
17#include "io/filetime.h"
18
19//------------------------------------------------------------------------------
20namespace IO
21{
23{
24public:
29
31 const Util::StringAtom& GetName() const;
34
36 bool Open(const Util::String& password = "");
38 void Close();
40 bool Read(void* buf, IO::Stream::Size bufSize) const;
41
42private:
43 friend class ZipArchive;
44
46 void Setup(const Util::StringAtom& name, unzFile zipFileHandle, Threading::CriticalSection* critSect);
47
48 Threading::CriticalSection* archiveCritSect;
50 unzFile zipFileHandle; // handle on zip file
51 unz64_file_pos filePosInfo; // info about position in zip file
52 uint64_t uncompressedSize; // uncompressed size of the file
53 uint64_t compressedSize; // compressed size of the file
54 IO::FileTime createdTime; // creation time of the file
55};
56
57//------------------------------------------------------------------------------
60inline const Util::StringAtom&
62{
63 return this->name;
64}
65
66//------------------------------------------------------------------------------
71{
72 return this->uncompressedSize;
73}
74
75} // namespace IO
76//------------------------------------------------------------------------------
77
int64_t Size
Definition stream.h:34
Util::StringAtom name
Definition zipfileentry.h:49
const Util::StringAtom & GetName() const
get name of the file entry
Definition zipfileentry.h:61
bool Open(const Util::String &password="")
open the zip file
Definition zipfileentry.cc:77
bool Read(void *buf, IO::Stream::Size bufSize) const
read the entire content into the provided memory buffer
Definition zipfileentry.cc:127
uint64_t compressedSize
Definition zipfileentry.h:53
ZipFileEntry()
constructor
Definition zipfileentry.cc:18
IO::Stream::Size GetFileSize() const
get the uncompressed file size in bytes
Definition zipfileentry.h:70
void Close()
close the zip file
Definition zipfileentry.cc:113
unz64_file_pos filePosInfo
Definition zipfileentry.h:51
friend class ZipArchive
Definition zipfileentry.h:43
uint64_t uncompressedSize
Definition zipfileentry.h:52
~ZipFileEntry()
destructor
Definition zipfileentry.cc:29
unzFile zipFileHandle
Definition zipfileentry.h:50
IO::FileTime createdTime
Definition zipfileentry.h:54
Threading::CriticalSection * archiveCritSect
Definition zipfileentry.h:48
void Setup(const Util::StringAtom &name, unzFile zipFileHandle, Threading::CriticalSection *critSect)
setup the file entry object
Definition zipfileentry.cc:38
A StringAtom.
Definition stringatom.h:22
Instances of wrapped stream classes.
Definition multiplayerfeatureunit.cc:289
Nebula's universal string class.
Definition String.cs:8