Convert stringstream::str() to stringstream::view() where applicable.

This commit is contained in:
Stephen Anthony 2024-05-10 20:33:04 -02:30
parent fd35ce623b
commit a8a23f6112
68 changed files with 239 additions and 245 deletions

View File

@ -298,7 +298,7 @@ void CheatManager::saveCheats(string_view md5sum)
cheats << ",";
}
const bool changed = cheats.str() != myCurrentCheat;
const bool changed = cheats.view() != myCurrentCheat;
// Only update the list if absolutely necessary
if(changed)
@ -310,8 +310,8 @@ void CheatManager::saveCheats(string_view md5sum)
myCheatMap.erase(iter);
// Add new entry only if there are any cheats defined
if(!cheats.str().empty())
myCheatMap.emplace(md5sum, cheats.str());
if(!cheats.view().empty())
myCheatMap.emplace(md5sum, cheats.view());
}
// Update the dirty flag

View File

@ -33,7 +33,7 @@ EventHandlerSDL2::EventHandlerSDL2(OSystem& osystem)
myQwertz = int{'y'} == static_cast<int>
(SDL_GetKeyFromScancode(static_cast<SDL_Scancode>(KBDK_Z)));
buf << "Keyboard: " << (myQwertz ? "QWERTZ" : "QWERTY");
Logger::debug(buf.str());
Logger::debug(buf.view());
}
#endif
@ -43,7 +43,7 @@ EventHandlerSDL2::EventHandlerSDL2(OSystem& osystem)
ostringstream buf;
buf << "ERROR: Couldn't initialize SDL joystick support: "
<< SDL_GetError() << '\n';
Logger::error(buf.str());
Logger::error(buf.view());
}
Logger::debug("EventHandlerSDL2::EventHandlerSDL2 SDL_INIT_JOYSTICK");
#endif

View File

@ -105,11 +105,11 @@ void FBBackendSDL2::queryHardware(vector<Common::Size>& fullscreenRes,
SDL_GetDisplayMode(i, m, &mode);
res << std::setw(4) << mode.w << "x" << std::setw(4) << mode.h;
if(lastRes != res.str())
if(lastRes != res.view())
{
Logger::debug(s.str());
Logger::debug(s.view());
s.str("");
lastRes = res.str();
lastRes = res.view();
s << " " << lastRes << ": ";
}
s << mode.refresh_rate << "Hz";
@ -118,7 +118,7 @@ void FBBackendSDL2::queryHardware(vector<Common::Size>& fullscreenRes,
else
s << " ";
}
Logger::debug(s.str());
Logger::debug(s.view());
}
// Now get the maximum windowed desktop resolution
@ -332,7 +332,7 @@ bool FBBackendSDL2::setVideoMode(const VideoModeHandler::Mode& mode,
msg << "Display refresh rate changed to "
<< adaptedSdlMode.refresh_rate << " Hz " << "(" << adaptedSdlMode.w << "x" << adaptedSdlMode.h << ")";
Logger::info(msg.str());
Logger::info(msg.view());
SDL_DisplayMode setSdlMode;
SDL_GetWindowDisplayMode(myWindow, &setSdlMode);

View File

@ -415,7 +415,7 @@ string HighScoresManager::md5Props() const
buf << specialAddress(jprops) << specialBCD(jprops) << specialZeroBased(jprops);
return MD5::hash(buf.str());
return MD5::hash(buf.view());
}
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
@ -571,7 +571,7 @@ string HighScoresManager::hash(const ScoresData& data) const
<< data.scores[r].date;
}
return MD5::hash(buf.str());
return MD5::hash(buf.view());
}
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
@ -658,7 +658,7 @@ void HighScoresManager::loadHighScores(ScoresData& data)
clearHighScores(data);
buf << "Error: Invalid high scores data for variation " << data.variation << ".";
}
myOSystem.frameBuffer().showTextMessage(buf.str());
myOSystem.frameBuffer().showTextMessage(buf.view());
}
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -

View File

@ -166,7 +166,7 @@ string JoyMap::getEventMappingDesc(int stick, const Event::Type event, const Eve
{
if (_event == event && _mapping.mode == mode)
{
if(!buf.str().empty())
if(!buf.view().empty())
buf << ", ";
buf << "C" << stick << getDesc(event, _mapping);
}

View File

@ -197,7 +197,7 @@ string KeyMap::getEventMappingDesc(const Event::Type event, const EventMode mode
{
if (_event == event && _mapping.mode == mode)
{
if(!buf.str().empty())
if(!buf.view().empty())
buf << ", ";
buf << getDesc(_mapping);
}

View File

@ -106,7 +106,7 @@ MouseControl::MouseControl(Console& console, string_view mode)
msg << ", Y-axis is ";
MControlToController(yaxis, ytype, yid);
myModeList.emplace_back(xtype, xid, ytype, yid, msg.str());
myModeList.emplace_back(xtype, xid, ytype, yid, msg.view());
}
// Now consider the possible modes for the mouse based on the left
@ -173,7 +173,7 @@ void MouseControl::addLeftControllerModes(bool noswap)
msg << "Mouse is left " << myLeftController.name() << " controller";
const Controller::Type type = myLeftController.type();
const int id = noswap ? 0 : 1;
myModeList.emplace_back(type, id, type, id, msg.str());
myModeList.emplace_back(type, id, type, id, msg.view());
}
}
}
@ -194,7 +194,7 @@ void MouseControl::addRightControllerModes(bool noswap)
msg << "Mouse is right " << myRightController.name() << " controller";
const Controller::Type type = myRightController.type();
const int id = noswap ? 1 : 0;
myModeList.emplace_back(type, id, type, id, msg.str());
myModeList.emplace_back(type, id, type, id, msg.view());
}
}
}
@ -205,11 +205,11 @@ void MouseControl::addPaddleModes(int lport, int rport, int lname, int rname)
const Controller::Type type = Controller::Type::Paddles;
ostringstream msg;
msg << "Mouse is Paddle " << lname << " controller";
const MouseMode mode0(type, lport, type, lport, msg.str());
const MouseMode mode0(type, lport, type, lport, msg.view());
msg.str("");
msg << "Mouse is Paddle " << rname << " controller";
const MouseMode mode1(type, rport, type, rport, msg.str());
const MouseMode mode1(type, rport, type, rport, msg.view());
if(BSPF::equalsIgnoreCase(myProps.get(PropType::Controller_SwapPaddles), "NO"))
{

View File

@ -117,7 +117,7 @@ int PhysicalJoystickHandler::add(const PhysicalJoystickPtr& stick)
{
ostringstream name;
name << stick->name << " #" << count+1;
stick->name = name.str();
stick->name = name.view();
}
stick->type = PhysicalJoystick::Type::REGULAR;
}
@ -175,7 +175,7 @@ void PhysicalJoystickHandler::addToDatabase(const PhysicalJoystickPtr& stick)
ostringstream buf;
buf << "Added joystick " << stick->ID << ":\n"
<< " " << stick->about() << '\n';
Logger::info(buf.str());
Logger::info(buf.view());
}
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
@ -196,7 +196,7 @@ bool PhysicalJoystickHandler::remove(int id)
ostringstream buf;
buf << "Removed joystick " << mySticks[id]->ID << ":\n"
<< " " << mySticks[id]->about() << '\n';
Logger::info(buf.str());
Logger::info(buf.view());
// Remove joystick, but remember mapping
it->second.mapping = stick->getMap();
@ -264,7 +264,7 @@ bool PhysicalJoystickHandler::mapStelladaptors(string_view saport, int ID)
ostringstream buf;
buf << "Erased joystick " << _stick->ID << ":\n"
<< " " << _stick->about() << '\n';
Logger::info(buf.str());
Logger::info(buf.view());
_stick->name.erase(pos);
erased = true;
@ -809,7 +809,7 @@ string PhysicalJoystickHandler::getMappingDesc(Event::Type event, EventMode mode
//Joystick mapping / labeling
if(!_joyptr->joyMap.getEventMapping(event, evMode).empty())
{
if(!buf.str().empty())
if(!buf.view().empty())
buf << ", ";
buf << _joyptr->joyMap.getEventMappingDesc(_id, event, evMode);
}
@ -1134,7 +1134,7 @@ void PhysicalJoystickHandler::changeDigitalDeadZone(int direction)
ss << std::round(Controller::digitalDeadZoneValue(deadZone) * 100.F / 32768) << "%";
myOSystem.frameBuffer().showGaugeMessage(
"Digital controller dead zone", ss. str(), deadZone,
"Digital controller dead zone", ss.view(), deadZone,
Controller::MIN_DIGITAL_DEADZONE, Controller::MAX_DIGITAL_DEADZONE);
}
@ -1152,7 +1152,7 @@ void PhysicalJoystickHandler::changeAnalogPaddleDeadZone(int direction)
ss << std::round(Controller::analogDeadZoneValue(deadZone) * 100.F / 32768) << "%";
myOSystem.frameBuffer().showGaugeMessage(
"Analog controller dead zone", ss.str(), deadZone,
"Analog controller dead zone", ss.view(), deadZone,
Controller::MIN_ANALOG_DEADZONE, Controller::MAX_ANALOG_DEADZONE);
}
@ -1170,7 +1170,7 @@ void PhysicalJoystickHandler::changeAnalogPaddleSensitivity(int direction)
ss << std::round(Paddles::analogSensitivityValue(sense) * 100.F) << "%";
myOSystem.frameBuffer().showGaugeMessage(
"Analog paddle sensitivity", ss.str(), sense,
"Analog paddle sensitivity", ss.view(), sense,
Paddles::MIN_ANALOG_SENSE, Paddles::MAX_ANALOG_SENSE);
}
@ -1191,7 +1191,7 @@ void PhysicalJoystickHandler::changeAnalogPaddleLinearity(int direction)
ss << "Off";
myOSystem.frameBuffer().showGaugeMessage(
"Analog paddle linearity", ss.str(), linear,
"Analog paddle linearity", ss.view(), linear,
Paddles::MIN_ANALOG_LINEARITY, Paddles::MAX_ANALOG_LINEARITY);
}
@ -1212,7 +1212,7 @@ void PhysicalJoystickHandler::changePaddleDejitterAveraging(int direction)
ss << "Off";
myOSystem.frameBuffer().showGaugeMessage(
"Analog paddle dejitter averaging", ss.str(), dejitter,
"Analog paddle dejitter averaging", ss.view(), dejitter,
Paddles::MIN_DEJITTER, Paddles::MAX_DEJITTER);
}
@ -1233,7 +1233,7 @@ void PhysicalJoystickHandler::changePaddleDejitterReaction(int direction)
ss << "Off";
myOSystem.frameBuffer().showGaugeMessage(
"Analog paddle dejitter reaction", ss.str(), dejitter,
"Analog paddle dejitter reaction", ss.view(), dejitter,
Paddles::MIN_DEJITTER, Paddles::MAX_DEJITTER);
}
@ -1254,7 +1254,7 @@ void PhysicalJoystickHandler::changeDigitalPaddleSensitivity(int direction)
ss << "Off";
myOSystem.frameBuffer().showGaugeMessage(
"Digital sensitivity", ss.str(), sense,
"Digital sensitivity", ss.view(), sense,
Paddles::MIN_DIGITAL_SENSE, Paddles::MAX_DIGITAL_SENSE);
}
@ -1272,7 +1272,7 @@ void PhysicalJoystickHandler::changeMousePaddleSensitivity(int direction)
ss << sense * 10 << "%";
myOSystem.frameBuffer().showGaugeMessage(
"Mouse paddle sensitivity", ss.str(), sense,
"Mouse paddle sensitivity", ss.view(), sense,
Controller::MIN_MOUSE_SENSE, Controller::MAX_MOUSE_SENSE);
}
@ -1290,7 +1290,7 @@ void PhysicalJoystickHandler::changeMouseTrackballSensitivity(int direction)
ss << sense * 10 << "%";
myOSystem.frameBuffer().showGaugeMessage(
"Mouse trackball sensitivity", ss.str(), sense,
"Mouse trackball sensitivity", ss.view(), sense,
PointingDevice::MIN_SENSE, PointingDevice::MAX_SENSE);
}
@ -1308,7 +1308,7 @@ void PhysicalJoystickHandler::changeDrivingSensitivity(int direction)
ss << sense * 10 << "%";
myOSystem.frameBuffer().showGaugeMessage(
"Driving controller sensitivity", ss.str(), sense,
"Driving controller sensitivity", ss.view(), sense,
Driving::MIN_SENSE, Driving::MAX_SENSE);
}

