MCPcopy Create free account
hub / github.com/BohemiaInteractive/CWR / Load

Method Load

engine/Poseidon/IO/Streams/QBStream.cpp:405–618  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

403 CloseHandle(handle);
404 _openName = fullName;
405
406 _openBeforeOpenCallback = beforeOpen;
407 _openContext = context;
408 _files.Clear();
409 _error = false;
410 return true;
411}
412
413// All banks are locked by default; an app that wants a bank unloadable must unlock it.
414void QFBank::Lock() const
415{
416 _locked = true;
417 Load();
418}
419
420void QFBank::Unlock() const
421{
422 _locked = false;
423 if (_fileAccess && _fileAccess->RefCounter() == 1)
424 {
425 Unload();
426 }
427}
428
429bool QFBank::CanBeUnloaded() const
430{
431 return _fileAccess && _fileAccess->RefCounter() == 1;
432}
433
434// Meyer's singleton for bank functions - no global constructor!
435#pragma clang diagnostic push
436#pragma clang diagnostic ignored "-Wexit-time-destructors"
437static QFBankFunctions& GetDefaultQFBankFunctions()
438{
439 static QFBankFunctions instance;
440 return instance;
441}
442#pragma clang diagnostic pop
443
444// Constant-init nullptr (SIOF-safe); DefaultFunctions() falls back to a no-op base
445// instance until a real implementation registers.
446QFBankFunctions* QFBank::_defaultFunctions = nullptr;
447
448// Platform directory separator: entries inside PBO banks are stored
449// with the native separator so that lookups work without conversion.
450#ifdef __GNUC__
451static constexpr char NATIVE_DIR = UNIX_DIR;
452static constexpr char FOREIGN_DIR = WIN_DIR;
453static const RString NATIVE_DIR_STR("/");
454#else
455static constexpr char NATIVE_DIR = WIN_DIR;
456static constexpr char FOREIGN_DIR = UNIX_DIR;
457static const RString NATIVE_DIR_STR("\\");
458#endif
459
460static inline RStringB ConvertDirSlash(RStringB name)
461{
462 const char* change = strchr(name, FOREIGN_DIR);

Callers

nothing calls this directly

Calls 15

ErrorMessageFunction · 0.85
ConvertDirSlashFunction · 0.85
LoadFromFileFunction · 0.85
LoadIntFunction · 0.85
CreateFilebankEncryptionFunction · 0.85
TryOpenMappedBankAccessFunction · 0.85
AddClass · 0.85
SetClass · 0.85
NTablesMethod · 0.80
SetPrefixMethod · 0.80
LoadFileInfoFunction · 0.70
OpenFileForReadFunction · 0.50

Tested by

no test coverage detected