MCPcopy Create free account
hub / github.com/SpartanJ/eepp / loadAsyncFromFile

Method loadAsyncFromFile

src/eepp/ui/doc/textdocument.cpp:860–883  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

858}
859
860bool TextDocument::loadAsyncFromFile( const std::string& path, std::shared_ptr<ThreadPool> pool,
861 std::function<void( TextDocument*, bool )> onLoaded ) {
862 mLoading = true;
863 mLoadingAsync = true;
864 {
865 Lock l( mLoadingFilePathMutex );
866 mLoadingFilePath = path;
867 mLoadingFileURI = URI( "file://" + mLoadingFilePath );
868 }
869 pool->run( [this, path, onLoaded] {
870 auto loaded = loadFromFile( path );
871 if ( loaded != LoadStatus::Interrupted && onLoaded ) {
872 onLoaded( this, loaded == LoadStatus::Loaded );
873 }
874 {
875 Lock l( mLoadingFilePathMutex );
876 mLoadingFilePath.clear();
877 mLoadingFileURI = URI();
878 }
879 notifyDocumentLoaded();
880 mLoadingAsync = false;
881 } );
882 return true;
883}
884
885TextDocument::LoadStatus TextDocument::loadFromMemory( const Uint8* data, const Uint32& size ) {
886 IOStreamMemory stream( (const char*)data, size );

Callers 1

loadAsyncFileFromPathMethod · 0.45

Calls 2

runMethod · 0.45
clearMethod · 0.45

Tested by

no test coverage detected