|
wxMaxima
|
The files a worksheet's XML refers to by name. More...
#include <AttachmentSource.h>
Public Types | |
| using | Files = std::map< wxString, std::string > |
| The files, by name. | |
Public Member Functions | |
| AttachmentSource ()=default | |
| No files at all: names refer to the file system. | |
| bool | IsEmpty () const |
| True if names refer to the file system instead of to attachments. | |
| wxMemoryBuffer | Read (const wxString &name) const |
| The contents of the file with this name. | |
Static Public Member Functions | |
| static AttachmentSource | FromWxmx (const wxString &wxmxFile) |
| The files stored in a .wxmx (that is: zip) archive. | |
| static AttachmentSource | FromMemory (Files files) |
| Files held in memory. | |
The files a worksheet's XML refers to by name.
The XML of a cell doesn't contain its images: an <img> only names a file, which a .wxmx keeps next to content.xml in the same zip archive. The XML wxMaxima puts on the clipboard (GH #2474) has no zip archive around it, so it carries the same files base64-encoded in an <attachments> element instead (see Format::CellsToXMLDocument()). This class hides which of the two the files come from from everything that reads them.
An AttachmentSource is cheap to copy, and copies may be read from any thread: images and gnuplot sources are read by background tasks, which keep their own copy alive for as long as they need it.
| wxMemoryBuffer AttachmentSource::Read | ( | const wxString & | name | ) | const |
The contents of the file with this name.