View File

@ -614,7 +614,7 @@ void PhysicalKeyboardHandler::toggleModKeys(bool toggle)
ostringstream ss;
ss << "Modifier key combos ";
ss << (modCombo ? "enabled" : "disabled");
myOSystem.frameBuffer().showTextMessage(ss.str());
myOSystem.frameBuffer().showTextMessage(ss.view());
}
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -

View File

@ -273,7 +273,7 @@ void PNGLibrary::toggleContinuousSnapshots(bool perFrame)
buf << "Enabling snapshots in " << interval << " second intervals";
interval *= static_cast<uInt32>(myOSystem.frameRate());
}
myOSystem.frameBuffer().showTextMessage(buf.str());
myOSystem.frameBuffer().showTextMessage(buf.view());
setContinuousSnapInterval(interval);
}
else
@ -282,7 +282,7 @@ void PNGLibrary::toggleContinuousSnapshots(bool perFrame)
buf << "Disabling snapshots, generated "
<< (mySnapCounter / mySnapInterval)
<< " files";
myOSystem.frameBuffer().showTextMessage(buf.str());
myOSystem.frameBuffer().showTextMessage(buf.view());
setContinuousSnapInterval(0);
}
}
@ -313,7 +313,7 @@ void PNGLibrary::takeSnapshot(uInt32 number)
ostringstream buf;
buf << sspath << "_" << std::hex << std::setw(8) << std::setfill('0')
<< number << ".png";
filename = buf.str();
filename = buf.view();
}
else if(!myOSystem.settings().getBool("sssingle"))
{
@ -328,11 +328,11 @@ void PNGLibrary::takeSnapshot(uInt32 number)
{
buf.str("");
buf << sspath << "_" << i << ".png";
const FSNode next(buf.str());
const FSNode next(buf.view());
if(!next.exists())
break;
}
filename = buf.str();
filename = buf.view();
}
}
else
@ -344,7 +344,7 @@ void PNGLibrary::takeSnapshot(uInt32 number)
VarList::push_back(metaData, "Title", "Snapshot");
version << "Stella " << STELLA_VERSION << " (Build " << STELLA_BUILD << ") ["
<< BSPF::ARCH << "]";
VarList::push_back(metaData, "Software", version.str());
VarList::push_back(metaData, "Software", version.view());
const string& name = (myOSystem.settings().getString("snapname") == "int")
? myOSystem.console().properties().get(PropType::Cart_Name)
: myOSystem.romFile().getName();

View File

@ -112,7 +112,7 @@ void PaletteHandler::showAdjustableMessage()
myOSystem.console().timing() == ConsoleTiming::pal ? myPhasePAL : myPhaseNTSC;
buf << std::fixed << std::setprecision(1) << value << DEGREE;
myOSystem.frameBuffer().showGaugeMessage(
"Palette phase shift", buf.str(), value,
"Palette phase shift", buf.view(), value,
(isNTSC ? DEF_NTSC_SHIFT : DEF_PAL_SHIFT) - MAX_PHASE_SHIFT,
(isNTSC ? DEF_NTSC_SHIFT : DEF_PAL_SHIFT) + MAX_PHASE_SHIFT);
}
@ -122,7 +122,7 @@ void PaletteHandler::showAdjustableMessage()
buf << std::fixed << std::setprecision(1) << value << DEGREE;
myOSystem.frameBuffer().showGaugeMessage(
msg.str(), buf.str(), value, -MAX_RGB_SHIFT, +MAX_RGB_SHIFT);
msg.view(), buf.view(), value, -MAX_RGB_SHIFT, +MAX_RGB_SHIFT);
}
else
{
@ -131,7 +131,7 @@ void PaletteHandler::showAdjustableMessage()
: scaleTo100(*myAdjustables[myCurrentAdjustable].value);
buf << value << "%";
myOSystem.frameBuffer().showGaugeMessage(
msg.str(), buf.str(), value);
msg.view(), buf.view(), value);
}
}

View File

@ -239,7 +239,7 @@ string RewindManager::saveAllStates()
<< myOSystem.console().properties().get(PropType::Cart_Name)
<< ".sta";
Serializer out(buf.str(), Serializer::Mode::ReadWriteTrunc);
Serializer out(buf.view(), Serializer::Mode::ReadWriteTrunc);
if (!out)
return "Can't save to all states file";
@ -296,7 +296,7 @@ string RewindManager::loadAllStates()
<< ".sta";
// Make sure the file can be opened for reading
const Serializer in(buf.str(), Serializer::Mode::ReadOnly);
const Serializer in(buf.view(), Serializer::Mode::ReadOnly);
if (!in)
return "Can't load from all states file";

View File

@ -48,7 +48,7 @@ SoundSDL2::SoundSDL2(OSystem& osystem, AudioSettings& audioSettings)
buf << "WARNING: Failed to initialize SDL audio system! \n"
<< " " << SDL_GetError() << '\n';
Logger::error(buf.str());
Logger::error(buf.view());
return;
}
@ -83,7 +83,7 @@ void SoundSDL2::queryHardware(VariantList& devices)
// log the available audio devices
ostringstream s;
s << "Supported audio devices (" << numDevices << "):";
Logger::debug(s.str());
Logger::debug(s.view());
VarList::push_back(devices, "Default", 0);
for(int i = 0; i < numDevices; ++i)
@ -91,7 +91,7 @@ void SoundSDL2::queryHardware(VariantList& devices)
ostringstream ss;
ss << " " << i + 1 << ": " << SDL_GetAudioDeviceName(i, 0);
Logger::debug(ss.str());
Logger::debug(ss.view());
VarList::push_back(devices, SDL_GetAudioDeviceName(i, 0), i + 1);
}
@ -128,7 +128,7 @@ bool SoundSDL2::openDevice()
buf << "WARNING: Couldn't open SDL audio device! \n"
<< " " << SDL_GetError() << '\n';
Logger::error(buf.str());
Logger::error(buf.view());
return myIsInitializedFlag = false;
}
@ -253,7 +253,7 @@ void SoundSDL2::adjustVolume(int direction)
// Now show an onscreen message
ostringstream strval;
(percent) ? strval << percent << "%" : strval << "Off";
myOSystem.frameBuffer().showGaugeMessage("Volume", strval.str(), percent);
myOSystem.frameBuffer().showGaugeMessage("Volume", strval.view(), percent);
}
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -

View File

@ -85,7 +85,7 @@ void StaggeredLogger::logLine()
<< millisecondsSinceIntervalStart << " milliseconds"
<< ")";
Logger::log(ss.str(), myLevel);
Logger::log(ss.view(), myLevel);
}
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -

View File

