Make FileLayout_XXX elements of an enum
Slight improvement to the previous commit: make FileLayout_Classic and FileLayout_XDG elements of an enum instead of using an untyped "int" for them which didn't really make any sense because these values are not bit masks but exclusive choices for the layout. Also rewrite the checks for them to use "switch" instead of "if" to be warned by the compiler if we ever add another enum value but forget to update the code to handle it. Finally, improve the documentation (add missing "@since") and comments.
This commit is contained in:
@@ -60,10 +60,11 @@ public:
|
||||
Dir_Videos
|
||||
};
|
||||
|
||||
enum
|
||||
// Layout to use for user config/data files under Unix.
|
||||
enum FileLayout
|
||||
{
|
||||
FileLayout_Classic = 0,
|
||||
FileLayout_XDG = 1
|
||||
FileLayout_Classic, // Default: use home directory.
|
||||
FileLayout_XDG // Recommended: use XDG specification.
|
||||
};
|
||||
|
||||
// return the global standard paths object
|
||||
@@ -174,14 +175,14 @@ public:
|
||||
|
||||
bool UsesAppInfo(int info) const { return (m_usedAppInfo & info) != 0; }
|
||||
|
||||
void SetFileLayout(int layout)
|
||||
void SetFileLayout(FileLayout layout)
|
||||
{
|
||||
m_usedFileLayout = layout;
|
||||
m_fileLayout = layout;
|
||||
}
|
||||
|
||||
int GetFileLayout() const
|
||||
FileLayout GetFileLayout() const
|
||||
{
|
||||
return m_usedFileLayout;
|
||||
return m_fileLayout;
|
||||
}
|
||||
|
||||
protected:
|
||||
@@ -199,7 +200,9 @@ protected:
|
||||
|
||||
// combination of AppInfo_XXX flags used by AppendAppInfo()
|
||||
int m_usedAppInfo;
|
||||
int m_usedFileLayout;
|
||||
|
||||
// The file layout to use, currently only used under Unix.
|
||||
FileLayout m_fileLayout;
|
||||
};
|
||||
|
||||
#if wxUSE_STDPATHS
|
||||
|
Reference in New Issue
Block a user