KiCad PCB EDA Suite
Loading...
Searching...
No Matches
asset_archive.h
Go to the documentation of this file.
1/*
2 * This program source code file is part of KiCad, a free EDA CAD application.
3 *
4 * Copyright (C) 2021 KiCad Developers, see AUTHORS.txt for contributors.
5 *
6 * This program is free software: you can redistribute it and/or modify it
7 * under the terms of the GNU General Public License as published by the
8 * Free Software Foundation, either version 3 of the License, or (at your
9 * option) any later version.
10 *
11 * This program is distributed in the hope that it will be useful, but
12 * WITHOUT ANY WARRANTY; without even the implied warranty of
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
14 * General Public License for more details.
15 *
16 * You should have received a copy of the GNU General Public License along
17 * with this program. If not, see <http://www.gnu.org/licenses/>.
18 */
19
20#ifndef KICAD_ASSET_ARCHIVE_H
21#define KICAD_ASSET_ARCHIVE_H
22
23#include <kicommon.h>
24#include <unordered_map>
25#include <vector>
26
27#include <core/wx_stl_compat.h>
28
37{
38public:
39 ASSET_ARCHIVE( const wxString& aFilePath, bool aLoadNow = true );
40
41 ~ASSET_ARCHIVE() = default;
42
43 bool Load();
44
52 long GetFileContents( const wxString& aFilePath, const unsigned char* aDest, size_t aMaxLen );
53
60 long GetFilePointer( const wxString& aFilePath, const unsigned char** aDest );
61
62private:
63 struct FILE_INFO
64 {
65 size_t offset;
66 size_t length;
67 };
68
70 std::unordered_map<wxString, FILE_INFO> m_fileInfoCache;
71
73 std::vector<unsigned char> m_cache;
74
76 wxString m_filePath;
77};
78
79#endif // KICAD_ASSET_ARCHIVE_H
KICAD_PLUGIN_EXPORT SCENEGRAPH * Load(char const *aFileName)
reads a model file and creates a generic display structure
An asset archive represents a file containing data assets that are loaded from disk and then cached i...
Definition: asset_archive.h:37
std::unordered_map< wxString, FILE_INFO > m_fileInfoCache
Cache of file info for a given file path.
Definition: asset_archive.h:70
~ASSET_ARCHIVE()=default
wxString m_filePath
Path to the source archive file.
Definition: asset_archive.h:76
std::vector< unsigned char > m_cache
The full file contents.
Definition: asset_archive.h:73
#define KICOMMON_API
Definition: kicommon.h:28