@ -207,12 +207,12 @@ void StateManager::loadState(int slot)
<< ".st" << slot;
// Make sure the file can be opened in read-only mode
Serializer in(buf.str(), Serializer::Mode::ReadOnly);
Serializer in(buf.view(), Serializer::Mode::ReadOnly);
if(!in)
{
buf.str("");
buf << "Can't open/load from state file " << slot;
myOSystem.frameBuffer().showTextMessage(buf.str());
myOSystem.frameBuffer().showTextMessage(buf.view());
return;
}
@ -236,7 +236,7 @@ void StateManager::loadState(int slot)
buf << "Invalid data in state " << slot << " file";
}
myOSystem.frameBuffer().showTextMessage(buf.str());
myOSystem.frameBuffer().showTextMessage(buf.view());
}
}
@ -253,12 +253,12 @@ void StateManager::saveState(int slot)
<< ".st" << slot;
// Make sure the file can be opened for writing
Serializer out(buf.str(), Serializer::Mode::ReadWriteTrunc);
Serializer out(buf.view(), Serializer::Mode::ReadWriteTrunc);
if(!out)
{
buf.str("");
buf << "Can't open/save to state file " << slot;
myOSystem.frameBuffer().showTextMessage(buf.str());
myOSystem.frameBuffer().showTextMessage(buf.view());
return;
}
@ -271,7 +271,7 @@ void StateManager::saveState(int slot)
catch(...)
{
buf << "Error saving state " << slot;
myOSystem.frameBuffer().showTextMessage(buf.str());
myOSystem.frameBuffer().showTextMessage(buf.view());
return;
}
@ -289,7 +289,7 @@ void StateManager::saveState(int slot)
else
buf << "Error saving state " << slot;
myOSystem.frameBuffer().showTextMessage(buf.str());
myOSystem.frameBuffer().showTextMessage(buf.view());
}
}
@ -304,7 +304,7 @@ void StateManager::changeState(int direction)
buf << "Changed to state slot " << myCurrentSlot;
else
buf << "State slot " << myCurrentSlot;
myOSystem.frameBuffer().showTextMessage(buf.str());
myOSystem.frameBuffer().showTextMessage(buf.view());
}
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
@ -315,7 +315,7 @@ void StateManager::toggleAutoSlot()
// Print appropriate message
ostringstream buf;
buf << "Automatic slot change " << (autoSlot ? "enabled" : "disabled");
myOSystem.frameBuffer().showTextMessage(buf.str());
myOSystem.frameBuffer().showTextMessage(buf.view());
myOSystem.settings().setValue("autoslot", autoSlot);
}

View File

@ -48,13 +48,13 @@ class Variant
Variant(string_view s) : data{s} { }
Variant(const char* s) : data{s} { }
Variant(Int32 i) { buf().str(""); buf() << i; data = buf().str(); }
Variant(uInt32 i) { buf().str(""); buf() << i; data = buf().str(); }
Variant(float f) { buf().str(""); buf() << f; data = buf().str(); }
Variant(double d) { buf().str(""); buf() << d; data = buf().str(); }
Variant(bool b) { buf().str(""); buf() << b; data = buf().str(); }
Variant(const Common::Size& s) { buf().str(""); buf() << s; data = buf().str(); }
Variant(const Common::Point& s) { buf().str(""); buf() << s; data = buf().str(); }
Variant(Int32 i) { buf().str(""); buf() << i; data = buf().view(); }
Variant(uInt32 i) { buf().str(""); buf() << i; data = buf().view(); }
Variant(float f) { buf().str(""); buf() << f; data = buf().view(); }
Variant(double d) { buf().str(""); buf() << d; data = buf().view(); }
Variant(bool b) { buf().str(""); buf() << b; data = buf().view(); }
Variant(const Common::Size& s) { buf().str(""); buf() << s; data = buf().view(); }
Variant(const Common::Point& s) { buf().str(""); buf() << s; data = buf().view(); }
// Conversion methods
const string& toString() const { return data; }

View File

@ -54,7 +54,7 @@ const VideoModeHandler::Mode&
// Overscan is not applicable in this mode
myMode = Mode(myImage.w, myImage.h,
Mode::Stretch::Fill, myFSIndex,
desc.str(), zoom, bezelInfo);
desc.view(), zoom, bezelInfo);
}
else
{

View File

@ -47,6 +47,7 @@ using uInt64 = uint64_t;
#include <functional>
#include <iomanip>
#include <memory>
#include <numbers>
#include <string>
#include <string_view>
#include <charconv>
@ -116,8 +117,8 @@ static const string EmptyString("");
namespace BSPF
{
static constexpr float PI_f = 3.141592653589793238462643383279502884F;
static constexpr double PI_d = 3.141592653589793238462643383279502884;
static constexpr float PI_f = std::numbers::pi_v<float>;
static constexpr double PI_d = std::numbers::pi_v<double>;
// CPU architecture type
// This isn't complete yet, but takes care of all the major platforms

View File

@ -41,7 +41,7 @@ namespace {
if (!KeyValueRepositoryJsonFile::save(out, values)) return false;
return myKvr.save(myKey, out.str());
return myKvr.save(myKey, out.view());
}
private:

View File

@ -90,8 +90,8 @@ void NTSCFilter::selectAdjustable(int direction,
msg << "Custom " << ourCustomAdjustables[myCurrentAdjustable].type;
val << value << "%";
text = msg.str();
valueText = val.str();
text = msg.view();
valueText = val.view();
}
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
@ -121,8 +121,8 @@ void NTSCFilter::changeCurrentAdjustable(int direction,
msg << "Custom " << ourCustomAdjustables[myCurrentAdjustable].type;
val << newValue << "%";
text = msg.str();
valueText = val.str();
text = msg.view();
valueText = val.view();
}
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -

View File

@ -1378,7 +1378,7 @@ string CartDebug::saveDisassembly(string path)
}
// And finally, output the disassembly
out << buf.str();
out << buf.view();
if(path.empty())
path = myOSystem.userDir().getPath()

View File

@ -125,7 +125,7 @@ bool Debugger::start(string_view message, int address, bool read,
buf << message;
if(address > -1)
buf << cartDebug().getLabel(address, read, 4);
myDialog->message().setText(buf.str());
myDialog->message().setText(buf.view());
myDialog->message().setToolTip(toolTip);
return true;
}
@ -461,7 +461,7 @@ void Debugger::log(string_view triggerMsg)
msg << "B/";
}
msg << "Addr Code Disasm";
Logger::log(msg.str());
Logger::log(msg.view());
myFirstLog = false;
}
@ -515,7 +515,7 @@ void Debugger::log(string_view triggerMsg)
break;
}
}
Logger::log(msg.str());
Logger::log(msg.view());
}
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
@ -628,7 +628,7 @@ void Debugger::nextScanline(int lines)
}
lockSystem();
addState(buf.str());
addState(buf.view());
myOSystem.console().tia().flushLineCache();
}
@ -651,7 +651,7 @@ void Debugger::nextFrame(int frames)
}
lockSystem();
addState(buf.str());
addState(buf.view());
}
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -

View File

