mirror of https://github.com/AxioDL/kabufuda.git
General: Use explicit where applicable
Makes conversions explicit in order to prevent error-prone implicit conversions.
This commit is contained in:
parent
91a0a41cee
commit
e96db1e032
|
@ -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
|
||||
};
|
||||
|
||||
|
|
|
@ -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
|
||||
|
|
Loading…
Reference in New Issue