MCPcopy Create free account
hub / github.com/LibreSprite/LibreSprite / load_document

Function load_document

src/app/file/file.cpp:73–96  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

71}
72
73Document* load_document(Context* context, const char* filename)
74{
75 /* TODO add a option to configure what to do with the sequence */
76 std::unique_ptr<FileOp> fop(FileOp::createLoadDocumentOperation(context, filename, FILE_LOAD_SEQUENCE_NONE));
77 if (!fop)
78 return nullptr;
79
80 // Operate in this same thread
81 fop->operate();
82 fop->done();
83 fop->postLoad();
84
85 if (fop->hasError()) {
86 Console console(context);
87 console.printf(fop->error().c_str());
88 }
89
90 auto document = fop->releaseDocument();
91
92 if (document && context)
93 document->setContext(context);
94
95 return document;
96}
97
98int save_document(Context* context, doc::Document* document)
99{

Callers 2

TESTFunction · 0.85
onLoadMethod · 0.85

Calls 7

operateMethod · 0.80
hasErrorMethod · 0.80
printfMethod · 0.80
releaseDocumentMethod · 0.80
doneMethod · 0.45
postLoadMethod · 0.45
setContextMethod · 0.45

Tested by 1

TESTFunction · 0.68