@ -597,7 +597,7 @@ void DebuggerParser::printTimer(uInt32 idx, bool showHeader)
if(!debugger.cartDebug().getLabel(buf, timer.from.addr, true))
buf << " $" << setw(4) << Base::HEX4 << timer.from.addr;
string labelFrom = buf.str();
string labelFrom{buf.view()};
labelFrom = labelFrom.substr(0, (banked ? 12 : 15) - (timer.mirrors ? 1 : 0));
labelFrom += (timer.mirrors ? "+" : "");
labelFrom = (labelFrom + " ").substr(0, banked ? 12 : 15);
@ -605,7 +605,7 @@ void DebuggerParser::printTimer(uInt32 idx, bool showHeader)
buf.str("");
if(!debugger.cartDebug().getLabel(buf, timer.to.addr, true))
buf << " $" << setw(4) << Base::HEX4 << timer.to.addr;
string labelTo = buf.str();
string labelTo{buf.view()};
labelTo = labelTo.substr(0, (banked ? 12 : 15) - (timer.mirrors ? 1 : 0));
labelTo += (timer.mirrors ? "+" : "");
labelTo = (labelTo + " ").substr(0, banked ? 12 : 15);
@ -778,7 +778,7 @@ string DebuggerParser::saveScriptFile(string file)
const FSNode node(file);
if(node.exists() || !out.str().empty())
if(node.exists() || !out.view().empty())
{
try
{
@ -1369,11 +1369,11 @@ void DebuggerParser::executeDump()
// So we pass a copy of its contents, then re-create the
// stream inside the lambda
// Maybe this will change in a future version
const string outStr = out.str();
const string resultStr = commandResult.str();
const string outStr{out.view()};
const string resultStr{commandResult.view()};
DebuggerDialog* dlg = debugger.myDialog;
BrowserDialog::show(dlg, "Save Dump as", path.str(),
BrowserDialog::show(dlg, "Save Dump as", path.view(),
BrowserDialog::Mode::FileSave,
[dlg, outStr, resultStr]
(bool OK, const FSNode& node)
@ -1392,7 +1392,7 @@ void DebuggerParser::executeDump()
commandResult.str("_NO_PROMPT");
}
else
saveDump(FSNode(path.str()), out, commandResult);
saveDump(FSNode(path.view()), out, commandResult);
}
}
@ -1415,7 +1415,7 @@ void DebuggerParser::executeExec()
ostringstream prefix;
prefix << std::hex << std::setw(8) << std::setfill('0')
<< static_cast<uInt32>(TimerManager::getTicks()/1000);
execPrefix = prefix.str();
execPrefix = prefix.view();
}
// make sure the commands are added to prompt history
@ -1665,7 +1665,7 @@ void DebuggerParser::executeListBreaks()
}
}
if(count)
commandResult << "breaks:\n" << buf.str();
commandResult << "breaks:\n" << buf.view();
StringList conds = debugger.m6502().getCondBreakNames();
@ -1681,7 +1681,7 @@ void DebuggerParser::executeListBreaks()
}
}
if(commandResult.str().empty())
if(commandResult.view().empty())
commandResult << "no breakpoints set";
}
@ -1723,7 +1723,7 @@ void DebuggerParser::executeListSaveStateIfs()
}
}
if(commandResult.str().empty())
if(commandResult.view().empty())
commandResult << "no savestateifs defined";
}
@ -1836,7 +1836,7 @@ void DebuggerParser::executePc()
debugger.cpuDebug().setPC(args[0]);
msg << "Set PC @ " << Base::HEX4 << args[0];
debugger.addState(msg.str());
debugger.addState(msg.view());
}
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
@ -1973,7 +1973,7 @@ void DebuggerParser::executeRunTo()
buf << "runTo searching through " << max_iterations << " disassembled instructions"
<< progress.ELLIPSIS;
progress.setMessage(buf.str());
progress.setMessage(buf.view());
progress.setRange(0, static_cast<int>(max_iterations), 5);
progress.open();
@ -2021,7 +2021,7 @@ void DebuggerParser::executeRunToPc()
ProgressDialog progress(debugger.baseDialog(), debugger.lfont());
buf << " runTo PC running" << progress.ELLIPSIS << " ";
progress.setMessage(buf.str());
progress.setMessage(buf.view());
progress.setRange(0, 100000, 5);
progress.open();
@ -2044,7 +2044,7 @@ void DebuggerParser::executeRunToPc()
<< "Set PC to $" << Base::HEX4 << args[0] << " in "
<< dec << count << " instructions";
msg << "RunTo PC @ " << Base::HEX4 << args[0];
debugger.addState(msg.str());
debugger.addState(msg.view());
}
else
commandResult
@ -2198,9 +2198,9 @@ void DebuggerParser::executeSaveSes()
if(argCount)
path << argStrings[0];
else
path << debugger.myOSystem.userDir() << filename.str();
path << debugger.myOSystem.userDir() << filename.view();
commandResult << debugger.prompt().saveBuffer(FSNode(path.str()));
commandResult << debugger.prompt().saveBuffer(FSNode(path.view()));
}
}
@ -2290,7 +2290,7 @@ void DebuggerParser::executeStepWhile()
buf << "stepWhile running through disassembled instructions"
<< progress.ELLIPSIS;
progress.setMessage(buf.str());
progress.setMessage(buf.view());
progress.setRange(0, 100000, 5);
progress.open();
@ -2541,7 +2541,7 @@ void DebuggerParser::executeTraps(bool read, bool write, string_view command,
if(hasCond)
conditionBuf << ")";
const string condition = conditionBuf.str();
const string condition{conditionBuf.view()};
const int res = YaccParser::parse(condition);
if(res == 0)

View File

@ -83,7 +83,7 @@ DiStella::DiStella(const CartDebug& dbg, CartDebug::DisassemblyList& list,
if (CartDebug::addressType(k + myOffset) == CartDebug::AddrType::ROM) {
reservedLabel.str("");
reservedLabel << "L" << Base::HEX4 << (k + myOffset);
myReserved.Label.emplace(k + myOffset, reservedLabel.str());
myReserved.Label.emplace(k + myOffset, reservedLabel.view());
}
}
}
@ -227,7 +227,7 @@ void DiStella::disasm(uInt32 distart, int pass)
nextLine << ".byte $" << Base::HEX2 << static_cast<int>(opcode) << " ;";
nextLine << ourLookup[opcode].mnemonic;
myDisasmBuf << nextLine.str() << "'" << ";"
myDisasmBuf << nextLine.view() << "'" << ";"
<< std::dec << static_cast<int>(ourLookup[opcode].cycles) << "-"
<< std::dec << static_cast<int>(ourLookup[nextOpcode].cycles) << " "
<< "'= " << std::setw(3) << std::setfill(' ') << std::dec << cycles;
@ -603,7 +603,7 @@ void DiStella::disasm(uInt32 distart, int pass)
if(pass == 3) {
cycles += static_cast<int>(ourLookup[opcode].cycles);
// A complete line of disassembly (text, cycle count, and bytes)
myDisasmBuf << nextLine.str() << "'"
myDisasmBuf << nextLine.view() << "'"
<< ";" << std::dec << static_cast<int>(ourLookup[opcode].cycles)
<< (addrMode == AddressingMode::RELATIVE ? (ad & 0xf00) != ((myPC + myOffset) & 0xf00) ? "/3!" : "/3 " : " ");
if((opcode == 0x40 || opcode == 0x60 || opcode == 0x4c || opcode == 0x00 // code block end
@ -617,7 +617,7 @@ void DiStella::disasm(uInt32 distart, int pass)
else {
myDisasmBuf << "' ";
}
myDisasmBuf << "'" << nextLineBytes.str();
myDisasmBuf << "'" << nextLineBytes.view();
addEntry(Device::CODE);
if(opcode == 0x40 || opcode == 0x60 || opcode == 0x4c || opcode == 0x00) {

View File

@ -152,7 +152,7 @@ void AudioWidget::handleVolume()
stringstream s;
s << getEffectiveVolume() << "% (eff. volume)";
myAudEffV->setLabel(s.str());
myAudEffV->setLabel(s.view());
}
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -

View File

@ -79,7 +79,7 @@ void Cartridge3EPlusWidget::bankSelect(int& ypos)
label << "Set segment " << seg << " as ";
new StaticTextWidget(_boss, _font, xpos, ypos, label.str());
new StaticTextWidget(_boss, _font, xpos, ypos, label.view());
ypos += myLineHeight + VGAP * 2;
xpos += _font.getMaxCharWidth() * 2;
@ -120,7 +120,7 @@ void Cartridge3EPlusWidget::bankSelect(int& ypos)
label.str("");
label << "$" << Common::Base::HEX4 << addr1 << "-$"
<< Common::Base::HEX4 << (addr1 + 0x1FF);
auto* t = new StaticTextWidget(_boss, _font, xpos_s, ypos_s + 2, label.str());
auto* t = new StaticTextWidget(_boss, _font, xpos_s, ypos_s + 2, label.view());
const int xoffset = t->getRight() + _font.getMaxCharWidth();
const size_t bank_off = static_cast<size_t>(seg) * 2;
@ -131,7 +131,7 @@ void Cartridge3EPlusWidget::bankSelect(int& ypos)
label.str("");
label << "$" << Common::Base::HEX4 << addr2 << "-$" << Common::Base::HEX4 << (addr2 + 0x1FF);
new StaticTextWidget(_boss, _font, xpos_s, ypos_s + 2, label.str());
new StaticTextWidget(_boss, _font, xpos_s, ypos_s + 2, label.view());
myBankState[bank_off + 1] = new EditTextWidget(_boss, _font,
xoffset, ypos_s, _w - xoffset - 10, myLineHeight, "");
@ -209,12 +209,12 @@ void Cartridge3EPlusWidget::updateUIState()
buf << "RAM @ $" << Common::Base::HEX4
<< (ramBank << myCart3EP.myBankShift) << " (R)";
myBankState[bank_off]->setText(buf.str());
myBankState[bank_off]->setText(buf.view());
buf.str("");
buf << "RAM @ $" << Common::Base::HEX4
<< ((ramBank << myCart3EP.myBankShift) + myCart3EP.myBankSize) << " (W)";
myBankState[bank_off + 1]->setText(buf.str());
myBankState[bank_off + 1]->setText(buf.view());
myBankWidgets[seg]->setSelectedIndex(ramBank);
myBankType[seg]->setSelected("RAM");
@ -223,12 +223,12 @@ void Cartridge3EPlusWidget::updateUIState()
{
buf << "ROM @ $" << Common::Base::HEX4
<< ((bank << myCart3EP.myBankShift));
myBankState[bank_off]->setText(buf.str());
myBankState[bank_off]->setText(buf.view());
buf.str("");
buf << "ROM @ $" << Common::Base::HEX4
<< ((bank << myCart3EP.myBankShift) + myCart3EP.myBankSize);
myBankState[bank_off + 1]->setText(buf.str());
myBankState[bank_off + 1]->setText(buf.view());
myBankWidgets[seg]->setSelectedIndex(bank);
myBankType[seg]->setSelected("ROM");

View File

@ -242,7 +242,7 @@ void CartridgeARMWidget::handleChipType()
<< (chipProps.flashBanks > 1 ? "s" : "") << ", "
<< chipProps.MHz << " MHz, "
<< chipProps.flashCycles - 1 << " wait states";
myChipType->setToolTip(buf.str());
myChipType->setToolTip(buf.view());
}
}

View File

@ -57,7 +57,7 @@ CartridgeBUSInfoWidget::CartridgeBUSInfoWidget(
}
#endif
addBaseInformation(size, "AtariAge", info.str());
addBaseInformation(size, "AtariAge", info.view());
}
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -

View File

@ -53,7 +53,7 @@ CartridgeCDFInfoWidget::CartridgeCDFInfoWidget(
}
#endif
addBaseInformation(cart.romSize(), "AtariAge", info.str());
addBaseInformation(cart.romSize(), "AtariAge", info.view());
}
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -

View File

