1
0
Fork 0
mirror of https://github.com/OpenMW/openmw.git synced 2025-03-03 15:09:39 +00:00

Convert esmtool from const std::string& to std::string_view

This commit is contained in:
jvoisin 2022-05-21 21:39:26 +02:00
parent 8047a2138e
commit 23eccebe9e
3 changed files with 6 additions and 6 deletions

View file

@ -284,7 +284,7 @@ void loadCell(const Arguments& info, ESM::Cell &cell, ESM::ESMReader &esm, ESMDa
} }
} }
void printRawTes3(const std::string& path) void printRawTes3(std::string_view path)
{ {
std::cout << "TES3 RAW file listing: " << path << '\n'; std::cout << "TES3 RAW file listing: " << path << '\n';
ESM::ESMReader esm; ESM::ESMReader esm;

View file

@ -84,7 +84,7 @@ void ESMReader::resolveParentFileIndices(const std::vector<ESMReader>& allPlugin
} }
} }
void ESMReader::openRaw(std::unique_ptr<std::istream>&& stream, const std::string& name) void ESMReader::openRaw(std::unique_ptr<std::istream>&& stream, std::string_view name)
{ {
close(); close();
mEsm = std::move(stream); mEsm = std::move(stream);
@ -94,9 +94,9 @@ void ESMReader::openRaw(std::unique_ptr<std::istream>&& stream, const std::strin
mEsm->seekg(0, mEsm->beg); mEsm->seekg(0, mEsm->beg);
} }
void ESMReader::openRaw(const std::string& filename) void ESMReader::openRaw(std::string_view filename)
{ {
openRaw(Files::openBinaryInputFileStream(filename), filename); openRaw(Files::openBinaryInputFileStream(std::string(filename)), filename);
} }
void ESMReader::open(std::unique_ptr<std::istream>&& stream, const std::string &name) void ESMReader::open(std::unique_ptr<std::istream>&& stream, const std::string &name)

View file

@ -61,7 +61,7 @@ public:
/// Raw opening. Opens the file and sets everything up but doesn't /// Raw opening. Opens the file and sets everything up but doesn't
/// parse the header. /// parse the header.
void openRaw(std::unique_ptr<std::istream>&& stream, const std::string &name); void openRaw(std::unique_ptr<std::istream>&& stream, std::string_view name);
/// Load ES file from a new stream, parses the header. Closes the /// Load ES file from a new stream, parses the header. Closes the
/// currently open file first, if any. /// currently open file first, if any.
@ -69,7 +69,7 @@ public:
void open(const std::string &file); void open(const std::string &file);
void openRaw(const std::string &filename); void openRaw(std::string_view filename);
/// Get the current position in the file. Make sure that the file has been opened! /// Get the current position in the file. Make sure that the file has been opened!
size_t getFileOffset() const { return mEsm->tellg(); }; size_t getFileOffset() const { return mEsm->tellg(); };