Merge pull request #13 from lioncash/explicit

General: Use explicit where applicable
This commit is contained in:
Phillip Stephens 2019-09-03 00:37:23 -07:00 committed by GitHub
commit d48ba9523f
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 8 additions and 8 deletions

View File

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

View File

@ -17,14 +17,14 @@ namespace kabufuda {
class FileHandle { class FileHandle {
friend class Card; friend class Card;
uint32_t idx = -1; uint32_t idx = UINT32_MAX;
int32_t offset = 0; int32_t offset = 0;
FileHandle(uint32_t idx) : idx(idx) {} explicit FileHandle(uint32_t idx) : idx(idx) {}
public: public:
FileHandle() = default; FileHandle() = default;
uint32_t getFileNo() const { return idx; } uint32_t getFileNo() const { return idx; }
operator bool() const { return getFileNo() != UINT32_MAX; } explicit operator bool() const { return getFileNo() != UINT32_MAX; }
}; };
struct ProbeResults { struct ProbeResults {
@ -136,7 +136,7 @@ public:
* @param game The game code. * @param game The game code.
* @param maker The maker 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(); ~Card();
/** /**
@ -489,6 +489,6 @@ public:
/** /**
* @return Whether or not the card is within a ready state. * @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 } // namespace kabufuda