mirror of https://github.com/AxioDL/metaforce.git
Merge pull request #12 from lioncash/bool
General: Make operator bool() explicit where applicable
This commit is contained in:
commit
5b5d443410
|
@ -67,7 +67,7 @@ public:
|
||||||
return *this;
|
return *this;
|
||||||
}
|
}
|
||||||
|
|
||||||
operator bool() const { return ((*WordRef) & (BitWord(1) << BitPos)) != 0; }
|
explicit operator bool() const { return ((*WordRef) & (BitWord(1) << BitPos)) != 0; }
|
||||||
};
|
};
|
||||||
|
|
||||||
/// BitVector default ctor - Creates an empty bitvector.
|
/// BitVector default ctor - Creates an empty bitvector.
|
||||||
|
|
|
@ -57,7 +57,7 @@ class SDNARead {
|
||||||
|
|
||||||
public:
|
public:
|
||||||
explicit SDNARead(SystemStringView path);
|
explicit SDNARead(SystemStringView path);
|
||||||
operator bool() const { return !m_data.empty(); }
|
explicit operator bool() const { return !m_data.empty(); }
|
||||||
const SDNABlock& sdnaBlock() const { return m_sdnaBlock; }
|
const SDNABlock& sdnaBlock() const { return m_sdnaBlock; }
|
||||||
void enumerate(const std::function<bool(const FileBlock& block, athena::io::MemoryReader& r)>& func) const;
|
void enumerate(const std::function<bool(const FileBlock& block, athena::io::MemoryReader& r)>& func) const;
|
||||||
};
|
};
|
||||||
|
|
|
@ -246,7 +246,7 @@ private:
|
||||||
|
|
||||||
public:
|
public:
|
||||||
Project(const ProjectRootPath& rootPath);
|
Project(const ProjectRootPath& rootPath);
|
||||||
operator bool() const { return m_valid; }
|
explicit operator bool() const { return m_valid; }
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @brief Configuration file handle
|
* @brief Configuration file handle
|
||||||
|
|
|
@ -173,7 +173,7 @@ public:
|
||||||
}, static_cast<const base&>(*this));
|
}, static_cast<const base&>(*this));
|
||||||
}
|
}
|
||||||
|
|
||||||
constexpr operator bool() const noexcept {
|
constexpr explicit operator bool() const noexcept {
|
||||||
return !std::holds_alternative<typename std::variant_alternative_t<0, std::variant<_Types...>>>(*this);
|
return !std::holds_alternative<typename std::variant_alternative_t<0, std::variant<_Types...>>>(*this);
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
|
@ -153,7 +153,7 @@ public:
|
||||||
return {bucket.buffer, m_div.rem * m_pool->m_stride};
|
return {bucket.buffer, m_div.rem * m_pool->m_stride};
|
||||||
}
|
}
|
||||||
|
|
||||||
operator bool() const { return m_pool != nullptr && m_index != -1; }
|
explicit operator bool() const { return m_pool != nullptr && m_index != -1; }
|
||||||
};
|
};
|
||||||
|
|
||||||
UniformBufferPool() = default;
|
UniformBufferPool() = default;
|
||||||
|
|
|
@ -158,7 +158,7 @@ public:
|
||||||
return {bucket.buffer, m_div.rem};
|
return {bucket.buffer, m_div.rem};
|
||||||
}
|
}
|
||||||
|
|
||||||
operator bool() const { return m_pool != nullptr && m_index != -1; }
|
explicit operator bool() const { return m_pool != nullptr && m_index != -1; }
|
||||||
};
|
};
|
||||||
|
|
||||||
VertexBufferPool() = default;
|
VertexBufferPool() = default;
|
||||||
|
|
|
@ -525,7 +525,7 @@ public:
|
||||||
DirectoryEnumerator(SystemStringView path, Mode mode = Mode::DirsThenFilesSorted, bool sizeSort = false,
|
DirectoryEnumerator(SystemStringView path, Mode mode = Mode::DirsThenFilesSorted, bool sizeSort = false,
|
||||||
bool reverse = false, bool noHidden = false);
|
bool reverse = false, bool noHidden = false);
|
||||||
|
|
||||||
operator bool() const { return m_entries.size() != 0; }
|
explicit operator bool() const { return m_entries.size() != 0; }
|
||||||
size_t size() const { return m_entries.size(); }
|
size_t size() const { return m_entries.size(); }
|
||||||
std::vector<Entry>::const_iterator begin() const { return m_entries.cbegin(); }
|
std::vector<Entry>::const_iterator begin() const { return m_entries.cbegin(); }
|
||||||
std::vector<Entry>::const_iterator end() const { return m_entries.cend(); }
|
std::vector<Entry>::const_iterator end() const { return m_entries.cend(); }
|
||||||
|
@ -557,7 +557,7 @@ public:
|
||||||
/**
|
/**
|
||||||
* @brief Tests for non-empty project root path
|
* @brief Tests for non-empty project root path
|
||||||
*/
|
*/
|
||||||
operator bool() const { return m_projRoot.size() != 0; }
|
explicit operator bool() const { return m_projRoot.size() != 0; }
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @brief Construct a representation of a project root path
|
* @brief Construct a representation of a project root path
|
||||||
|
@ -677,7 +677,7 @@ public:
|
||||||
/**
|
/**
|
||||||
* @brief Tests for non-empty project path
|
* @brief Tests for non-empty project path
|
||||||
*/
|
*/
|
||||||
operator bool() const { return m_absPath.size() != 0; }
|
explicit operator bool() const { return m_absPath.size() != 0; }
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @brief Clears path
|
* @brief Clears path
|
||||||
|
|
|
@ -25,7 +25,7 @@ public:
|
||||||
inflateInit(&m_zstrm);
|
inflateInit(&m_zstrm);
|
||||||
}
|
}
|
||||||
~ShaderCacheZipStream() override { inflateEnd(&m_zstrm); }
|
~ShaderCacheZipStream() override { inflateEnd(&m_zstrm); }
|
||||||
operator bool() const { return m_compBuf.operator bool(); }
|
explicit operator bool() const { return m_compBuf.operator bool(); }
|
||||||
atUint64 readUBytesToBuf(void* buf, atUint64 len) override {
|
atUint64 readUBytesToBuf(void* buf, atUint64 len) override {
|
||||||
m_zstrm.next_out = (Bytef*)buf;
|
m_zstrm.next_out = (Bytef*)buf;
|
||||||
m_zstrm.avail_out = len;
|
m_zstrm.avail_out = len;
|
||||||
|
|
Loading…
Reference in New Issue