| 
    KiCad PCB EDA Suite
    
   | 
 
An asset archive represents a file containing data assets that are loaded from disk and then cached in memory. More...
#include <asset_archive.h>
Classes | |
| struct | FILE_INFO | 
Public Member Functions | |
| ASSET_ARCHIVE (const wxString &aFilePath, bool aLoadNow=true) | |
| ~ASSET_ARCHIVE ()=default | |
| bool | Load () | 
| long | GetFileContents (const wxString &aFilePath, const unsigned char *aDest, size_t aMaxLen) | 
| Retrieves a file with the given path from the cached archive.   | |
| long | GetFilePointer (const wxString &aFilePath, const unsigned char **aDest) | 
| Retrieves a pointer to a file with the given path from the cached archive.   | |
Private Attributes | |
| std::unordered_map< wxString, FILE_INFO > | m_fileInfoCache | 
| Cache of file info for a given file path.   | |
| std::vector< unsigned char > | m_cache | 
| The full file contents.   | |
| wxString | m_filePath | 
| Path to the source archive file.   | |
An asset archive represents a file containing data assets that are loaded from disk and then cached in memory.
For example, a set of bitmap images.
The entire contents of the archive will be uncompressed and kept resident in memory in the current implementation, so consider this before reusing this as-is for new use cases.
Definition at line 36 of file asset_archive.h.
| ASSET_ARCHIVE::ASSET_ARCHIVE | ( | const wxString & | aFilePath, | 
| bool | aLoadNow = true ) | 
Definition at line 27 of file asset_archive.cpp.
References Load(), and m_filePath.
      
  | 
  default | 
References GetFileContents(), and GetFilePointer().
| long ASSET_ARCHIVE::GetFileContents | ( | const wxString & | aFilePath, | 
| const unsigned char * | aDest, | ||
| size_t | aMaxLen ) | 
Retrieves a file with the given path from the cached archive.
| aFilePath | is the path within the archive to the requested file | 
| aDest | is the target byte array to copy into | 
| aMaxLen | is the maximum bytes that can be copied into aDest | 
Definition at line 87 of file asset_archive.cpp.
Referenced by ~ASSET_ARCHIVE().
| long ASSET_ARCHIVE::GetFilePointer | ( | const wxString & | aFilePath, | 
| const unsigned char ** | aDest ) | 
Retrieves a pointer to a file with the given path from the cached archive.
| aFilePath | is the path within the archive to the requested file | 
| aDest | will be set to point to the start of the file if the file was found | 
Definition at line 95 of file asset_archive.cpp.
References ASSET_ARCHIVE::FILE_INFO::length, m_cache, m_fileInfoCache, and ASSET_ARCHIVE::FILE_INFO::offset.
Referenced by ~ASSET_ARCHIVE().
| bool ASSET_ARCHIVE::Load | ( | ) | 
Definition at line 35 of file asset_archive.cpp.
References ASSET_ARCHIVE::FILE_INFO::length, m_cache, m_fileInfoCache, m_filePath, and ASSET_ARCHIVE::FILE_INFO::offset.
Referenced by ASSET_ARCHIVE().
      
  | 
  private | 
The full file contents.
Definition at line 73 of file asset_archive.h.
Referenced by GetFilePointer(), and Load().
      
  | 
  private | 
Cache of file info for a given file path.
Definition at line 70 of file asset_archive.h.
Referenced by GetFilePointer(), and Load().
      
  | 
  private | 
Path to the source archive file.
Definition at line 76 of file asset_archive.h.
Referenced by ASSET_ARCHIVE(), and Load().