20#ifndef EMBEDDED_FILES_H
21#define EMBEDDED_FILES_H
26#include <wx/filename.h>
28#include <embedded_files_lexer.h>
97 EMBEDDED_FILE*
AddFile(
const wxFileName& aName,
bool aOverwrite );
102 void AddFile( EMBEDDED_FILE* aFile );
131 wxFileName fileName(
name );
182 auto it =
m_files.find( aName );
184 return it ==
m_files.end() ? nullptr : it->second;
235 EMBEDDED_FILES_LEXER( aReader )
void ParseEmbedded(EMBEDDED_FILES *aFiles)
EMBEDDED_FILES_PARSER(LINE_READER *aReader)
std::vector< wxString > m_fontFiles
virtual void EmbedFonts()
void RemoveFile(const wxString &name, bool aErase=true)
Removes a file from the collection and frees the memory.
EMBEDDED_FILE * GetEmbeddedFile(const wxString &aName) const
Returns the embedded file with the given name or nullptr if it does not exist.
wxFileName GetTemporaryFileName(const wxString &aName) const
const std::vector< wxString > * UpdateFontFiles()
Helper function to get a list of fonts for fontconfig to add to the library.
static RETURN_CODE DecompressAndDecode(EMBEDDED_FILE &aFile)
Takes data from the #compressedEncodedData buffer and Base64 decodes it.
wxString GetEmbeddedFileLink(const EMBEDDED_FILE &aFile) const
Returns the link for an embedded file.
bool HasFile(const wxString &name) const
void WriteEmbeddedFiles(OUTPUTFORMATTER &aOut, int aNestLevel, bool aWriteData) const
Output formatter for the embedded files.
void ClearEmbeddedFiles(bool aDeleteFiles=true)
void ClearEmbeddedFonts()
Removes all embedded fonts from the collection.
EMBEDDED_FILE * AddFile(const wxFileName &aName, bool aOverwrite)
Loads a file from disk and adds it to the collection.
const std::vector< wxString > * GetFontFiles() const
If we just need the cached version of the font files, we can use this function which is const and wil...
wxFileName GetTemporaryFileName(EMBEDDED_FILE *aFile) const
const std::map< wxString, EMBEDDED_FILE * > & EmbeddedFileMap() const
void SetAreFontsEmbedded(bool aEmbedFonts)
static RETURN_CODE CompressAndEncode(EMBEDDED_FILE &aFile)
Takes data from the #decompressedData buffer and compresses it using ZSTD into the #compressedEncoded...
std::map< wxString, EMBEDDED_FILE * > m_files
bool GetAreFontsEmbedded() const
An abstract class from which implementation specific LINE_READERs may be derived to read single lines...
static const std::string KiCadUriPrefix
std::vector< char > decompressedData
std::string compressedEncodedData
Definition of file extensions used in Kicad.