@ -50,7 +50,7 @@ CartridgeDPCPlusWidget::CartridgeDPCPlusWidget(
#endif
int xpos = 2,
ypos = addBaseInformation(size, "Activision (Pitfall II)", info.str()) +
ypos = addBaseInformation(size, "Activision (Pitfall II)", info.view()) +
myLineHeight;
VariantList items;

View File

@ -48,7 +48,7 @@ CartridgeDPCWidget::CartridgeDPCWidget(
}
int xpos = 2,
ypos = addBaseInformation(size, "Activision (Pitfall II)", info.str()) +
ypos = addBaseInformation(size, "Activision (Pitfall II)", info.view()) +
myLineHeight;
VariantList items;
@ -57,7 +57,7 @@ CartridgeDPCWidget::CartridgeDPCWidget(
ostringstream buf;
buf << "#" << std::dec << bank << " ($" << Common::Base::HEX4 << (0xFFF8 + bank) << ")";
VarList::push_back(items, buf.str());
VarList::push_back(items, buf.view());
}
myBank =

View File

@ -56,7 +56,7 @@ int CartDebugWidget::addBaseInformation(size_t bytes, string_view manufacturer,
buf << " / " << (bytes/1024) << "KB";
w = new EditTextWidget(_boss, _nfont, x+lwidth, y - 1,
fwidth, myLineHeight, buf.str());
fwidth, myLineHeight, buf.view());
w->setEditable(false);
y += myLineHeight + 4;

View File

@ -66,7 +66,7 @@ void CartridgeE7Widget::initialize(GuiObject* boss,
const uInt32 size = cart.romBankCount() * CartridgeE7::BANK_SIZE;
constexpr int xpos = 2;
int ypos = addBaseInformation(size, "M Network", info.str(), 15) + myLineHeight;
int ypos = addBaseInformation(size, "M Network", info.view(), 15) + myLineHeight;
VariantList items0, items1;
for(int i = 0; i < cart.romBankCount(); ++i)

View File

@ -197,8 +197,8 @@ void CartridgeEnhancedWidget::bankList(uInt16 bankCount, int seg, VariantList& i
if(myCart.hotspot() != 0 && myHotspotDelta > 0)
buf << " " << hotspotStr(bank, seg);
VarList::push_back(items, buf.str());
width = std::max(width, _font.getStringWidth(buf.str()));
VarList::push_back(items, buf.view());
width = std::max(width, _font.getStringWidth(buf.view()));
}
}
@ -229,7 +229,7 @@ void CartridgeEnhancedWidget::bankSelect(int& ypos)
buf << " "; // align with info
myBankWidgets[seg] = new PopUpWidget(_boss, _font, xpos, ypos - 2,
pw, myLineHeight, items, buf.str(),
pw, myLineHeight, items, buf.view(),
0, kBankChanged);
myBankWidgets[seg]->setTarget(this);
myBankWidgets[seg]->setID(seg);
@ -338,14 +338,14 @@ void CartridgeEnhancedWidget::loadConfig()
for(auto i: arr)
buf << Common::Base::HEX2 << static_cast<int>(i) << " ";
myPlusROMSendWidget->setText(buf.str(), arr != myOldState.send);
myPlusROMSendWidget->setText(buf.view(), arr != myOldState.send);
buf.str("");
arr = myCart.myPlusROM->getReceive();
for(auto i: arr)
buf << Common::Base::HEX2 << static_cast<int>(i) << " ";
myPlusROMReceiveWidget->setText(buf.str(), arr != myOldState.receive);
myPlusROMReceiveWidget->setText(buf.view(), arr != myOldState.receive);
}
if(myBankWidgets != nullptr)
{

View File

@ -55,7 +55,7 @@ CartRamWidget::CartRamWidget(
buf << " / " << (ramsize/1024) << "KB";
etw = new EditTextWidget(boss, nfont, xpos+lwidth, ypos - 1,
fwidth, myLineHeight, buf.str());
fwidth, myLineHeight, buf.view());
etw->setEditable(false);
ypos += myLineHeight + 4;

View File

@ -203,7 +203,7 @@ void CpuWidget::handleCommand(CommandSender* sender, int cmd, int data, int id)
// event the rest of the debugger widgets
ostringstream command;
command << "pc #" << value;
instance().debugger().run(command.str());
instance().debugger().run(command.view());
break;
}

View File

@ -85,10 +85,10 @@ void DelayQueueWidget::loadConfig() {
break;
}
if(line != ss.str())
if(line != ss.view())
{
setDirty();
line = ss.str();
line = ss.view();
}
delayQueueIterator->next();
}

View File

@ -105,7 +105,7 @@ void FlashWidget::loadConfig()
label << " ";
label << ": " << Common::Base::HEX4 << from << "-" << Common::Base::HEX4 << to;
}
myPage[useCount]->setLabel(label.str());
myPage[useCount]->setLabel(label.view());
startPage = -1;
if(++useCount == MAX_PAGES)

View File

@ -47,10 +47,10 @@ class NullControlWidget : public ControllerWidget
{
ostringstream buf;
buf << getHeader();
const int lwidth = std::max(font.getStringWidth(buf.str()),
const int lwidth = std::max(font.getStringWidth(buf.view()),
font.getStringWidth("Controller input"));
new StaticTextWidget(boss, font, x, y + 2, lwidth, fontHeight, buf.str());
new StaticTextWidget(boss, font, x, y + 2, lwidth, fontHeight, buf.view());
y += 2 + lineHeight * 2;
new StaticTextWidget(boss, font, x, y, lwidth,
fontHeight, "Controller input", TextAlign::Center);

View File

@ -181,7 +181,7 @@ void RomWidget::setPC(int disasm_line)
{
ostringstream command;
command << "pc #" << address;
instance().debugger().run(command.str());
instance().debugger().run(command.view());
}
}
@ -194,7 +194,7 @@ void RomWidget::runtoPC(int disasm_line)
{
ostringstream command;
command << "runtopc #" << address;
const string& msg = instance().debugger().run(command.str());
const string& msg = instance().debugger().run(command.view());
instance().frameBuffer().showTextMessage(msg);
}
}
@ -208,7 +208,7 @@ void RomWidget::setTimer(int disasm_line)
{
ostringstream command;
command << "timer #" << address << " " << instance().debugger().cartDebug().getBank(address);
const string& msg = instance().debugger().run(command.str());
const string& msg = instance().debugger().run(command.view());
instance().frameBuffer().showTextMessage(msg);
}
}
@ -244,7 +244,7 @@ void RomWidget::patchROM(int disasm_line, string_view bytes,
Common::Base::setFormat(base);
command << "rom #" << address << " " << bytes;
instance().debugger().run(command.str());
instance().debugger().run(command.view());
// Restore previous base
Common::Base::setFormat(oldbase);

View File

@ -97,12 +97,12 @@ void TiaOutputWidget::saveSnapshot(int execDepth, string_view execPrefix,
buf.str("");
suffix.str("");
suffix << "_" << i;
buf << sspath.str() << suffix.str() << ".png";
const FSNode next(buf.str());
buf << sspath.view() << suffix.view() << ".png";
const FSNode next(buf.view());
if(!next.exists())
break;
}
sspath << suffix.str();
sspath << suffix.view();
}
}
sspath << ".png";
@ -166,7 +166,7 @@ void TiaOutputWidget::handleCommand(CommandSender* sender, int cmd, int data, in
if(lines > 0)
{
command << "scanLine #" << lines;
const string message = instance().debugger().parser().run(command.str());
const string message = instance().debugger().parser().run(command.view());
instance().frameBuffer().showTextMessage(message);
}
}
@ -175,7 +175,7 @@ void TiaOutputWidget::handleCommand(CommandSender* sender, int cmd, int data, in
ostringstream command;
const int scanline = myClickY + startLine;
command << "breakIf _scan==#" << scanline;
const string& message = instance().debugger().parser().run(command.str());
const string& message = instance().debugger().parser().run(command.view());
instance().frameBuffer().showTextMessage(message);
}
else if(rmb == "zoom")

View File

@ -255,7 +255,7 @@ void TiaZoomWidget::handleCommand(CommandSender* sender, int cmd, int data, int
if(lines > 0)
{
command << "scanline #" << lines;
const string& message = instance().debugger().parser().run(command.str());
const string& message = instance().debugger().parser().run(command.view());
instance().frameBuffer().showTextMessage(message);
}
}
@ -264,7 +264,7 @@ void TiaZoomWidget::handleCommand(CommandSender* sender, int cmd, int data, int
ostringstream command;
const int scanline = myClickY / myZoomLevel + myOffY + startLine;
command << "breakif _scan==#" << scanline;
const string& message = instance().debugger().parser().run(command.str());
const string& message = instance().debugger().parser().run(command.view());
instance().frameBuffer().showTextMessage(message);
}
else

View File

