General: Use explicit where applicable

Makes conversions explicit in order to prevent error-prone implicit
conversions.
This commit is contained in:
Lioncash 2019-09-02 08:30:06 -04:00
parent 91a0a41cee
commit e96db1e032
2 changed files with 6 additions and 6 deletions

View File

@ -28,7 +28,7 @@ class AsyncIO {
public:
AsyncIO() = default;
AsyncIO(SystemStringView filename, bool truncate = false);
explicit AsyncIO(SystemStringView filename, bool truncate = false);
~AsyncIO();
AsyncIO(AsyncIO&& other);
AsyncIO& operator=(AsyncIO&& other);
@ -41,9 +41,9 @@ public:
ECardResult pollStatus() const;
void waitForCompletion() const;
#ifndef _WIN32
operator bool() const { return m_fd != -1; }
explicit operator bool() const { return m_fd != -1; }
#else
operator bool() const { return m_fh != INVALID_HANDLE_VALUE; }
explicit operator bool() const { return m_fh != INVALID_HANDLE_VALUE; }
#endif
};

View File

@ -24,7 +24,7 @@ class FileHandle {
public:
FileHandle() = default;
uint32_t getFileNo() const { return idx; }
operator bool() const { return getFileNo() != UINT32_MAX; }
explicit operator bool() const { return getFileNo() != UINT32_MAX; }
};
struct ProbeResults {
@ -136,7 +136,7 @@ public:
* @param game The game code.
* @param maker The maker code.
*/
Card(const char* game = nullptr, const char* maker = nullptr);
explicit Card(const char* game = nullptr, const char* maker = nullptr);
~Card();
/**
@ -489,6 +489,6 @@ public:
/**
* @return Whether or not the card is within a ready state.
*/
operator bool() const { return getError() == ECardResult::READY; }
explicit operator bool() const { return getError() == ECardResult::READY; }
};
} // namespace kabufuda