More conversions to string_view.

This commit is contained in:
Stephen Anthony 2022-12-23 20:01:24 -03:30
parent 2dba71290d
commit d428c6ac9a
8 changed files with 12 additions and 12 deletions

View File

@ -439,12 +439,12 @@ namespace StellaModTest
namespace StellaKeyName
{
inline const char* forKey(StellaKey key)
inline string_view forKey(StellaKey key)
{
#ifdef SDL_SUPPORT
return SDL_GetScancodeName(SDL_Scancode(key));
#else
return "";
return string_view{};
#endif
}
}

View File

@ -1513,7 +1513,7 @@ string CartDebug::clearConfig(int bank)
}
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
void CartDebug::getCompletions(const char* in, StringList& completions) const
void CartDebug::getCompletions(string_view in, StringList& completions) const
{
// First scan system equates
for(uInt16 addr = 0x00; addr <= 0x0F; ++addr)
@ -1532,7 +1532,7 @@ void CartDebug::getCompletions(const char* in, StringList& completions) const
// Now scan user-defined labels
for(const auto& iter: myUserAddresses)
{
const char* const l = iter.first.c_str();
const string_view l = iter.first;
if(BSPF::matchesCamelCase(l, in))
completions.emplace_back(l);
}

View File

@ -260,7 +260,7 @@ class CartDebug : public DebuggerSystem
Methods used by the command parser for tab-completion
In this case, return completions from the equate list(s)
*/
void getCompletions(const char* in, StringList& completions) const;
void getCompletions(string_view in, StringList& completions) const;
// Convert given address to corresponding access type and append to buf
void accessTypeAsString(ostream& buf, uInt16 addr) const;

View File

@ -892,14 +892,14 @@ string Debugger::builtinHelp()
}
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
void Debugger::getCompletions(const char* in, StringList& list) const
void Debugger::getCompletions(string_view in, StringList& list) const
{
// skip if filter equals "_" only
if(!BSPF::equalsIgnoreCase(in, "_"))
{
for(const auto& iter : myFunctions)
for(const auto& iter: myFunctions)
{
const char* const l = iter.first.c_str();
const string_view l = iter.first;
if(BSPF::matchesCamelCase(l, in))
list.emplace_back(l);
}

View File

@ -123,7 +123,7 @@ class Debugger : public DialogContainer
Methods used by the command parser for tab-completion
In this case, return completions from the function list
*/
void getCompletions(const char* in, StringList& list) const;
void getCompletions(string_view in, StringList& list) const;
/**
The dialog/GUI associated with the debugger

View File

@ -175,7 +175,7 @@ void DebuggerParser::outputCommandError(string_view errorMsg, int command)
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
// Completion-related stuff:
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
void DebuggerParser::getCompletions(const char* in, StringList& completions)
void DebuggerParser::getCompletions(string_view in, StringList& completions)
{
// cerr << "Attempting to complete \"" << in << "\"" << endl;
for(const auto& c: commands)

View File

@ -42,7 +42,7 @@ class DebuggerParser
/** Given a substring, determine matching substrings from the list
of available commands. Used in the debugger prompt for tab-completion */
static void getCompletions(const char* in, StringList& completions);
static void getCompletions(string_view in, StringList& completions);
/** Evaluate the given expression using operators, current base, etc */
int decipher_arg(string_view str);

View File

@ -367,7 +367,7 @@ bool FileListWidget::handleText(char text)
const bool firstShift = StellaModTest::isShift(_firstMod);
if(StellaModTest::isShift(_lastMod))
text = *StellaKeyName::forKey(_lastKey);
text = StellaKeyName::forKey(_lastKey)[0];
if(_quickSelectTime < time)
_quickSelectStr = text;