@ -179,7 +179,7 @@ unique_ptr<Cartridge> CartCreator::create(const FSNode& file,
buf << " " << Bankswitch::typeToName(detectedType);
buf << ") ";
cartridge->setAbout(buf.str(), Bankswitch::typeToName(type), id);
cartridge->setAbout(buf.view(), Bankswitch::typeToName(type), id);
return cartridge;
}
@ -207,7 +207,7 @@ CartCreator::createFromMultiCart(const ByteBuffer& image, size_t& size,
md5 = MD5::hash(slice, size);
ostringstream buf;
buf << " [G" << (i+1) << "]";
id = buf.str();
id = buf.view();
// TODO: allow using ROM properties instead of autodetect only
if(size <= 2_KB)

View File

@ -258,7 +258,7 @@ Bankswitch::Type CartDetector::autodetectType(const ByteBuffer& image, size_t si
ostringstream ss;
ss << "Bankswitching type '" << Bankswitch::typeToDesc(type) << "' detected";
Logger::debug(ss.str());
Logger::debug(ss.view());
return type;
}

View File

@ -35,14 +35,14 @@ CartridgeEnhanced::CartridgeEnhanced(const ByteBuffer& image, size_t size,
ostringstream buf;
buf << "ROM larger than expected (" << size << " > " << bsSize
<< "), truncating " << (size - bsSize) << " bytes\n";
Logger::info(buf.str());
Logger::info(buf.view());
}
else if(size < bsSize)
{
ostringstream buf;
buf << "ROM smaller than expected (" << size << " < " << bsSize
<< "), appending " << (bsSize - size) << " bytes\n";
Logger::info(buf.str());
Logger::info(buf.view());
}
mySize = bsSize;

View File

@ -130,7 +130,7 @@ Console::Console(OSystem& osystem, unique_ptr<Cartridge>& cart,
#ifdef DEBUG_BUILD
ostringstream msg;
msg << "Phosphor effect automatically " << (enable ? "enabled" : "disabled");
frameBuffer.showTextMessage(msg.str());
frameBuffer.showTextMessage(msg.view());
#endif
};
myTIA = make_unique<TIA>(*this, [this]() { return timing(); }, myOSystem.settings(), callback);
@ -576,7 +576,7 @@ void Console::toggleInter(bool toggle)
ostringstream ss;
ss << "Interpolation " << (enabled ? "enabled" : "disabled");
myOSystem.frameBuffer().showTextMessage(ss.str());
myOSystem.frameBuffer().showTextMessage(ss.view());
}
else
myOSystem.frameBuffer().showTextMessage(
@ -598,7 +598,7 @@ void Console::toggleTurbo()
ostringstream ss;
ss << "Turbo mode " << (!enabled ? "enabled" : "disabled");
myOSystem.frameBuffer().showTextMessage(ss.str());
myOSystem.frameBuffer().showTextMessage(ss.view());
}
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
@ -623,7 +623,7 @@ void Console::changeSpeed(int direction)
ostringstream val;
val << formatSpeed(speed) << "%";
myOSystem.frameBuffer().showGaugeMessage("Emulation speed", val.str(), speed, MIN_SPEED, MAX_SPEED);
myOSystem.frameBuffer().showGaugeMessage("Emulation speed", val.view(), speed, MIN_SPEED, MAX_SPEED);
}
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
@ -646,7 +646,7 @@ void Console::togglePhosphor(bool toggle)
ostringstream msg;
msg << "Phosphor effect " << (enable ? "enabled" : "disabled");
myOSystem.frameBuffer().showTextMessage(msg.str());
myOSystem.frameBuffer().showTextMessage(msg.view());
}
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
@ -689,7 +689,7 @@ void Console::cyclePhosphorMode(int direction)
}
ostringstream msg;
msg << "Phosphor mode " << MESSAGES[mode];
myOSystem.frameBuffer().showTextMessage(msg.str());
myOSystem.frameBuffer().showTextMessage(msg.view());
}
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
@ -705,7 +705,7 @@ void Console::changePhosphor(int direction)
ostringstream val;
val << blend;
myProperties.set(PropType::Display_PPBlend, val.str());
myProperties.set(PropType::Display_PPBlend, val.view());
if(blend)
val << "%";
else
@ -713,7 +713,7 @@ void Console::changePhosphor(int direction)
val.str("");
val << "Off";
}
myOSystem.frameBuffer().showGaugeMessage("Phosphor blend", val.str(), blend);
myOSystem.frameBuffer().showGaugeMessage("Phosphor blend", val.view(), blend);
}
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
@ -802,11 +802,11 @@ void Console::changeVerticalCenter(int direction)
ostringstream ss, val;
ss << vcenter;
myProperties.set(PropType::Display_VCenter, ss.str());
myProperties.set(PropType::Display_VCenter, ss.view());
if (vcenter != myTIA->vcenter()) myTIA->setVcenter(vcenter);
val << (vcenter ? vcenter > 0 ? "+" : "" : " ") << vcenter << "px";
myOSystem.frameBuffer().showGaugeMessage("V-Center", val.str(), vcenter,
myOSystem.frameBuffer().showGaugeMessage("V-Center", val.view(), vcenter,
myTIA->minVcenter(), myTIA->maxVcenter());
}
@ -836,7 +836,7 @@ void Console::changeVSizeAdjust(int direction)
val << (newAdjustVSize ? newAdjustVSize > 0 ? "+" : "" : " ")
<< newAdjustVSize << "%";
myOSystem.frameBuffer().showGaugeMessage("V-Size", val.str(), newAdjustVSize, -5, 5);
myOSystem.frameBuffer().showGaugeMessage("V-Size", val.view(), newAdjustVSize, -5, 5);
}
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
@ -979,7 +979,7 @@ void Console::changeLeftController(int direction)
ostringstream msg;
msg << "Left controller " << Controller::getName(Controller::Type{type});
myOSystem.frameBuffer().showTextMessage(msg.str());
myOSystem.frameBuffer().showTextMessage(msg.view());
}
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
@ -996,7 +996,7 @@ void Console::changeRightController(int direction)
ostringstream msg;
msg << "Right controller " << Controller::getName(Controller::Type{type});
myOSystem.frameBuffer().showTextMessage(msg.str());
myOSystem.frameBuffer().showTextMessage(msg.view());
}
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
@ -1152,7 +1152,7 @@ void Console::toggleSwapPorts(bool toggle)
ostringstream msg;
msg << "Swap ports " << (swapped ? "enabled" : "disabled");
myOSystem.frameBuffer().showTextMessage(msg.str());
myOSystem.frameBuffer().showTextMessage(msg.view());
}
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
@ -1170,7 +1170,7 @@ void Console::toggleSwapPaddles(bool toggle)
ostringstream msg;
msg << "Swap paddles " << (swapped ? "enabled" : "disabled");
myOSystem.frameBuffer().showTextMessage(msg.str());
myOSystem.frameBuffer().showTextMessage(msg.view());
}
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
@ -1184,7 +1184,7 @@ void Console::changePaddleCenterX(int direction)
ostringstream val;
val << (center ? center > 0 ? "+" : "" : " ") << center * 5 << "px";
myOSystem.frameBuffer().showGaugeMessage("Paddles x-center ", val.str(), center,
myOSystem.frameBuffer().showGaugeMessage("Paddles x-center ", val.view(), center,
Paddles::MIN_ANALOG_CENTER, Paddles::MAX_ANALOG_CENTER);
}
@ -1199,7 +1199,7 @@ void Console::changePaddleCenterY(int direction)
ostringstream val;
val << (center ? center > 0 ? "+" : "" : " ") << center * 5 << "px";
myOSystem.frameBuffer().showGaugeMessage("Paddles y-center ", val.str(), center,
myOSystem.frameBuffer().showGaugeMessage("Paddles y-center ", val.view(), center,
Paddles::MIN_ANALOG_CENTER, Paddles::MAX_ANALOG_CENTER);
}
@ -1221,13 +1221,13 @@ void Console::changePaddleAxesRange(int direction)
control << mode;
if(range != 100)
control << " " << std::to_string(range);
myProperties.set(PropType::Controller_MouseAxis, control.str());
myProperties.set(PropType::Controller_MouseAxis, control.view());
Paddles::setDigitalPaddleRange(range);
ostringstream val;
val << range << "%";
myOSystem.frameBuffer().showGaugeMessage("Mouse axes range", val.str(), range);
myOSystem.frameBuffer().showGaugeMessage("Mouse axes range", val.view(), range);
}
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
@ -1244,7 +1244,7 @@ void Console::toggleAutoFire(bool toggle)
ostringstream ss;
ss << "Autofire " << (enabled ? "enabled" : "disabled");
myOSystem.frameBuffer().showTextMessage(ss.str());
myOSystem.frameBuffer().showTextMessage(ss.view());
}
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
@ -1271,7 +1271,7 @@ void Console::changeAutoFireRate(int direction)
else
val << "Off";
myOSystem.frameBuffer().showGaugeMessage("Autofire rate", val.str(), rate, 0, isNTSC ? 30 : 25);
myOSystem.frameBuffer().showGaugeMessage("Autofire rate", val.view(), rate, 0, isNTSC ? 30 : 25);
}
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
@ -1392,7 +1392,7 @@ void Console::changeJitterSense(int direction) const
myTIA->setJitterSensitivity(sensitivity);
myOSystem.settings().setValue(prefix + "tv.jitter_sense", sensitivity);
val << sensitivity;
myOSystem.frameBuffer().showGaugeMessage("TV jitter sensitivity", val.str(), sensitivity,
myOSystem.frameBuffer().showGaugeMessage("TV jitter sensitivity", val.view(), sensitivity,
0, JitterEmulation::MAX_SENSITIVITY);
}
else
@ -1425,8 +1425,8 @@ void Console::changeJitterRecovery(int direction) const
myTIA->setJitterRecoveryFactor(recovery);
myOSystem.settings().setValue(prefix + "tv.jitter_recovery", recovery);
val << recovery;
myOSystem.frameBuffer().showGaugeMessage("TV jitter roll", val.str(), recovery,
0, JitterEmulation::MAX_RECOVERY);
myOSystem.frameBuffer().showGaugeMessage("TV jitter roll", val.view(),
recovery, 0, JitterEmulation::MAX_RECOVERY);
}
else
{

View File

@ -114,8 +114,8 @@ class Controller : public Serializable
/**
Callback type for general controller messages
*/
using onMessageCallback = std::function<void(const string&)>;
using onMessageCallbackForced = std::function<void(const string&, bool force)>;
using onMessageCallback = std::function<void(string_view)>;
using onMessageCallbackForced = std::function<void(string_view, bool force)>;
public:
/**

View File

@ -205,7 +205,7 @@ void EventHandler::toggleAllow4JoyDirections(bool toggle)
ostringstream ss;
ss << "Allow all 4 joystick directions ";
ss << (joyAllow4 ? "enabled" : "disabled");
myOSystem.frameBuffer().showTextMessage(ss.str());
myOSystem.frameBuffer().showTextMessage(ss.view());
}
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
@ -2351,7 +2351,7 @@ VariantList EventHandler::getComboList()
if(event < Event::Combo1 || event > Event::Combo16)
{
buf << i;
VarList::push_back(l, EventHandler::ourEmulActionList[i].action, buf.str());
VarList::push_back(l, EventHandler::ourEmulActionList[i].action, buf.view());
buf.str("");
}
}
@ -2594,7 +2594,7 @@ void EventHandler::changeMouseControllerMode(int direction)
ostringstream ss;
ss << "Mouse controls " << MSG[i] << " devices";
myOSystem.frameBuffer().showTextMessage(ss.str());
myOSystem.frameBuffer().showTextMessage(ss.view());
}
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
@ -2609,7 +2609,7 @@ void EventHandler::changeMouseCursor(int direction)
ss << "Mouse cursor visibilility: "
<< ((cursor & 2) ? "+" : "-") << "UI, "
<< ((cursor & 1) ? "+" : "-") << "Emulation";
myOSystem.frameBuffer().showTextMessage(ss.str());
myOSystem.frameBuffer().showTextMessage(ss.view());
}
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -

View File

@ -721,7 +721,7 @@ void FrameBuffer::drawFrameStats(float framesPerSecond)
<< "Hz => "
<< info.DisplayFormat;
myStatsMsg.surface->drawString(f, ss.str(), xPos, yPos,
myStatsMsg.surface->drawString(f, ss.view(), xPos, yPos,
myStatsMsg.w, color, TextAlign::Left, 0, true, kBGColor);
yPos += dy;
@ -736,7 +736,7 @@ void FrameBuffer::drawFrameStats(float framesPerSecond)
: myOSystem.settings().getFloat("speed"))
<< "% speed";
myStatsMsg.surface->drawString(f, ss.str(), xPos, yPos,
myStatsMsg.surface->drawString(f, ss.view(), xPos, yPos,
myStatsMsg.w, myStatsMsg.color, TextAlign::Left, 0, true, kBGColor);
yPos += dy;
@ -744,7 +744,7 @@ void FrameBuffer::drawFrameStats(float framesPerSecond)
ss << info.BankSwitch;
int xPosEnd =
myStatsMsg.surface->drawString(f, ss.str(), xPos, yPos,
myStatsMsg.surface->drawString(f, ss.view(), xPos, yPos,
myStatsMsg.w, myStatsMsg.color, TextAlign::Left, 0, true, kBGColor);
if(myOSystem.settings().getBool("dev.settings"))
@ -760,7 +760,7 @@ void FrameBuffer::drawFrameStats(float framesPerSecond)
color = kDbgColorRed;
ss << "VSYNC!";
}
myStatsMsg.surface->drawString(f, ss.str(), xPosEnd, yPos,
myStatsMsg.surface->drawString(f, ss.view(), xPosEnd, yPos,
myStatsMsg.w, color, TextAlign::Left, 0, true, kBGColor);
}
@ -1174,7 +1174,7 @@ void FrameBuffer::toggleFullscreen(bool toggle)
else
msg << "disabled";
}
showTextMessage(msg.str());
showTextMessage(msg.view());
}
break;
}
@ -1207,7 +1207,7 @@ void FrameBuffer::toggleAdaptRefresh(bool toggle)
msg << (isAdaptRefresh ? "enabled" : "disabled");
msg << " (" << myBackend->refreshRate() << " Hz)";
showTextMessage(msg.str());
showTextMessage(msg.view());
}
}
#endif
@ -1233,7 +1233,7 @@ void FrameBuffer::changeOverscan(int direction)
val << (overscan > 0 ? "+" : "" ) << overscan << "%";
else
val << "Off";
myOSystem.frameBuffer().showGaugeMessage("Overscan", val.str(), overscan, 0, 10);
myOSystem.frameBuffer().showGaugeMessage("Overscan", val.view(), overscan, 0, 10);
}
}

View File

@ -118,8 +118,8 @@ void KidVid::update()
}
if(myTape)
{
static constexpr uInt32 gameNumber[4] = { 3, 1, 2, 3 };
static constexpr string_view gameName[6] = {
static constexpr std::array<uInt32, 4> gameNumber = { 3, 1, 2, 3 };
static constexpr std::array<string_view, 6> gameName = {
"Harmony Smurf", "Handy Smurf", "Greedy Smurf",
"Big Number Hunt", "Great Letter Roundup", "Spooky Spelling Bee"
};
@ -132,7 +132,7 @@ void KidVid::update()
ostringstream msg;
msg << "Game #" << gameNumber[myTape - 1] << " - \""
<< gameName[gameNumber[myTape - 1] + (myGame == Game::Smurfs ? -1 : 2)] << "\"";
myCallback(msg.str(), true);
myCallback(msg.view(), true);
}
}
@ -239,9 +239,9 @@ bool KidVid::load(Serializer& in)
}
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
const char* KidVid::getFileName() const
string KidVid::getFileName() const
{
static constexpr const char* const fileNames[6] = {
static constexpr std::array<string, 6> fileNames = {
"KVS3.WAV", "KVS1.WAV", "KVS2.WAV",
"KVB3.WAV", "KVB1.WAV", "KVB2.WAV"
};
@ -256,7 +256,7 @@ const char* KidVid::getFileName() const
void KidVid::openSampleFiles()
{
#ifdef SOUND_SUPPORT
static constexpr uInt32 firstSongPointer[6] = {
static constexpr std::array<uInt32, 6> firstSongPointer = {
44 + 38,
0,
44,
@ -302,7 +302,7 @@ void KidVid::setNextSong()
ourSongStart[temp], mySongLength);
ostringstream msg;
msg << "Read song #" << mySongPointer << " (" << fileName << ")";
myCallback(msg.str(), false);
myCallback(msg.view(), false);
#ifdef DEBUG_BUILD
cerr << fileName << ": " << (ourSongPositions[mySongPointer] & 0x7f) << '\n';

View File

@ -93,7 +93,7 @@ class KidVid : public Controller
private:
// Get name of the current sample file
const char* getFileName() const;
string getFileName() const;
// Open/close a WAV sample file
void openSampleFiles();

View File

@ -131,7 +131,7 @@ inline uInt8 M6502::peek(uInt16 address, Device::AccessFlags flags)
stringstream msg;
msg << "RTrap" << (flags == DISASM_NONE ? "G[" : "[") << Common::Base::HEX2 << cond << "]"
<< (myTrapCondNames[cond].empty() ? ": " : "If: {" + myTrapCondNames[cond] + "} ");
myHitTrapInfo.message = msg.str();
myHitTrapInfo.message = msg.view();
myHitTrapInfo.address = address;
}
}
@ -166,7 +166,7 @@ inline void M6502::poke(uInt16 address, uInt8 value, Device::AccessFlags flags)
myJustHitWriteTrapFlag = true;
stringstream msg;
msg << "WTrap[" << Common::Base::HEX2 << cond << "]" << (myTrapCondNames[cond].empty() ? ":" : "If: {" + myTrapCondNames[cond] + "}");
myHitTrapInfo.message = msg.str();
myHitTrapInfo.message = msg.view();
myHitTrapInfo.address = address;
}
}
@ -289,7 +289,7 @@ inline void M6502::_execute(uInt64 cycles, DispatchResult& result)
msg << "BP: $" << Common::Base::HEX4 << PC << ", bank #"
<< std::dec << static_cast<int>(bank);
result.setDebugger(currentCycles, msg.str(), "Breakpoint");
result.setDebugger(currentCycles, msg.view(), "Breakpoint");
return;
}
}
@ -309,12 +309,12 @@ inline void M6502::_execute(uInt64 cycles, DispatchResult& result)
if(myLogBreaks)
{
msg << "CBP[" << Common::Base::HEX2 << cond << "]:";
myDebugger->log(msg.str());
myDebugger->log(msg.view());
}
else
{
msg << "CBP[" << Common::Base::HEX2 << cond << "]: " << myCondBreakNames[cond];
result.setDebugger(currentCycles, msg.str(), "Conditional breakpoint");
result.setDebugger(currentCycles, msg.view(), "Conditional breakpoint");
return;
}
}
@ -333,7 +333,7 @@ inline void M6502::_execute(uInt64 cycles, DispatchResult& result)
{
ostringstream msg;
msg << "conditional savestate [" << Common::Base::HEX2 << cond << "]";
myDebugger->addState(msg.str());
myDebugger->addState(msg.view());
}
mySystem->cart().clearAllRAMAccesses();
@ -376,7 +376,7 @@ inline void M6502::_execute(uInt64 cycles, DispatchResult& result)
{
ostringstream msg;
msg << "RWP[@ $" << Common::Base::HEX4 << rwpAddr << "]: ";
result.setDebugger(currentCycles, msg.str(), "Read from write port", oldPC);
result.setDebugger(currentCycles, msg.view(), "Read from write port", oldPC);
return;
}
}
@ -388,7 +388,7 @@ inline void M6502::_execute(uInt64 cycles, DispatchResult& result)
{
ostringstream msg;
msg << "WRP[@ $" << Common::Base::HEX4 << wrpAddr << "]: ";
result.setDebugger(currentCycles, msg.str(), "Write to read port", oldPC);
result.setDebugger(currentCycles, msg.view(), "Write to read port", oldPC);
return;
}
}

View File

@ -68,13 +68,6 @@ class MD5
*/
static string hash(const ByteBuffer& buffer, size_t length);
static string hash(const uInt8* buffer, size_t length);
/**
Ditto.
@param buffer The message to compute the digest of
@return The message - digest
*/
static string hash(string_view buffer);
public:

View File

@ -96,7 +96,7 @@ OSystem::OSystem()
ostringstream info;
info << "Build " << STELLA_BUILD << ", using " << MediaFactory::backendName()
<< " [" << BSPF::ARCH << "]";
myBuildInfo = info.str();
myBuildInfo = info.view();
mySettings = MediaFactory::createSettings();
@ -138,7 +138,7 @@ bool OSystem::initialize(const Settings::Options& options)
<< myCheatFile.getShortPath() << "'\n"
<< "Palette file: '"
<< myPaletteFile.getShortPath() << "'\n";
Logger::info(buf.str());
Logger::info(buf.view());
// NOTE: The framebuffer MUST be created before any other object!!!
// Get relevant information about the video hardware
@ -470,7 +470,7 @@ string OSystem::createConsole(const FSNode& rom, string_view md5sum, bool newrom
catch(const runtime_error& e)
{
buf << "ERROR: " << e.what();
Logger::error(buf.str());
Logger::error(buf.view());
return buf.str();
}
@ -517,7 +517,7 @@ string OSystem::createConsole(const FSNode& rom, string_view md5sum, bool newrom
if(propsFile.exists())
buf << " PRO file: " << propsFile.getShortPath() << '\n';
buf << '\n' << getROMInfo(*myConsole);
Logger::info(buf.str());
Logger::info(buf.view());
myFrameBuffer->setCursorState();
@ -539,14 +539,14 @@ string OSystem::createConsole(const FSNode& rom, string_view md5sum, bool newrom
<< " - " << myConsole->cartridge().detectedType()
<< (myConsole->cartridge().isPlusROM() ? " PlusROM " : "")
<< " - " << myConsole->getFormatString();
myFrameBuffer->showTextMessage(msg.str());
myFrameBuffer->showTextMessage(msg.view());
}
else if(!myLauncherUsed)
{
ostringstream msg;
msg << "Stella " << STELLA_VERSION;
myFrameBuffer->showTextMessage(msg.str());
myFrameBuffer->showTextMessage(msg.view());
}
}

View File

@ -91,7 +91,7 @@ class PlusROMRequest {
httplib::Client client(myDestination.host);
const httplib::Headers headers = {
{"PlusROM-Info", content.str()}
{"PlusROM-Info", content.str()} // httplib can't accept string_view
};
client.set_connection_timeout(milliseconds(CONNECTION_TIMEOUT_MSEC));
@ -115,7 +115,7 @@ class PlusROMRequest {
<< myDestination.path
<< ": failed";
Logger::error(ss.str());
Logger::error(ss.view());
myState = State::failed;
@ -132,7 +132,7 @@ class PlusROMRequest {
<< ": failed with HTTP status "
<< response->status;
Logger::error(ss.str());
Logger::error(ss.view());
myState = State::failed;
@ -143,7 +143,7 @@ class PlusROMRequest {
ostringstream ss;
ss << "PlusCart: request to " << myDestination.host << "/" << myDestination.path << ": invalid response";
Logger::error(ss.str());
Logger::error(ss.view());
myState = State::failed;

View File

@ -824,7 +824,7 @@ void Settings::usage()
//
// if(NULL != GetConsoleScreenBufferInfo(GetStdHandle(STD_OUTPUT_HANDLE), &csbi))
// height = csbi.srWindow.Bottom - csbi.srWindow.Top + 1;
cout << buf.str() << std::flush;
cout << buf.view() << std::flush;
#endif
#if defined(BSPF_UNIX) || defined(BSPF_MACOS)

View File

@ -164,7 +164,7 @@ void TIASurface::setNTSC(NTSCFilter::Preset preset, bool show)
}
myOSystem.settings().setValue("tv.filter", static_cast<int>(preset));
if(show) myFB.showTextMessage(buf.str());
if(show) myFB.showTextMessage(buf.view());
}
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
@ -247,7 +247,7 @@ void TIASurface::changeScanlineIntensity(int direction)
buf << intensity << "%";
else
buf << "Off";
myFB.showGaugeMessage("Scanline intensity", buf.str(), intensity);
myFB.showGaugeMessage("Scanline intensity", buf.view(), intensity);
}
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
@ -299,7 +299,7 @@ void TIASurface::cycleScanlineMask(int direction)
ostringstream msg;
msg << "Scanline data '" << Names[i] << "'";
myOSystem.frameBuffer().showTextMessage(msg.str());
myOSystem.frameBuffer().showTextMessage(msg.view());
}
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -

View File

@ -191,7 +191,7 @@ string Thumbulator::doRun(uInt32& cycles, bool irqDrivenAudio)
#endif
#if defined(THUMB_DISS) || defined(THUMB_DBUG)
dump_counters();
cout << statusMsg.str() << '\n';
cout << statusMsg.view() << '\n';
return statusMsg.str();
#else
return "";

View File

@ -324,7 +324,7 @@ void DeveloperDialog::addTiaTab(const GUI::Font& font)
ostringstream ss;
ss << "Delayed VDEL" << ELLIPSIS << " swap for";
mySwapLabel = new StaticTextWidget(myTab, font, HBORDER + INDENT * 2, ypos + 1, ss.str());
mySwapLabel = new StaticTextWidget(myTab, font, HBORDER + INDENT * 2, ypos + 1, ss.view());
mySwapLabel->setToolTip("VDELed objects react one color clock slower to updates.");
wid.push_back(mySwapLabel);
ypos += lineHeight + VGAP * 1;

View File

@ -886,9 +886,9 @@ bool EditableWidget::pasteSelectedText()
lastOk = false;
}
_editString.insert(_caretPos, buf.str());
_editString.insert(_caretPos, buf.view());
// position cursor at the end of pasted text
setCaretPos(_caretPos + static_cast<int>(buf.str().length()));
setCaretPos(_caretPos + static_cast<int>(buf.view().length()));
if(selected || !pasted.empty())
{

View File

@ -205,7 +205,7 @@ void EventMappingWidget::startRemapping()
<< EventHandler::actionAtIndex(myActionSelected, myEventGroup)
<< "' event";
myKeyMapping->setTextColor(kTextColorEm);
myKeyMapping->setText(buf.str());
myKeyMapping->setText(buf.view());
// Make sure that this widget receives all raw data, before any
// pre-processing occurs

View File

@ -947,12 +947,12 @@ void GameInfoDialog::loadHighScoresProperties(const Properties& props)
ss.str("");
ss << hex << right // << setw(HSM::MAX_ADDR_CHARS) << setfill(' ')
<< uppercase << info.varsAddr;
myVarAddress->setText(ss.str());
myVarAddress->setText(ss.view());
ss.str("");
ss << hex << right // << setw(HSM::MAX_ADDR_CHARS) << setfill(' ')
<< uppercase << info.specialAddr;
mySpecialAddress->setText(ss.str());
mySpecialAddress->setText(ss.view());
for (uInt32 a = 0; a < HSM::MAX_SCORE_ADDR; ++a)
@ -963,7 +963,7 @@ void GameInfoDialog::loadHighScoresProperties(const Properties& props)
ss << hex << right // << setw(HSM::MAX_ADDR_CHARS) << setfill(' ')
<< uppercase << info.scoreAddr[a];
}
myScoreAddress[a]->setText(ss.str());
myScoreAddress[a]->setText(ss.view());
}
updateHighScoresWidgets();
}
@ -1489,7 +1489,7 @@ void GameInfoDialog::setAddressVal(const EditTextWidget* addressWidget, EditText
// ss << hex;
ss << right // << setw(2) << setfill(' ')
<< uppercase << static_cast<uInt16>(val);
valWidget->setText(ss.str());
valWidget->setText(ss.view());
}
else
valWidget->setText("");

