PixelLightAPI  .
Classes | Public Member Functions
PLCore::ZipHandle Class Reference

This class represents a handle for working on a ZIP-file. More...

#include <ZipHandle.h>

List of all members.

Classes

class  ZipEntry
 Represents an entry (file or directory) in a ZIP-file. More...

Public Member Functions

PLCORE_API ZipHandle ()
 Constructor.
PLCORE_API ~ZipHandle ()
 Destructor.
PLCORE_API bool IsOpen () const
 Check if the ZIP-file is open.
PLCORE_API bool Open (const String &sFilename, const String &sPassword, bool bCaseSensitive=true, bool bMemBuf=true, const FileAccess *pAccess=nullptr)
 Open the ZIP-file.
PLCORE_API bool Close ()
 Close the ZIP file.
PLCORE_API bool IsCaseSensitive () const
 Returns whether names treated case sensitive.
PLCORE_API bool LocateFirstFile ()
 Sets the pointer to the first entry in the ZIP-file.
PLCORE_API bool LocateNextFile ()
 Sets the pointer to the next entry in the ZIP-file.
PLCORE_API bool LocateFile (const String &sFilename)
 Sets the pointer to a specific entry in the ZIP-file.
PLCORE_API const ZipEntryGetCurrentFile () const
 Get information about the current entry in the ZIP-file.
PLCORE_API bool IsFileOpen () const
 Check if a file is currently open.
PLCORE_API bool OpenFile ()
 Open the currently selected file.
PLCORE_API bool CloseFile ()
 Close file.
PLCORE_API uint32 Read (void *pBuffer, uint32 nSize, uint32 nCount)
 Reads data from the file.
PLCORE_API bool Seek (int32 nOffset, File::ESeek nLocation)
 Sets the starting position.
PLCORE_API int32 Tell () const
 Returns the file position.
PLCORE_API bool IsEof () const
 Returns whether end of file has been reached.
PLCORE_API uint32 GetLocalExtrafieldSize () const
 Gets the size of the current file's extra data field.
PLCORE_API bool GetLocalExtrafield (void *pBuffer, uint32 nSize)
 Reads the extra data of the current file.

Detailed Description

This class represents a handle for working on a ZIP-file.

Remarks:
It can be used to navigate inside the ZIP-file and read data from it, but you don't need to use it directly, as ZIP-files can be directly accessed through the File/Directory classes (e.g.: File("C:\\test.zip\\readme.txt") to extract a file from a ZIP-file)

Constructor & Destructor Documentation

Destructor.


Member Function Documentation

PLCORE_API bool PLCore::ZipHandle::IsOpen ( ) const

Check if the ZIP-file is open.

Returns:
'true', if the file is valid, 'false' on error
PLCORE_API bool PLCore::ZipHandle::Open ( const String sFilename,
const String sPassword,
bool  bCaseSensitive = true,
bool  bMemBuf = true,
const FileAccess pAccess = nullptr 
)

Open the ZIP-file.

Parameters:
[in]sFilenameFilename of the ZIP-file
[in]sPasswordPassword if the file is encrypted, else empty string
[in]bCaseSensitiveShall the filenames be treated case sensitive?
[in]bMemBufShall the ZIP-file be read into a memory-buffer?
[in]pAccessAccess information to pass through (can be a null pointer)
Returns:
'true', if the file could be opened, 'false' on error
PLCORE_API bool PLCore::ZipHandle::Close ( )

Close the ZIP file.

Returns:
'true', if the file could be closed, 'false' on error
PLCORE_API bool PLCore::ZipHandle::IsCaseSensitive ( ) const

Returns whether names treated case sensitive.

Returns:
'true' if names treated case sensitive, else 'false'

Sets the pointer to the first entry in the ZIP-file.

Returns:
'true', if the file is valid, 'false' on error
PLCORE_API bool PLCore::ZipHandle::LocateNextFile ( )

Sets the pointer to the next entry in the ZIP-file.

Returns:
'true', if the file is valid, 'false' on error
PLCORE_API bool PLCore::ZipHandle::LocateFile ( const String sFilename)

Sets the pointer to a specific entry in the ZIP-file.

Parameters:
[in]sFilenameName of the file
Returns:
'true', if the file is valid, 'false' on error
PLCORE_API const ZipEntry& PLCore::ZipHandle::GetCurrentFile ( ) const

Get information about the current entry in the ZIP-file.

Returns:
Current ZipEntry, could be invalid (see ZipEntry::IsValid)
PLCORE_API bool PLCore::ZipHandle::IsFileOpen ( ) const

Check if a file is currently open.

Returns:
'true' if a file is currently open, else 'false'
PLCORE_API bool PLCore::ZipHandle::OpenFile ( )

Open the currently selected file.

Returns:
'true' if all went fine, else 'false'
PLCORE_API bool PLCore::ZipHandle::CloseFile ( )

Close file.

Returns:
'true' if all went fine, else 'false'
PLCORE_API uint32 PLCore::ZipHandle::Read ( void *  pBuffer,
uint32  nSize,
uint32  nCount 
)

Reads data from the file.

Parameters:
[out]pBufferBuffer to store the data (MUST be valid and large enough!)
[in]nSizeItem size in bytes
[in]nCountNumber of items to read
Returns:
Number of full read items, if != 'nCount' an error occurred
PLCORE_API bool PLCore::ZipHandle::Seek ( int32  nOffset,
File::ESeek  nLocation 
)

Sets the starting position.

Parameters:
[in]nOffsetFile offset in bytes relative to the given location
[in]nLocationLocation
Returns:
'true' if all went fine, else 'false'
PLCORE_API int32 PLCore::ZipHandle::Tell ( ) const

Returns the file position.

Returns:
Current position within the file, or < 0 on error
PLCORE_API bool PLCore::ZipHandle::IsEof ( ) const

Returns whether end of file has been reached.

Returns:
'true', if the end of the file has been reached, else 'false'
PLCORE_API uint32 PLCore::ZipHandle::GetLocalExtrafieldSize ( ) const

Gets the size of the current file's extra data field.

Returns:
Size of the local data field
PLCORE_API bool PLCore::ZipHandle::GetLocalExtrafield ( void *  pBuffer,
uint32  nSize 
)

Reads the extra data of the current file.

Parameters:
[out]pBufferBuffer to store the data (MUST valid and large enough!)
[in]nSizeSize of the buffer (MUST be valid!)
Returns:
'true', if all went fine, else 'false'

The documentation for this class was generated from the following file:


PixelLight PixelLight 0.9.10-R1
Copyright (C) 2002-2011 by The PixelLight Team
Last modified Fri Dec 23 2011 15:51:14
The content of this PixelLight document is published under the
Creative Commons Attribution-NonCommercial-ShareAlike 3.0 Unported