mirror of
https://github.com/OpenMW/openmw.git
synced 2025-12-12 17:43:05 +00:00
Use string_view in components/fx
This commit is contained in:
parent
cf3d0b7dd3
commit
55c72ecb29
4 changed files with 13 additions and 13 deletions
|
|
@ -120,7 +120,7 @@ namespace Fx
|
|||
return mLastJumpBlock;
|
||||
}
|
||||
|
||||
[[noreturn]] void Lexer::error(const std::string& msg)
|
||||
[[noreturn]] void Lexer::error(std::string_view msg)
|
||||
{
|
||||
throw LexerException(std::format("Line {} Col {}. {}", mLine + 1, mColumn, msg));
|
||||
}
|
||||
|
|
|
|||
|
|
@ -46,7 +46,7 @@ namespace Fx
|
|||
|
||||
Block getLastJumpBlock() const;
|
||||
|
||||
[[noreturn]] void error(const std::string& msg);
|
||||
[[noreturn]] void error(std::string_view msg);
|
||||
|
||||
private:
|
||||
void drop();
|
||||
|
|
|
|||
|
|
@ -95,10 +95,10 @@ namespace Fx
|
|||
return std::format("\n#line {}\n{}\n", block.line + 1, block.content);
|
||||
}
|
||||
|
||||
Technique::UniformMap::iterator Technique::findUniform(const std::string& name)
|
||||
Technique::UniformMap::iterator Technique::findUniform(std::string_view name)
|
||||
{
|
||||
return std::find_if(mDefinedUniforms.begin(), mDefinedUniforms.end(),
|
||||
[&name](const auto& uniform) { return uniform->mName == name; });
|
||||
[=](const auto& uniform) { return uniform->mName == name; });
|
||||
}
|
||||
|
||||
bool Technique::compile()
|
||||
|
|
@ -201,7 +201,7 @@ namespace Fx
|
|||
return isDirty;
|
||||
}
|
||||
|
||||
[[noreturn]] void Technique::error(const std::string& msg)
|
||||
[[noreturn]] void Technique::error(std::string_view msg)
|
||||
{
|
||||
mLexer->error(msg);
|
||||
}
|
||||
|
|
@ -405,7 +405,7 @@ namespace Fx
|
|||
template <class T>
|
||||
void Technique::parseSampler()
|
||||
{
|
||||
if (findUniform(std::string(mBlockName)) != mDefinedUniforms.end())
|
||||
if (findUniform(mBlockName) != mDefinedUniforms.end())
|
||||
error(std::format("redeclaration of uniform '{}'", mBlockName));
|
||||
|
||||
ProxyTextureData proxy;
|
||||
|
|
@ -530,7 +530,7 @@ namespace Fx
|
|||
template <class SrcT, class T>
|
||||
void Technique::parseUniform()
|
||||
{
|
||||
if (findUniform(std::string(mBlockName)) != mDefinedUniforms.end())
|
||||
if (findUniform(mBlockName) != mDefinedUniforms.end())
|
||||
error(std::format("redeclaration of uniform '{}'", mBlockName));
|
||||
|
||||
std::shared_ptr<Types::UniformBase> uniform = std::make_shared<Types::UniformBase>();
|
||||
|
|
@ -671,7 +671,7 @@ namespace Fx
|
|||
}
|
||||
|
||||
template <class T>
|
||||
void Technique::expect(const std::string& err)
|
||||
void Technique::expect(std::string_view err)
|
||||
{
|
||||
mToken = mLexer->next();
|
||||
if (!std::holds_alternative<T>(mToken))
|
||||
|
|
@ -684,7 +684,7 @@ namespace Fx
|
|||
}
|
||||
|
||||
template <class T, class T2>
|
||||
void Technique::expect(const std::string& err)
|
||||
void Technique::expect(std::string_view err)
|
||||
{
|
||||
mToken = mLexer->next();
|
||||
if (!std::holds_alternative<T>(mToken) && !std::holds_alternative<T2>(mToken))
|
||||
|
|
|
|||
|
|
@ -172,7 +172,7 @@ namespace Fx
|
|||
|
||||
std::string getLastError() const { return mLastError; }
|
||||
|
||||
UniformMap::iterator findUniform(const std::string& name);
|
||||
UniformMap::iterator findUniform(std::string_view name);
|
||||
|
||||
bool getDynamic() const { return mDynamic; }
|
||||
|
||||
|
|
@ -183,17 +183,17 @@ namespace Fx
|
|||
bool getInternal() const { return mInternal; }
|
||||
|
||||
private:
|
||||
[[noreturn]] void error(const std::string& msg);
|
||||
[[noreturn]] void error(std::string_view msg);
|
||||
|
||||
void clear();
|
||||
|
||||
std::string_view asLiteral() const;
|
||||
|
||||
template <class T>
|
||||
void expect(const std::string& err = "");
|
||||
void expect(std::string_view err = {});
|
||||
|
||||
template <class T, class T2>
|
||||
void expect(const std::string& err = "");
|
||||
void expect(std::string_view err = {});
|
||||
|
||||
template <class T>
|
||||
bool isNext();
|
||||
|
|
|
|||
Loading…
Reference in a new issue