View File

@ -235,7 +235,7 @@ void HighScoresDialog::loadConfig()
{
ostringstream buf;
buf << std::setw(3) << std::setfill(' ') << i;
VarList::push_back(items, buf.str(), i);
VarList::push_back(items, buf.view(), i);
}
myVariationPopup->addItems(items);
@ -404,7 +404,7 @@ void HighScoresDialog::updateWidgets(bool init)
if (myScores.scores[r].special > 0)
buf << std::setw(HSM::MAX_SPECIAL_DIGITS) << std::setfill(' ')
<< myScores.scores[r].special;
mySpecialWidgets[r]->setLabel(buf.str());
mySpecialWidgets[r]->setLabel(buf.view());
myNameWidgets[r]->setLabel(myScores.scores[r].name);
myDateWidgets[r]->setLabel(myScores.scores[r].date);

View File

@ -140,7 +140,7 @@ void JoystickDialog::handleCommand(CommandSender* sender, int cmd, int data, int
{
ostringstream buf;
buf << "C" << myJoyIDs[data];
myJoyText->setText(buf.str());
myJoyText->setText(buf.view());
myJoyPort->setSelected(myJoyPorts[data]);
}
else

View File

@ -107,7 +107,7 @@ void LauncherDialog::addTitleWidget(int &ypos)
ver << " for RetroN 77";
#endif
new StaticTextWidget(this, _font, 1, ypos, _w - 2, fontHeight,
ver.str(), TextAlign::Center);
ver.view(), TextAlign::Center);
ypos += fontHeight + VGAP;
}
@ -551,7 +551,7 @@ void LauncherDialog::updateUI()
ostringstream buf;
buf << (myList->getList().size() - (currentDir().hasParent() ? 1 : 0))
<< (myShortCount ? " items" : " items found");
myRomCount->setLabel(buf.str());
myRomCount->setLabel(buf.view());
loadRomInfo();
}

