From cff11fbca9bfdfcb50ea4290f5057e219bb649ec Mon Sep 17 00:00:00 2001 From: jvoisin Date: Mon, 21 Jun 2021 14:22:26 +0200 Subject: [PATCH] Inline a couple of methods in esmreader.cpp --- components/esm/esmreader.cpp | 30 ------------------------------ components/esm/esmreader.hpp | 12 ++++++------ 2 files changed, 6 insertions(+), 36 deletions(-) diff --git a/components/esm/esmreader.cpp b/components/esm/esmreader.cpp index e5d239570e..ebcba7062b 100644 --- a/components/esm/esmreader.cpp +++ b/components/esm/esmreader.cpp @@ -7,11 +7,6 @@ namespace ESM using namespace Misc; - std::string ESMReader::getName() const - { - return mCtx.filename; - } - ESM_Context ESMReader::getContext() { // Update the file position before returning @@ -29,11 +24,6 @@ ESMReader::ESMReader() clearCtx(); } -int ESMReader::getFormat() const -{ - return mHeader.mFormat; -} - void ESMReader::restoreContext(const ESM_Context &rc) { // Reopen the file if necessary @@ -181,11 +171,6 @@ bool ESMReader::peekNextSub(const char *name) return mCtx.subName == name; } -void ESMReader::cacheSubName() -{ - mCtx.subCached = true; -} - // Read subrecord name. This gets called a LOT, so I've optimized it // slightly. void ESMReader::getSubName() @@ -340,19 +325,4 @@ void ESMReader::fail(const std::string &msg) throw std::runtime_error(ss.str()); } -void ESMReader::setEncoder(ToUTF8::Utf8Encoder* encoder) -{ - mEncoder = encoder; -} - -size_t ESMReader::getFileOffset() const -{ - return mEsm->tellg(); -} - -void ESMReader::skip(int bytes) -{ - mEsm->seekg(getFileOffset()+bytes); -} - } diff --git a/components/esm/esmreader.hpp b/components/esm/esmreader.hpp index d3dd94516f..8c0aa580cf 100644 --- a/components/esm/esmreader.hpp +++ b/components/esm/esmreader.hpp @@ -36,10 +36,10 @@ public: const std::string getDesc() const { return mHeader.mData.desc; } const std::vector &getGameFiles() const { return mHeader.mMaster; } const Header& getHeader() const { return mHeader; } - int getFormat() const; + int getFormat() const { return mHeader.mFormat; }; const NAME &retSubName() const { return mCtx.subName; } uint32_t getSubSize() const { return mCtx.leftSub; } - std::string getName() const; + std::string getName() const {return mCtx.filename; }; /************************************************************************* * @@ -73,7 +73,7 @@ public: void openRaw(const std::string &filename); /// Get the current position in the file. Make sure that the file has been opened! - size_t getFileOffset() const; + size_t getFileOffset() const { return mEsm->tellg(); }; // This is a quick hack for multiple esm/esp files. Each plugin introduces its own // terrain palette, but ESMReader does not pass a reference to the correct plugin @@ -185,7 +185,7 @@ public: bool peekNextSub(const char* name); // Store the current subrecord name for the next call of getSubName() - void cacheSubName(); + void cacheSubName() {mCtx.subCached = true; }; // Read subrecord name. This gets called a LOT, so I've optimized it // slightly. @@ -247,13 +247,13 @@ public: // them from native encoding to UTF8 in the process. std::string getString(int size); - void skip(int bytes); + void skip(int bytes) { mEsm->seekg(getFileOffset()+bytes); }; /// Used for error handling void fail(const std::string &msg); /// Sets font encoder for ESM strings - void setEncoder(ToUTF8::Utf8Encoder* encoder); + void setEncoder(ToUTF8::Utf8Encoder* encoder) { mEncoder = encoder; }; /// Get record flags of last record unsigned int getRecordFlags() { return mRecordFlags; }