MCPcopy Create free account
hub / github.com/OpenMW/openmw / getFileSize

Method getFileSize

components/esm3/readerscache.cpp:80–99  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

78 }
79
80 std::size_t ReadersCache::getFileSize(std::size_t index)
81 {
82 const auto indexIt = mIndex.find(index);
83 if (indexIt == mIndex.end())
84 return 0;
85 switch (indexIt->second->mState)
86 {
87 case State::Busy:
88 case State::Free:
89 if (!indexIt->second->mReader.getName().empty())
90 return indexIt->second->mReader.getFileSize();
91 throw std::logic_error("ESMReader at index " + std::to_string(index) + " has not been opened yet");
92 case State::Closed:
93 if (indexIt->second->mFileSize)
94 return *indexIt->second->mFileSize;
95 throw std::logic_error("ESMReader at index " + std::to_string(index) + " has forgotten its file size");
96 default:
97 throw std::logic_error("ESMReader at index " + std::to_string(index) + " in unknown state");
98 }
99 }
100
101 void ReadersCache::closeExtraReaders()
102 {

Callers 7

closeExtraReadersMethod · 0.45
loadEsmFunction · 0.45
TEST_FFunction · 0.45
loadMethod · 0.45
loadESM4Method · 0.45
loadGameMethod · 0.45

Calls 5

to_stringFunction · 0.85
findMethod · 0.45
endMethod · 0.45
emptyMethod · 0.45
getNameMethod · 0.45

Tested by

no test coverage detected