mirror of https://github.com/AxioDL/amuse.git
General: Make operator bool() instances explicit
Prevents error-prone implicit conversions to bool.
This commit is contained in:
parent
0be0ca2911
commit
7600f8ad27
|
@ -26,7 +26,7 @@ protected:
|
||||||
|
|
||||||
public:
|
public:
|
||||||
SystemString getSampleBasePath(SampleId sfxId) const;
|
SystemString getSampleBasePath(SampleId sfxId) const;
|
||||||
operator bool() const { return m_valid; }
|
explicit operator bool() const { return m_valid; }
|
||||||
AudioGroup() = default;
|
AudioGroup() = default;
|
||||||
explicit AudioGroup(const AudioGroupData& data) { assign(data); }
|
explicit AudioGroup(const AudioGroupData& data) { assign(data); }
|
||||||
explicit AudioGroup(SystemStringView groupPath) { assign(groupPath); }
|
explicit AudioGroup(SystemStringView groupPath) { assign(groupPath); }
|
||||||
|
|
|
@ -89,7 +89,9 @@ public:
|
||||||
size_t getSdirSize() const { return m_sdirSz; }
|
size_t getSdirSize() const { return m_sdirSz; }
|
||||||
size_t getSampSize() const { return m_sampSz; }
|
size_t getSampSize() const { return m_sampSz; }
|
||||||
|
|
||||||
operator bool() const { return m_proj != nullptr && m_pool != nullptr && m_sdir != nullptr && m_samp != nullptr; }
|
explicit operator bool() const {
|
||||||
|
return m_proj != nullptr && m_pool != nullptr && m_sdir != nullptr && m_samp != nullptr;
|
||||||
|
}
|
||||||
|
|
||||||
DataFormat getDataFormat() const { return m_fmt; }
|
DataFormat getDataFormat() const { return m_fmt; }
|
||||||
bool getAbsoluteProjOffsets() const { return m_absOffs; }
|
bool getAbsoluteProjOffsets() const { return m_absOffs; }
|
||||||
|
|
|
@ -216,7 +216,7 @@ public:
|
||||||
bool operator!=(const ObjTokenBase& other) const noexcept { return !operator==(other); }
|
bool operator!=(const ObjTokenBase& other) const noexcept { return !operator==(other); }
|
||||||
bool operator<(const ObjTokenBase& other) const noexcept { return m_obj < other.m_obj; }
|
bool operator<(const ObjTokenBase& other) const noexcept { return m_obj < other.m_obj; }
|
||||||
bool operator>(const ObjTokenBase& other) const noexcept { return m_obj > other.m_obj; }
|
bool operator>(const ObjTokenBase& other) const noexcept { return m_obj > other.m_obj; }
|
||||||
operator bool() const noexcept { return m_obj != nullptr; }
|
explicit operator bool() const noexcept { return m_obj != nullptr; }
|
||||||
void reset() noexcept {
|
void reset() noexcept {
|
||||||
if (m_obj) {
|
if (m_obj) {
|
||||||
m_obj->decrement();
|
m_obj->decrement();
|
||||||
|
|
|
@ -48,7 +48,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(); }
|
||||||
|
|
|
@ -51,7 +51,7 @@ class Sequencer : public Entity {
|
||||||
~ChannelState();
|
~ChannelState();
|
||||||
ChannelState() = default;
|
ChannelState() = default;
|
||||||
ChannelState(Sequencer& parent, uint8_t chanId);
|
ChannelState(Sequencer& parent, uint8_t chanId);
|
||||||
operator bool() const { return m_parent != nullptr; }
|
explicit operator bool() const { return m_parent != nullptr; }
|
||||||
|
|
||||||
/** Voices corresponding to currently-pressed keys in channel */
|
/** Voices corresponding to currently-pressed keys in channel */
|
||||||
std::unordered_map<uint8_t, ObjToken<Voice>> m_chanVoxs;
|
std::unordered_map<uint8_t, ObjToken<Voice>> m_chanVoxs;
|
||||||
|
|
|
@ -94,7 +94,7 @@ class SongState {
|
||||||
|
|
||||||
Track() = default;
|
Track() = default;
|
||||||
Track(SongState& parent, uint8_t midiChan, uint32_t loopStart, const TrackRegion* regions, uint32_t tempo);
|
Track(SongState& parent, uint8_t midiChan, uint32_t loopStart, const TrackRegion* regions, uint32_t tempo);
|
||||||
operator bool() const { return m_parent != nullptr; }
|
explicit operator bool() const { return m_parent != nullptr; }
|
||||||
void setRegion(const TrackRegion* region);
|
void setRegion(const TrackRegion* region);
|
||||||
void advanceRegion();
|
void advanceRegion();
|
||||||
bool advance(Sequencer& seq, double dt);
|
bool advance(Sequencer& seq, double dt);
|
||||||
|
|
|
@ -78,7 +78,7 @@ struct SoundMacroState {
|
||||||
float evaluate(double time, const Voice& vox, const SoundMacroState& st) const;
|
float evaluate(double time, const Voice& vox, const SoundMacroState& st) const;
|
||||||
|
|
||||||
/** Determine if able to use */
|
/** Determine if able to use */
|
||||||
operator bool() const { return m_comps.size() != 0; }
|
explicit operator bool() const { return m_comps.size() != 0; }
|
||||||
};
|
};
|
||||||
|
|
||||||
Evaluator m_volumeSel;
|
Evaluator m_volumeSel;
|
||||||
|
|
Loading…
Reference in New Issue