And yet more 'enum' cleanups.

This commit is contained in:
Stephen Anthony 2019-04-13 22:44:23 -02:30
parent 4d99772a10
commit d54f106a3a
8 changed files with 13 additions and 20 deletions

View File

@ -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;
/**

View File

@ -211,10 +211,7 @@ class Serializer
// The stream to send the serialized data to.
unique_ptr<iostream> myStream;
enum {
TruePattern = 0xfe,
FalsePattern = 0x01
};
static constexpr uInt8 TruePattern = 0xfe, FalsePattern = 0x01;
private:
// Following constructors and assignment operators not supported

View File

@ -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);

View File

@ -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

View File

@ -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())

View File

@ -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

View File

@ -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));

View File

@ -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;