Ion
|
A MemoryZipStream represents ZIP data in memory; the data may represent one or more files or directories in ZIP format. More...
#include "memoryzipstream.h"
Public Types | |
typedef AllocVector< uint8 > | DataVector |
Public Member Functions | |
MemoryZipStream () | |
Constructs an empty MemoryZipStream. More... | |
MemoryZipStream (const DataVector &data) | |
Constructs a MemoryZipStream using pre-existing zip data. More... | |
MemoryZipStream (DataVector *data) | |
Constructs a MemoryZipStream using pre-existing zip data. More... | |
~MemoryZipStream () override | |
void | AddFile (const std::string &filename, const DataVector &data) |
Compresses and adds a vector of data to this, associating it with the passed filename. More... | |
void | AddFile (const std::string &filename, const std::string &data) |
Compresses and adds string data to this, associating it with the passed filename. More... | |
bool | ContainsFile (const std::string &filename) |
Returns whether this contains filename. More... | |
const DataVector | GetFileData (const std::string &filename) |
Returns the file data for filename. More... | |
const DataVector & | GetData () const |
Gets the memory buffer backing this. More... | |
const AllocatorPtr & | GetAllocator () const |
Returns the Allocator that was used for the instance. More... | |
const AllocatorPtr & | GetNonNullAllocator () const |
Return our allocator, or the default allocator if the instance was declared on the stack. More... | |
const AllocatorPtr & | GetAllocatorForLifetime (AllocationLifetime lifetime) const |
Convenience function that returns the Allocator to use to allocate an object with a specific lifetime. More... | |
void * | operator new (size_t size) |
The standard no-parameter new operator uses the default Allocator. More... | |
void * | operator new (size_t size, AllocationLifetime lifetime) |
This overloaded version of the new operator uses the AllocationManager's default Allocator for the specified lifetime. More... | |
void * | operator new (size_t size, const AllocatorPtr &allocator) |
This overloaded version of the new operator takes the Allocator to use directly as a parameter. More... | |
void * | operator new (size_t size, const AllocatorPtr &allocator, void *ptr) |
Special operator new for using placement new with Allocatables. More... | |
void * | operator new (size_t size, void *ptr) |
The placement new operator is defined conventionally. More... | |
void | operator delete (void *ptr) |
Define the delete operator to use specialized functions dealing with an Allocator. More... | |
void | operator delete (void *ptr, AllocationLifetime lifetime) |
Windows requires these (or it issues C4291 warnings). More... | |
void | operator delete (void *ptr, const AllocatorPtr &allocator) |
void | operator delete (void *ptr, void *ptr2) |
The placement delete operator does nothing, as usual. More... | |
A MemoryZipStream represents ZIP data in memory; the data may represent one or more files or directories in ZIP format.
Definition at line 33 of file memoryzipstream.h.
typedef AllocVector<uint8> ion::base::MemoryZipStream::DataVector |
Definition at line 35 of file memoryzipstream.h.
ion::base::MemoryZipStream::MemoryZipStream | ( | ) |
Constructs an empty MemoryZipStream.
Definition at line 167 of file memoryzipstream.cc.
|
explicit |
Constructs a MemoryZipStream using pre-existing zip data.
This will make a copy of the data. If the data is not valid zip data then errors will occur when trying to decompress files. No additional validation is done.
Definition at line 172 of file memoryzipstream.cc.
|
explicit |
Constructs a MemoryZipStream using pre-existing zip data.
This will take ownership of the data via a vector swap(). If the data is not valid zip data then errors will occur when trying to decompress files. No additional validation is done.
Definition at line 178 of file memoryzipstream.cc.
|
override |
Definition at line 184 of file memoryzipstream.cc.
void ion::base::MemoryZipStream::AddFile | ( | const std::string & | filename, |
const DataVector & | data | ||
) |
Compresses and adds a vector of data to this, associating it with the passed filename.
The filename may be any relative path, e.g., "foo/bar/bat.ext".
Definition at line 186 of file memoryzipstream.cc.
Referenced by AddFile().
void ion::base::MemoryZipStream::AddFile | ( | const std::string & | filename, |
const std::string & | data | ||
) |
Compresses and adds string data to this, associating it with the passed filename.
The filename may be any relative path, e.g., "foo/bar/bat.ext".
Definition at line 198 of file memoryzipstream.cc.
References AddFile().
bool ion::base::MemoryZipStream::ContainsFile | ( | const std::string & | filename | ) |
Returns whether this contains filename.
Definition at line 204 of file memoryzipstream.cc.
|
inlineinherited |
Returns the Allocator that was used for the instance.
This will be NULL if the instance was declared on the stack or created with normal placement new.
Definition at line 68 of file allocatable.h.
References allocator_.
Referenced by ion::base::DataContainer::CreateAndCopy(), ion::text::DynamicFontImage::FindContainingImageDataIndex(), and ion::text::DynamicFontImage::FindImageDataIndex().
|
inlineinherited |
Convenience function that returns the Allocator to use to allocate an object with a specific lifetime.
Definition at line 78 of file allocatable.h.
References ion::base::Allocator::GetAllocatorForLifetime().
Referenced by ion::text::BasicBuilder::BuildVertexData(), ion::text::OutlineBuilder::BuildVertexData(), ion::gfxutils::ShaderManager::CreateShaderProgram(), ion::text::DynamicFontImage::FindContainingImageDataIndex(), ion::text::DynamicFontImage::FindImageDataIndex(), ion::gfx::Renderer::Renderer(), and ion::gfx::UpdateStateTable().
const MemoryZipStream::DataVector & ion::base::MemoryZipStream::GetData | ( | ) | const |
Gets the memory buffer backing this.
Definition at line 236 of file memoryzipstream.cc.
const MemoryZipStream::DataVector ion::base::MemoryZipStream::GetFileData | ( | const std::string & | filename | ) |
Returns the file data for filename.
If the file does not exist, then the returned vector is empty.
Definition at line 211 of file memoryzipstream.cc.
|
inlineinherited |
Return our allocator, or the default allocator if the instance was declared on the stack.
Definition at line 72 of file allocatable.h.
References allocator_, and ion::base::AllocationManager::GetNonNullAllocator().
|
inlineinherited |
Define the delete operator to use specialized functions dealing with an Allocator.
Definition at line 109 of file allocatable.h.
|
inlineinherited |
Windows requires these (or it issues C4291 warnings).
Definition at line 112 of file allocatable.h.
|
inlineinherited |
Definition at line 113 of file allocatable.h.
|
inlineinherited |
The placement delete operator does nothing, as usual.
Definition at line 118 of file allocatable.h.
|
inlineinherited |
The standard no-parameter new operator uses the default Allocator.
Definition at line 84 of file allocatable.h.
|
inlineinherited |
This overloaded version of the new operator uses the AllocationManager's default Allocator for the specified lifetime.
Definition at line 88 of file allocatable.h.
|
inlineinherited |
This overloaded version of the new operator takes the Allocator to use directly as a parameter.
If the Allocator pointer is NULL, this uses the default Allocator.
Definition at line 95 of file allocatable.h.
|
inlineinherited |
Special operator new for using placement new with Allocatables.
Definition at line 100 of file allocatable.h.
|
inlineinherited |
The placement new operator is defined conventionally.
Definition at line 105 of file allocatable.h.