Some minor updates to fix the Windows build from the latest round of changes.

Specifically, the stack class now takes a lambda to apply to all elements it
contains, rather than allowing direct access to each element.

git-svn-id: svn://svn.code.sf.net/p/stella/code/trunk@3245 8b62c5a3-ac7e-4cc8-8f21-d9a121418aba
This commit is contained in:
stephena 2015-12-30 20:26:56 +00:00
parent 5ec561a191
commit a79af3717e
7 changed files with 26 additions and 18 deletions

View File

@ -21,6 +21,7 @@
#define STACK_HXX
#include <array>
#include <functional>
/**
* Simple fixed size stack class.
@ -35,6 +36,8 @@ class FixedStack
uInt32 _size;
public:
using StackFunction = std::function<void(T&)>;
FixedStack<T, CAPACITY>() : _size(0) { }
bool empty() const { return _size <= 0; }
@ -45,11 +48,14 @@ class FixedStack
T pop() { return std::move(_stack[--_size]); }
uInt32 size() const { return _size; }
T* begin() { return _stack.begin(); }
T* end() { return _stack.begin() + _size; }
const T* cbegin() const { return _stack.begin(); }
const T* cend() const { return _stack.begin() + _size; }
// Apply the given function to every item in the stack
// We do it this way so the stack API can be preserved,
// and no access to individual elements is allowed outside
// the class.
void applyAll(const StackFunction& func) {
for(uInt32 i = 0; i < _size; ++i)
func(_stack[i]);
}
private:
// Following constructors and assignment operators not supported

View File

@ -20,7 +20,6 @@
#ifndef ROM_LIST_WIDGET_HXX
#define ROM_LIST_WIDGET_HXX
class RomListSettings;
class ScrollBarWidget;
class PackedBitArray;
class CheckListWidget;
@ -28,6 +27,7 @@ class CheckListWidget;
#include "Base.hxx"
#include "CartDebug.hxx"
#include "EditableWidget.hxx"
#include "RomListSettings.hxx"
/** RomListWidget */
class RomListWidget : public EditableWidget

View File

@ -21,13 +21,12 @@
#define TIA_OUTPUT_WIDGET_HXX
class GuiObject;
class ContextMenu;
class FBSurface;
class TiaZoomWidget;
#include "Widget.hxx"
#include "Command.hxx"
#include "ContextMenu.hxx"
class TiaOutputWidget : public Widget, public CommandSender
{

View File

@ -302,11 +302,10 @@ void Dialog::drawDialog()
// Extra surfaces must be rendered afterwards, so they are drawn on top
if(s.render())
{
for(auto& surface: mySurfaceStack)
{
mySurfaceStack.applyAll([](shared_ptr<FBSurface>& surface){
surface->setDirty();
surface->render();
}
});
}
}

View File

@ -103,12 +103,11 @@ void DialogContainer::draw(bool full)
// Draw all the dialogs on the stack when we want a full refresh
if(full)
{
for(auto& dialog: myDialogStack)
{
dialog->center();
dialog->setDirty();
dialog->drawDialog();
}
myDialogStack.applyAll([](Dialog*& d){
d->center();
d->setDirty();
d->drawDialog();
});
}
else if(!myDialogStack.empty())
myDialogStack.top()->drawDialog();

View File

@ -191,6 +191,11 @@ LauncherDialog::LauncherDialog(OSystem& osystem, DialogContainer& parent,
setListFilters();
}
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
LauncherDialog::~LauncherDialog()
{
}
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
const string& LauncherDialog::selectedRomMD5()
{

View File

@ -57,7 +57,7 @@ class LauncherDialog : public Dialog
public:
LauncherDialog(OSystem& osystem, DialogContainer& parent,
int x, int y, int w, int h);
virtual ~LauncherDialog() = default;
virtual ~LauncherDialog();
/**
Get MD5sum for the currently selected file