diff --git a/src/emucore/FSNode.hxx b/src/emucore/FSNode.hxx index 08d62dacf..64044749b 100644 --- a/src/emucore/FSNode.hxx +++ b/src/emucore/FSNode.hxx @@ -68,11 +68,7 @@ class FilesystemNode /** * Flag to tell listDir() which kind of files to list. */ - enum ListMode { - kListFilesOnly = 1, - kListDirectoriesOnly = 2, - kListAll = 3 - }; + enum class ListMode { FilesOnly, DirectoriesOnly, All }; /** * Create a new pathless FilesystemNode. Since there's no path associated @@ -143,7 +139,7 @@ class FilesystemNode * @return true if successful, false otherwise (e.g. when the directory * does not exist). */ - bool getChildren(FSList& fslist, ListMode mode = kListDirectoriesOnly, + bool getChildren(FSList& fslist, ListMode mode = ListMode::DirectoriesOnly, bool hidden = false) const; /** diff --git a/src/emucore/Serializer.hxx b/src/emucore/Serializer.hxx index 996b8c0b9..5d7f82c29 100644 --- a/src/emucore/Serializer.hxx +++ b/src/emucore/Serializer.hxx @@ -211,10 +211,7 @@ class Serializer // The stream to send the serialized data to. unique_ptr myStream; - enum { - TruePattern = 0xfe, - FalsePattern = 0x01 - }; + static constexpr uInt8 TruePattern = 0xfe, FalsePattern = 0x01; private: // Following constructors and assignment operators not supported diff --git a/src/gui/BrowserDialog.cxx b/src/gui/BrowserDialog.cxx index 80137efe5..ea11a43f0 100644 --- a/src/gui/BrowserDialog.cxx +++ b/src/gui/BrowserDialog.cxx @@ -114,7 +114,7 @@ void BrowserDialog::show(const string& startpath, switch(_mode) { case FileLoad: - _fileList->setFileListMode(FilesystemNode::kListAll); + _fileList->setFileListMode(FilesystemNode::ListMode::All); _fileList->setFileExtension(ext); _selected->setEditable(false); _selected->clearFlags(WIDGET_INVISIBLE); @@ -122,7 +122,7 @@ void BrowserDialog::show(const string& startpath, break; case FileSave: - _fileList->setFileListMode(FilesystemNode::kListAll); + _fileList->setFileListMode(FilesystemNode::ListMode::All); _fileList->setFileExtension(ext); _selected->setEditable(false); // FIXME - disable user input for now _selected->clearFlags(WIDGET_INVISIBLE); @@ -130,7 +130,7 @@ void BrowserDialog::show(const string& startpath, break; case Directories: - _fileList->setFileListMode(FilesystemNode::kListDirectoriesOnly); + _fileList->setFileListMode(FilesystemNode::ListMode::DirectoriesOnly); _selected->setEditable(false); _selected->setFlags(WIDGET_INVISIBLE); _type->setFlags(WIDGET_INVISIBLE); diff --git a/src/gui/FileListWidget.cxx b/src/gui/FileListWidget.cxx index 3d8536ce6..5361232de 100644 --- a/src/gui/FileListWidget.cxx +++ b/src/gui/FileListWidget.cxx @@ -24,7 +24,7 @@ FileListWidget::FileListWidget(GuiObject* boss, const GUI::Font& font, int x, int y, int w, int h) : StringListWidget(boss, font, x, y, w, h), - _fsmode(FilesystemNode::kListAll), + _fsmode(FilesystemNode::ListMode::All), _extension("") { // This widget is special, in that it catches signals and redirects them diff --git a/src/gui/LauncherDialog.cxx b/src/gui/LauncherDialog.cxx index 293fdc6f6..9f24cab64 100644 --- a/src/gui/LauncherDialog.cxx +++ b/src/gui/LauncherDialog.cxx @@ -340,7 +340,7 @@ void LauncherDialog::loadDirListing() FSList files; files.reserve(2048); - myCurrentNode.getChildren(files, FilesystemNode::kListAll); + myCurrentNode.getChildren(files, FilesystemNode::ListMode::All); // Add '[..]' to indicate previous folder if(myCurrentNode.hasParent()) diff --git a/src/gui/RomAuditDialog.cxx b/src/gui/RomAuditDialog.cxx index 04143fa9a..295b2b485 100644 --- a/src/gui/RomAuditDialog.cxx +++ b/src/gui/RomAuditDialog.cxx @@ -121,7 +121,7 @@ void RomAuditDialog::auditRoms() FilesystemNode node(auditPath); FSList files; files.reserve(2048); - node.getChildren(files, FilesystemNode::kListFilesOnly); + node.getChildren(files, FilesystemNode::ListMode::FilesOnly); // Create a progress dialog box to show the progress of processing // the ROMs, since this is usually a time-consuming operation diff --git a/src/unix/FSNodePOSIX.cxx b/src/unix/FSNodePOSIX.cxx index 2f8bb6c1e..e6f41e007 100644 --- a/src/unix/FSNodePOSIX.cxx +++ b/src/unix/FSNodePOSIX.cxx @@ -174,8 +174,8 @@ bool FilesystemNodePOSIX::getChildren(AbstractFSList& myList, ListMode mode, continue; // Honor the chosen mode - if ((mode == FilesystemNode::kListFilesOnly && !entry._isFile) || - (mode == FilesystemNode::kListDirectoriesOnly && !entry._isDirectory)) + if ((mode == FilesystemNode::ListMode::FilesOnly && !entry._isFile) || + (mode == FilesystemNode::ListMode::DirectoriesOnly && !entry._isDirectory)) continue; myList.emplace_back(new FilesystemNodePOSIX(entry)); diff --git a/src/windows/FSNodeWINDOWS.cxx b/src/windows/FSNodeWINDOWS.cxx index ae849ba85..83ddf48b8 100644 --- a/src/windows/FSNodeWINDOWS.cxx +++ b/src/windows/FSNodeWINDOWS.cxx @@ -134,8 +134,8 @@ void FilesystemNodeWINDOWS::addFile(AbstractFSList& list, ListMode mode, isDirectory = ((find_data->dwFileAttributes & FILE_ATTRIBUTE_DIRECTORY) ? true : false); isFile = !isDirectory;//(find_data->dwFileAttributes & FILE_ATTRIBUTE_NORMAL ? true : false); - if((isFile && mode == FilesystemNode::kListDirectoriesOnly) || - (isDirectory && mode == FilesystemNode::kListFilesOnly)) + if((isFile && mode == FilesystemNode::ListMode::DirectoriesOnly) || + (isDirectory && mode == FilesystemNode::ListMode::FilesOnly)) return; entry._isDirectory = isDirectory;