diff --git a/src/cheat/CheatManager.cxx b/src/cheat/CheatManager.cxx index a032be14e..b607d2094 100644 --- a/src/cheat/CheatManager.cxx +++ b/src/cheat/CheatManager.cxx @@ -59,7 +59,7 @@ Cheat* CheatManager::add(const string& name, const string& code, { if(myCheatList[i]->name() == name || myCheatList[i]->code() == code) { - myCheatList.remove_at(i); + myCheatList.removeAt(i); break; } } @@ -68,7 +68,7 @@ Cheat* CheatManager::add(const string& name, const string& code, if(idx == -1) myCheatList.push_back(cheat); else - myCheatList.insert_at(idx, cheat); + myCheatList.insertAt(idx, cheat); // And enable/disable it (the cheat knows how to enable or disable itself) if(enable) @@ -91,7 +91,7 @@ void CheatManager::remove(int idx) addPerFrame(c, false); // Then remove it from the cheatlist entirely - myCheatList.remove_at(idx); + myCheatList.removeAt(idx); c->disable(); delete c; } @@ -122,7 +122,7 @@ void CheatManager::addPerFrame(Cheat* cheat, bool enable) else { if(found) - myPerFrameList.remove_at(i); + myPerFrameList.removeAt(i); } } diff --git a/src/common/Array.hxx b/src/common/Array.hxx index 7596d92f3..f0726955b 100644 --- a/src/common/Array.hxx +++ b/src/common/Array.hxx @@ -15,9 +15,6 @@ // this file, and for a DISCLAIMER OF ALL WARRANTIES. // // $Id$ -// -// Based on code from ScummVM - Scumm Interpreter -// Copyright (C) 2002-2004 The ScummVM project //============================================================================ #ifndef ARRAY_HXX @@ -30,208 +27,30 @@ namespace Common { template -class Array +class Array : public vector { - protected: - uInt32 _capacity; - uInt32 _size; - T* _data; - public: - typedef T* iterator; - typedef const T* const_iterator; - - public: - // Standard c'tor - Array() : _capacity(0), _size(0), _data(nullptr) { } - - // Copy c'tor - Array(const Array& array) - : _capacity(array._size+128), _size(array._size), _data(nullptr) + void append(const Array& array) { - _data = new T[_capacity]; - for(uInt32 i = 0; i < _size; i++) - _data[i] = array._data[i]; - } - // Copy assignment - Array& operator =(const Array& array) - { - delete [] _data; - _size = array._size; - _capacity = _size + 128; - _data = new T[_capacity]; - for(uInt32 i = 0; i < _size; i++) - _data[i] = array._data[i]; - - return *this; + this->insert(this->end(), array.begin(), array.end()); } - // Move c'tor - Array(Array&& array) - : _capacity(array._capacity), _size(array._size), _data(array._data) + void insertAt(uInt32 idx, const T& element) { - array._size = 0; - array._capacity = 0; - array._data = nullptr; - } - // Move assignment - Array& operator =(Array&& array) - { - if(this != &array) - { - delete[] _data; - _capacity = array._size; - _size = array._size; - _data = array._data; - array._capacity = 0; - array._size = 0; - array._data = nullptr; - - } - return *this; + this->insert(this->cbegin()+idx, element); } - // Initializer list c'tor - Array(std::initializer_list il) : _capacity(0), _size(0), _data(nullptr) + void removeAt(uInt32 idx) { - ensureCapacity(il.size()); - for(int e: il) - _data[_size++] = e; - } - - // D'tor - ~Array() - { - if(_data) - { - delete[] _data; - _data = nullptr; - } - } - - void reserve(uInt32 capacity) - { - if(capacity > _capacity) - ensureCapacity(capacity - 128); - } - - void push_back(const T& element) - { - ensureCapacity(_size + 1); - _data[_size++] = element; - } - - void push_back(const Array& array) - { - ensureCapacity(_size + array._size); - for(uInt32 i = 0; i < array._size; i++) - _data[_size++] = array._data[i]; - } - - void insert_at(uInt32 idx, const T& element) - { - assert(idx >= 0 && idx <= _size); - ensureCapacity(_size + 1); - // The following loop is not efficient if you can just memcpy things around. - // e.g. if you have a list of ints. But for real objects (String...), memcpy - // usually isn't correct (specifically, for any class which has a non-default - // copy behaviour. E.g. the String class uses a refCounter which has to be - // updated whenever a String is copied. - for(uInt32 i = _size; i > idx; i--) - _data[i] = _data[i-1]; - - _data[idx] = element; - _size++; - } - - T remove_at(uInt32 idx) - { - assert(idx >= 0 && idx < _size); - T tmp = _data[idx]; - for(uInt32 i = idx; i < _size - 1; i++) - _data[i] = _data[i+1]; - _size--; - return tmp; - } - - T& operator [](uInt32 idx) - { - assert(idx >= 0 && idx < _size); - return _data[idx]; - } - - const T& operator [](uInt32 idx) const - { - assert(idx >= 0 && idx < _size); - return _data[idx]; - } - - uInt32 size() const { return _size; } - uInt32 capacity() const { return _capacity; } - - void clear(bool fullerase = true) - { - if(fullerase) - { - if(_data) - { - delete [] _data; - _data = nullptr; - } - _capacity = 0; - } - _size = 0; - } - - bool isEmpty() const - { - return (_size == 0); - } - - iterator begin() - { - return _data; - } - - iterator end() - { - return _data + _size; - } - - const_iterator begin() const - { - return _data; - } - - const_iterator end() const - { - return _data + _size; - } - - protected: - void ensureCapacity(uInt32 new_len) - { - if (new_len <= _capacity) - return; - - T* old_data = _data; - _capacity = new_len + 128; - _data = new T[_capacity]; - - if(old_data) - { - // Copy old data - for(uInt32 i = 0; i < _size; i++) - _data[i] = old_data[i]; - delete[] old_data; - } + this->erase(this->cbegin()+idx); } }; } // Namespace Common -typedef Common::Array IntArray; -typedef Common::Array BoolArray; -typedef Common::Array ByteArray; +// Common array types +class IntArray : public Common::Array { }; +class BoolArray : public Common::Array { }; +class ByteArray : public Common::Array { }; #endif diff --git a/src/common/PNGLibrary.cxx b/src/common/PNGLibrary.cxx index 2614791de..9930d0cdc 100644 --- a/src/common/PNGLibrary.cxx +++ b/src/common/PNGLibrary.cxx @@ -159,7 +159,7 @@ void PNGLibrary::saveImage(const string& filename, const FBSurface& surface, // Do we want the entire surface or just a section? png_uint_32 width = rect.width(), height = rect.height(); - if(rect.isEmpty()) + if(rect.empty()) { width = surface.width(); height = surface.height(); diff --git a/src/common/StringList.hxx b/src/common/StringList.hxx index 9c65abcf6..62ebecd36 100644 --- a/src/common/StringList.hxx +++ b/src/common/StringList.hxx @@ -21,23 +21,10 @@ #define STRING_LIST_HXX #include "Array.hxx" -#include "bspf.hxx" class StringList : public Common::Array { public: - void push_back(const char* str) - { - ensureCapacity(_size + 1); - _data[_size++] = str; - } - - void push_back(const string& str) - { - ensureCapacity(_size + 1); - _data[_size++] = str; - } - static string removePattern(const string& str, const string& pattern) { // This can probably be made more efficient ... diff --git a/src/common/Variant.hxx b/src/common/Variant.hxx index dd503ccac..38167e1f1 100644 --- a/src/common/Variant.hxx +++ b/src/common/Variant.hxx @@ -76,22 +76,19 @@ class Variant }; // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -static const Variant EmptyVariant(""); +static const Variant EmptyVariant = Variant(); // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - class VariantList : public Common::Array> { public: - VariantList() { } - void push_back(const Variant& name, const Variant& tag = EmptyVariant) { - ensureCapacity(_size + 1); - _data[_size++] = make_pair(name.toString(), tag); + emplace_back(name.toString(), tag); } }; // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -static const VariantList EmptyVarList; +static const VariantList EmptyVarList = VariantList(); #endif diff --git a/src/debugger/CartDebug.cxx b/src/debugger/CartDebug.cxx index 2a318dca7..92e1993c7 100644 --- a/src/debugger/CartDebug.cxx +++ b/src/debugger/CartDebug.cxx @@ -302,7 +302,7 @@ bool CartDebug::disassemble(bool force) // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - bool CartDebug::fillDisassemblyList(BankInfo& info, uInt16 search) { - myDisassembly.list.clear(false); + myDisassembly.list.clear(); myDisassembly.fieldwidth = 14 + myLabelLength; DiStella distella(*this, myDisassembly.list, info, DiStella::settings, myDisLabels, myDisDirectives, myReserved); @@ -1010,7 +1010,7 @@ string CartDebug::saveDisassembly() { BankInfo& info = myBankInfo[bank]; // Disassemble bank - disasm.list.clear(false); // don't fully de-allocate space + disasm.list.clear(); DiStella distella(*this, disasm.list, info, settings, myDisLabels, myDisDirectives, myReserved); diff --git a/src/debugger/Debugger.cxx b/src/debugger/Debugger.cxx index 07b31a4d3..a1c299506 100644 --- a/src/debugger/Debugger.cxx +++ b/src/debugger/Debugger.cxx @@ -684,7 +684,7 @@ bool Debugger::RewindManager::addState() myStateList[myTop] = new Serializer(); Serializer& s = *(myStateList[myTop]); - if(s.isValid()) + if(s.valid()) { s.reset(); if(myOSystem.state().saveState(s) && myOSystem.console().tia().saveDisplay(s)) @@ -723,7 +723,7 @@ bool Debugger::RewindManager::rewindState() } // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -bool Debugger::RewindManager::isEmpty() +bool Debugger::RewindManager::empty() { return mySize == 0; } diff --git a/src/debugger/Debugger.hxx b/src/debugger/Debugger.hxx index 4fc54b66f..d5dd4ec1c 100644 --- a/src/debugger/Debugger.hxx +++ b/src/debugger/Debugger.hxx @@ -328,7 +328,7 @@ class Debugger : public DialogContainer public: bool addState(); bool rewindState(); - bool isEmpty(); + bool empty(); void clear(); private: diff --git a/src/debugger/DebuggerParser.cxx b/src/debugger/DebuggerParser.cxx index 82d36e770..95a763880 100644 --- a/src/debugger/DebuggerParser.cxx +++ b/src/debugger/DebuggerParser.cxx @@ -886,7 +886,7 @@ void DebuggerParser::executeDelwatch() int which = args[0] - 1; if(which >= 0 && which < (int)watches.size()) { - watches.remove_at(which); + watches.removeAt(which); commandResult << "removed watch"; } else diff --git a/src/debugger/DebuggerParser.hxx b/src/debugger/DebuggerParser.hxx index 8d4182639..c1cef5fcd 100644 --- a/src/debugger/DebuggerParser.hxx +++ b/src/debugger/DebuggerParser.hxx @@ -28,6 +28,7 @@ struct Command; #include "bspf.hxx" #include "Array.hxx" +#include "StringList.hxx" #include "FrameBuffer.hxx" #include "Settings.hxx" diff --git a/src/emucore/CartCTY.cxx b/src/emucore/CartCTY.cxx index 87e536393..f7ddaa531 100644 --- a/src/emucore/CartCTY.cxx +++ b/src/emucore/CartCTY.cxx @@ -450,7 +450,7 @@ void CartridgeCTY::loadTune(uInt8 index) void CartridgeCTY::loadScore(uInt8 index) { Serializer serializer(myEEPROMFile, true); - if(serializer.isValid()) + if(serializer.valid()) { uInt8 scoreRAM[256]; try @@ -470,7 +470,7 @@ void CartridgeCTY::loadScore(uInt8 index) void CartridgeCTY::saveScore(uInt8 index) { Serializer serializer(myEEPROMFile); - if(serializer.isValid()) + if(serializer.valid()) { // Load score RAM uInt8 scoreRAM[256]; @@ -504,7 +504,7 @@ void CartridgeCTY::saveScore(uInt8 index) void CartridgeCTY::wipeAllScores() { Serializer serializer(myEEPROMFile); - if(serializer.isValid()) + if(serializer.valid()) { // Erase score RAM uInt8 scoreRAM[256]; diff --git a/src/emucore/CartFA2.cxx b/src/emucore/CartFA2.cxx index 7d3b1d245..5b330ba7b 100644 --- a/src/emucore/CartFA2.cxx +++ b/src/emucore/CartFA2.cxx @@ -371,7 +371,7 @@ uInt8 CartridgeFA2::ramReadWrite() // We go ahead and do the access now, and only return when a sufficient // amount of time has passed Serializer serializer(myFlashFile); - if(serializer.isValid()) + if(serializer.valid()) { if(myRAM[255] == 1) // read { @@ -423,7 +423,7 @@ uInt8 CartridgeFA2::ramReadWrite() void CartridgeFA2::flash(uInt8 operation) { Serializer serializer(myFlashFile); - if(serializer.isValid()) + if(serializer.valid()) { if(operation == 0) // erase { diff --git a/src/emucore/EventHandler.hxx b/src/emucore/EventHandler.hxx index 7b3bce568..41f80501f 100644 --- a/src/emucore/EventHandler.hxx +++ b/src/emucore/EventHandler.hxx @@ -27,12 +27,12 @@ class OSystem; class DialogContainer; class EventMappingWidget; class MouseControl; -class StringList; class VariantList; #include "Array.hxx" #include "Event.hxx" #include "StellaKeys.hxx" +#include "StringList.hxx" #include "bspf.hxx" enum MouseButton { diff --git a/src/emucore/EventJoyHandler.cxx b/src/emucore/EventJoyHandler.cxx index 4fb2f9bb3..c859e0c41 100644 --- a/src/emucore/EventJoyHandler.cxx +++ b/src/emucore/EventJoyHandler.cxx @@ -325,7 +325,7 @@ int EventHandler::JoystickHandler::add(StellaJoystick* stick) } stick->type = StellaJoystick::JT_REGULAR; } - mySticks.insert_at(stick->ID, stick); + mySticks.insertAt(stick->ID, stick); // Map the stelladaptors we've found according to the specified ports if(specialAdaptor) diff --git a/src/emucore/FBSurface.cxx b/src/emucore/FBSurface.cxx index 976701db9..ab0e4b755 100644 --- a/src/emucore/FBSurface.cxx +++ b/src/emucore/FBSurface.cxx @@ -39,7 +39,7 @@ void FBSurface::readPixels(uInt8* buffer, uInt32 pitch, const GUI::Rect& rect) c { uInt8* src = (uInt8*) myPixels + rect.y() * myPitch + rect.x(); - if(rect.isEmpty()) + if(rect.empty()) memcpy(buffer, src, width() * height() * 4); else { diff --git a/src/emucore/FrameBuffer.cxx b/src/emucore/FrameBuffer.cxx index 62028cb74..b6fd37165 100644 --- a/src/emucore/FrameBuffer.cxx +++ b/src/emucore/FrameBuffer.cxx @@ -76,7 +76,7 @@ bool FrameBuffer::initialize() // Check the 'maxres' setting, which is an undocumented developer feature // that specifies the desktop size (not normally set) const GUI::Size& s = myOSystem.settings().getSize("maxres"); - if(s.isValid()) + if(s.valid()) { query_w = s.w; query_h = s.h; @@ -943,9 +943,9 @@ void FrameBuffer::VideoModeList::clear() } // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -bool FrameBuffer::VideoModeList::isEmpty() const +bool FrameBuffer::VideoModeList::empty() const { - return myModeList.isEmpty(); + return myModeList.empty(); } // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/src/emucore/FrameBuffer.hxx b/src/emucore/FrameBuffer.hxx index 9e064a426..0ed3fb0bd 100644 --- a/src/emucore/FrameBuffer.hxx +++ b/src/emucore/FrameBuffer.hxx @@ -32,7 +32,6 @@ namespace GUI { #include "EventHandler.hxx" #include "Rect.hxx" -#include "StringList.hxx" #include "Variant.hxx" #include "FBSurface.hxx" #include "TIASurface.hxx" @@ -484,7 +483,7 @@ class FrameBuffer void add(const VideoMode& mode); void clear(); - bool isEmpty() const; + bool empty() const; uInt32 size() const; void previous(); diff --git a/src/emucore/M6502.cxx b/src/emucore/M6502.cxx index 68f38d9d4..926e31a66 100644 --- a/src/emucore/M6502.cxx +++ b/src/emucore/M6502.cxx @@ -444,8 +444,8 @@ void M6502::delCondBreak(uInt32 brk) if(brk < myBreakConds.size()) { delete myBreakConds[brk]; - myBreakConds.remove_at(brk); - myBreakCondNames.remove_at(brk); + myBreakConds.removeAt(brk); + myBreakCondNames.removeAt(brk); } } diff --git a/src/emucore/Serializer.cxx b/src/emucore/Serializer.cxx index f9301623a..f94f6b4ed 100644 --- a/src/emucore/Serializer.cxx +++ b/src/emucore/Serializer.cxx @@ -99,7 +99,7 @@ Serializer::~Serializer() } // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -bool Serializer::isValid() const +bool Serializer::valid() const { return myStream != NULL; } diff --git a/src/emucore/Serializer.hxx b/src/emucore/Serializer.hxx index 948fa7a58..ba4293f65 100644 --- a/src/emucore/Serializer.hxx +++ b/src/emucore/Serializer.hxx @@ -50,7 +50,7 @@ class Serializer If a file is opened readonly, we can never write to it. - The isValid() method must immediately be called to verify the stream + The valid() method must immediately be called to verify the stream was correctly initialized. */ Serializer(const string& filename, bool readonly = false); @@ -66,7 +66,7 @@ class Serializer Answers whether the serializer is currently initialized for reading and writing. */ - bool isValid() const; + bool valid() const; /** Resets the read/write location to the beginning of the stream. diff --git a/src/emucore/StateManager.cxx b/src/emucore/StateManager.cxx index 30fd42125..ca061fc2c 100644 --- a/src/emucore/StateManager.cxx +++ b/src/emucore/StateManager.cxx @@ -173,7 +173,7 @@ void StateManager::loadState(int slot) // Make sure the file can be opened in read-only mode Serializer in(buf.str(), true); - if(!in.isValid()) + if(!in.valid()) { buf.str(""); buf << "Can't open/load from state file " << slot; @@ -217,7 +217,7 @@ void StateManager::saveState(int slot) // Make sure the file can be opened for writing Serializer out(buf.str()); - if(!out.isValid()) + if(!out.valid()) { buf.str(""); buf << "Can't open/save to state file " << slot; @@ -267,7 +267,7 @@ bool StateManager::loadState(Serializer& in) if(myOSystem.hasConsole()) { // Make sure the file can be opened for reading - if(in.isValid()) + if(in.valid()) { // First test if we have a valid header and cart type // If so, do a complete state load using the Console @@ -287,7 +287,7 @@ bool StateManager::saveState(Serializer& out) if(myOSystem.hasConsole()) { // Make sure the file can be opened for writing - if(out.isValid()) + if(out.valid()) { // Add header so that if the state format changes in the future, // we'll know right away, without having to parse the rest of the file diff --git a/src/gui/ComboDialog.cxx b/src/gui/ComboDialog.cxx index 8a2e6172c..e79958393 100644 --- a/src/gui/ComboDialog.cxx +++ b/src/gui/ComboDialog.cxx @@ -114,7 +114,7 @@ void ComboDialog::loadConfig() StringList events; instance().eventHandler().getComboListForEvent(myComboEvent, events); - int size = BSPF_min(events.size(), 8u); + int size = BSPF_min((int)events.size(), 8); for(int i = 0; i < size; ++i) myEvents[i]->setSelected("", events[i]); diff --git a/src/gui/Dialog.cxx b/src/gui/Dialog.cxx index bb54fd6b9..283999e64 100644 --- a/src/gui/Dialog.cxx +++ b/src/gui/Dialog.cxx @@ -150,7 +150,7 @@ void Dialog::addToFocusList(WidgetArray& list) for(uInt32 i = 0; i < list.size(); ++i) list[i]->setFlags(WIDGET_RETAIN_FOCUS); - _myFocus.list.push_back(list); + _myFocus.list.append(list); _focusList = _myFocus.list; if(list.size() > 0) @@ -176,14 +176,14 @@ void Dialog::addToFocusList(WidgetArray& list, TabWidget* w, int tabId) // Now insert in the correct place in that focus list uInt32 id = tabId; if(id < focus.size()) - focus[id].list.push_back(list); + focus[id].list.append(list); else { // Make sure the array is large enough while(focus.size() <= id) focus.push_back(Focus()); - focus[id].list.push_back(list); + focus[id].list.append(list); } if(list.size() > 0) @@ -245,13 +245,13 @@ void Dialog::buildCurrentFocusList(int tabID) _myTabList[id].appendFocusList(_focusList); // Add remaining items from main focus list - _focusList.push_back(_myFocus.list); + _focusList.append(_myFocus.list); // Add button group at end of current focus list // We do it this way for TabWidget, so that buttons are scanned // *after* the widgets in the current tab if(_buttonGroup.size() > 0) - _focusList.push_back(_buttonGroup); + _focusList.append(_buttonGroup); // Finally, the moment we've all been waiting for :) // Set the actual focus widget @@ -727,7 +727,7 @@ void Dialog::TabFocus::appendFocusList(WidgetArray& list) int active = widget->getActiveTab(); if(active >= 0 && active < (int)focus.size()) - list.push_back(focus[active].list); + list.append(focus[active].list); } // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/src/gui/LauncherDialog.cxx b/src/gui/LauncherDialog.cxx index 6c565d6cd..89f4a2bf3 100644 --- a/src/gui/LauncherDialog.cxx +++ b/src/gui/LauncherDialog.cxx @@ -254,7 +254,7 @@ void LauncherDialog::loadConfig() // Assume that if the list is empty, this is the first time that loadConfig() // has been called (and we should reload the list) - if(myList->getList().isEmpty()) + if(myList->getList().empty()) { myPrevDirButton->setEnabled(false); myCurrentNode = FilesystemNode(romdir == "" ? "~" : romdir); diff --git a/src/gui/ListWidget.cxx b/src/gui/ListWidget.cxx index 0960aa9a0..747df430b 100644 --- a/src/gui/ListWidget.cxx +++ b/src/gui/ListWidget.cxx @@ -88,7 +88,7 @@ void ListWidget::setSelected(int item) void ListWidget::setSelected(const string& item) { int selected = -1; - if(!_list.isEmpty()) + if(!_list.empty()) { if(item == "") selected = 0; diff --git a/src/gui/MessageBox.cxx b/src/gui/MessageBox.cxx index 46a72c0c3..bf55f88e3 100644 --- a/src/gui/MessageBox.cxx +++ b/src/gui/MessageBox.cxx @@ -76,7 +76,7 @@ void MessageBox::addText(const GUI::Font& font, const StringList& text) for(uInt32 i = 0; i < text.size(); ++i) str_w = BSPF_max((int)text[i].length(), str_w); _w = BSPF_min(str_w * fontWidth + 20, _w); - _h = BSPF_min(((text.size() + 2) * lineHeight + 20), (uInt32)_h); + _h = BSPF_min((uInt32)((text.size() + 2) * lineHeight + 20), (uInt32)_h); xpos = 10; ypos = 10; for(uInt32 i = 0; i < text.size(); ++i) diff --git a/src/gui/Rect.hxx b/src/gui/Rect.hxx index 7c65c30bc..6a018edb9 100644 --- a/src/gui/Rect.hxx +++ b/src/gui/Rect.hxx @@ -74,7 +74,7 @@ struct Size if(c != 'x') w = h = 0; } - bool isValid() const { return w > 0 && h > 0; } + bool valid() const { return w > 0 && h > 0; } Size& operator=(const Size& s) { w = s.w; h = s.h; return *this; }; bool operator==(const Size& s) const { return w == s.w && h == s.h; }; @@ -118,7 +118,7 @@ struct Rect Rect(const Point& p, uInt32 w, uInt32 h) : top(p.y), left(p.x), bottom(h), right(w) {} Rect(uInt32 x1, uInt32 y1, uInt32 x2, uInt32 y2) : top(y1), left(x1), bottom(y2), right(x2) { - assert(isValid()); + assert(valid()); } uInt32 x() const { return left; } @@ -138,14 +138,14 @@ struct Rect left = x1; bottom = y2; right = x2; - assert(isValid()); + assert(valid()); } - bool isValid() const { + bool valid() const { return (left <= right && top <= bottom); } - bool isEmpty() const { + bool empty() const { return top == 0 && left == 0 && bottom == 0 && right == 0; }