View File

@ -121,7 +121,7 @@ void RomAuditDialog::auditRoms()
ProgressDialog progress(this, instance().frameBuffer().font());
buf << "Auditing ROM files" << ELLIPSIS;
progress.setMessage(buf.str());
progress.setMessage(buf.view());
progress.setRange(0, static_cast<int>(files.size()) - 1, 5);
progress.open();

View File

@ -574,13 +574,13 @@ void RomImageWidget::drawWidget(bool hilite)
ostringstream buf;
buf << myImageIdx + 1 << "/" << myImageList.size();
const int yText = _y + _h - _font.getFontHeight() * 10 / 8;
const int wText = _font.getStringWidth(buf.str()) + 8;
const int wText = _font.getStringWidth(buf.view()) + 8;
s.fillRect(_x, yText, _w, _font.getFontHeight(), _bgcolor);
if(!myLabel.empty())
s.drawString(_font, myLabel, _x + 8, yText, _w - wText - 16 - _font.getMaxCharWidth() * 2, _textcolor);
if(!myImageList.empty())
s.drawString(_font, buf.str(), _x + _w - wText, yText, wText, _textcolor);
s.drawString(_font, buf.view(), _x + _w - wText, yText, wText, _textcolor);
// Draw the navigation icons
myNavSurface->invalidate();

View File

@ -1147,7 +1147,7 @@ void VideoAudioDialog::handleShiftChanged(SliderWidget* widget)
ss << std::setw(4) << std::fixed << std::setprecision(1)
<< (0.1 * (widget->getValue())) << DEGREE;
widget->setValueLabel(ss.str());
widget->setValueLabel(ss.view());
handlePaletteUpdate();
}
@ -1384,14 +1384,14 @@ void VideoAudioDialog::handleCommand(CommandSender* sender, int cmd,
{
std::ostringstream ss;
ss << std::fixed << std::setprecision(1) << (0.5 * myHeadroomSlider->getValue()) << " frames";
myHeadroomSlider->setValueLabel(ss.str());
myHeadroomSlider->setValueLabel(ss.view());
break;
}
case kBufferSizeChanged:
{
std::ostringstream ss;
ss << std::fixed << std::setprecision(1) << (0.5 * myBufferSizeSlider->getValue()) << " frames";
myBufferSizeSlider->setValueLabel(ss.str());
myBufferSizeSlider->setValueLabel(ss.view());
break;
}
@ -1445,7 +1445,7 @@ void VideoAudioDialog::colorPalette()
const int color = order[type][idx];
ss << Common::Base::HEX1 << std::uppercase << color;
myColorLbl[idx]->setLabel(ss.str());
myColorLbl[idx]->setLabel(ss.view());
for(int lum = 0; lum < NUM_LUMA; ++lum)
myColor[idx][lum]->setColor(color * NUM_CHROMA + lum * 2); // skip grayscale colors
}