Common/Watches: std::move strings where applicable

Allows calling code to move the std::string into the Watch instances,
avoiding copies.
This commit is contained in:
Lioncash
2019-07-08 17:28:07 -04:00
parent 0a7395bfba
commit bc8778203e
7 changed files with 35 additions and 35 deletions

View File

@ -20,9 +20,9 @@ void DSPPatches::Patch(std::size_t index)
PanicAlert("Patch functionality not supported in DSP module.");
}
std::size_t DSPDebugInterface::SetWatch(u32 address, const std::string& name)
std::size_t DSPDebugInterface::SetWatch(u32 address, std::string name)
{
return m_watches.SetWatch(address, name);
return m_watches.SetWatch(address, std::move(name));
}
const Common::Debug::Watch& DSPDebugInterface::GetWatch(std::size_t index) const
@ -40,9 +40,9 @@ void DSPDebugInterface::UnsetWatch(u32 address)
m_watches.UnsetWatch(address);
}
void DSPDebugInterface::UpdateWatch(std::size_t index, u32 address, const std::string& name)
void DSPDebugInterface::UpdateWatch(std::size_t index, u32 address, std::string name)
{
return m_watches.UpdateWatch(index, address, name);
return m_watches.UpdateWatch(index, address, std::move(name));
}
void DSPDebugInterface::UpdateWatchAddress(std::size_t index, u32 address)
@ -50,9 +50,9 @@ void DSPDebugInterface::UpdateWatchAddress(std::size_t index, u32 address)
return m_watches.UpdateWatchAddress(index, address);
}
void DSPDebugInterface::UpdateWatchName(std::size_t index, const std::string& name)
void DSPDebugInterface::UpdateWatchName(std::size_t index, std::string name)
{
return m_watches.UpdateWatchName(index, name);
return m_watches.UpdateWatchName(index, std::move(name));
}
void DSPDebugInterface::EnableWatch(std::size_t index)
@ -97,7 +97,7 @@ void DSPDebugInterface::SetPatch(u32 address, u32 value)
void DSPDebugInterface::SetPatch(u32 address, std::vector<u8> value)
{
m_patches.SetPatch(address, value);
m_patches.SetPatch(address, std::move(value));
}
const std::vector<Common::Debug::MemoryPatch>& DSPDebugInterface::GetPatches() const

View File

@ -23,13 +23,13 @@ class DSPDebugInterface final : public Common::DebugInterface
public:
DSPDebugInterface() {}
// Watches
std::size_t SetWatch(u32 address, const std::string& name = "") override;
std::size_t SetWatch(u32 address, std::string name = "") override;
const Common::Debug::Watch& GetWatch(std::size_t index) const override;
const std::vector<Common::Debug::Watch>& GetWatches() const override;
void UnsetWatch(u32 address) override;
void UpdateWatch(std::size_t index, u32 address, const std::string& name) override;
void UpdateWatch(std::size_t index, u32 address, std::string name) override;
void UpdateWatchAddress(std::size_t index, u32 address) override;
void UpdateWatchName(std::size_t index, const std::string& name) override;
void UpdateWatchName(std::size_t index, std::string name) override;
void EnableWatch(std::size_t index) override;
void DisableWatch(std::size_t index) override;
bool HasEnabledWatch(u32 address) const override;