prefer more readable bool operator spelling

especially the '!' for negation is sometimes too terse
and easily overlooked.
This commit is contained in:
Fischlurch 2015-09-25 02:38:59 +02:00
parent 7b7d12d99e
commit 08e7e3df15
36 changed files with 80 additions and 82 deletions

View file

@ -244,7 +244,7 @@ namespace advice {
inline bool
operator!= (Binding const& b1, Binding const& b2)
{
return ! (b1 == b2);
return not (b1 == b2);
}

View file

@ -237,7 +237,7 @@ namespace lumiera {
operator unspecified_bool_type() const // never throws
{ return isValid()? &_ThisType::instance_ : 0; }
bool operator! () const { return !isValid(); }
bool operator! () const { return not isValid(); }
private:

View file

@ -212,7 +212,7 @@ namespace lumiera {
inline bool
operator!= (Goal::QueryID const& id1, Goal::QueryID const& id2)
{
return ! (id1 == id2);
return not (id1 == id2);
}

View file

@ -133,7 +133,7 @@ namespace panel{
Panel::is_locked() const
{
REQUIRE(dockItem_.gobj() != NULL);
return !GDL_DOCK_ITEM_NOT_LOCKED(dockItem_.gobj());
return not GDL_DOCK_ITEM_NOT_LOCKED(dockItem_.gobj());
}
workspace::PanelManager&

View file

@ -87,7 +87,7 @@ namespace lib {
ValidityCheck isValid (&T::isValid);
T const& obj = static_cast<T const&> (*this);
return !(obj.*isValid)();
return not (obj.*isValid)();
}

View file

@ -271,7 +271,7 @@ namespace diff{
bool
isNamed() const
{
return !util::startsWith (idi.getSym(), "_CHILD_");
return not util::startsWith (idi.getSym(), "_CHILD_");
}
template<typename X>
@ -320,7 +320,7 @@ namespace diff{
friend bool
operator!= (GenNode const& n1, GenNode const& n2)
{
return ! (n1 == n2);
return not (n1 == n2);
}
@ -439,7 +439,7 @@ namespace diff{
friend bool
checkPoint (ScopeExplorer const& explorer)
{
return !explorer.scopes_.empty()
return not explorer.scopes_.empty()
&& bool(explorer.scopes_.back());
}
@ -462,8 +462,8 @@ namespace diff{
friend bool
operator== (ScopeExplorer const& s1, ScopeExplorer const& s2)
{
return !s1.scopes_.empty()
&& !s2.scopes_.empty()
return not s1.scopes_.empty()
&& not s2.scopes_.empty()
&& s1.scopes_.size() == s2.scopes_.size()
&& yield(s1) == yield(s2);
}

View file

@ -335,14 +335,14 @@ namespace diff{
operator== (Record const& r1, Record const& r2)
{
return r1.type_ == r2.type_
&& r1.attribs_ == r2.attribs_
&& r1.children_ == r2.children_;
and r1.attribs_ == r2.attribs_
and r1.children_ == r2.children_;
}
friend bool
operator!= (Record const& r1, Record const& r2)
{
return ! (r1 == r2);
return not (r1 == r2);
}
};
@ -541,7 +541,7 @@ namespace diff{
bool
empty() const
{
return ! bool(record_);
return not record_;
}
/** target is accessed by cast

View file

@ -195,9 +195,9 @@ namespace util {
friend bool operator== (const char * const, _Fmt const&);
template<typename X>
friend bool operator != (_Fmt const& fmt, X const& x) { return !(fmt == x); }
friend bool operator != (_Fmt const& fmt, X const& x) { return not (fmt == x); }
template<typename X>
friend bool operator != (X const& x, _Fmt const& fmt) { return !(x == fmt); }
friend bool operator != (X const& x, _Fmt const& fmt) { return not (x == fmt); }
};

View file

@ -110,7 +110,7 @@ namespace lib {
operator HashVal() const { return lumiera_uid_hash (get()); }
bool operator== (LuidH const& o) const { return lumiera_uid_eq (get(), o.get()); }
bool operator!= (LuidH const& o) const { return !operator== (o); }
bool operator!= (LuidH const& o) const { return not operator== (o); }
/** for passing to C APIs */
LUID get() const { return const_cast<LUID> (&luid_);}

View file

@ -196,7 +196,7 @@ namespace lib {
bool
empty () const
{
return !isValid();
return not isValid();
}
@ -214,7 +214,7 @@ namespace lib {
bool operator== (PtrDerefIter<I1> const& il, PtrDerefIter<I2> const& ir) { return il.getBase() == ir.getBase(); }
template<class I1, class I2>
bool operator!= (PtrDerefIter<I1> const& il, PtrDerefIter<I2> const& ir) { return !(il == ir); }
bool operator!= (PtrDerefIter<I1> const& il, PtrDerefIter<I2> const& ir) { return not (il == ir); }
@ -305,7 +305,7 @@ namespace lib {
bool
empty () const
{
return !isValid();
return not isValid();
}
@ -323,7 +323,7 @@ namespace lib {
bool operator== (AddressExposingIter<I1> const& il, AddressExposingIter<I2> const& ir) { return il.getBase() == ir.getBase(); }
template<class I1, class I2>
bool operator!= (AddressExposingIter<I1> const& il, AddressExposingIter<I2> const& ir) { return !(il == ir); }
bool operator!= (AddressExposingIter<I1> const& il, AddressExposingIter<I2> const& ir) { return not (il == ir); }

View file

@ -495,7 +495,7 @@ namespace iter_stl {
bool
empty () const
{
return !isValid();
return not isValid();
}
@ -511,7 +511,7 @@ namespace iter_stl {
friend bool
operator!= (IterSnapshot const& snap1, IterSnapshot const& snap2)
{
return ! (snap1 == snap2);
return not (snap1 == snap2);
}

View file

@ -213,7 +213,7 @@ namespace lib {
bool
empty () const
{
return !isValid();
return not isValid();
}
@ -247,7 +247,7 @@ namespace lib {
void
_maybe_throw() const
{
if (!isValid())
if (not isValid())
_throwIterExhausted();
}
@ -346,7 +346,7 @@ namespace lib {
bool
empty () const
{
return !isValid();
return not isValid();
}
protected:
@ -362,7 +362,7 @@ namespace lib {
void
__throw_if_empty() const
{
if (!isValid())
if (not isValid())
_throwIterExhausted();
}
@ -388,7 +388,7 @@ namespace lib {
template<class T1, class T2, class ST>
bool operator!= (IterStateWrapper<T1,ST> const& il, IterStateWrapper<T2,ST> const& ir)
{
return ! (il == ir);
return not (il == ir);
}
@ -473,7 +473,7 @@ namespace lib {
bool
empty () const
{
return !isValid();
return not isValid();
}
@ -592,7 +592,7 @@ namespace lib {
bool
empty () const
{
return !isValid();
return not isValid();
}
@ -610,7 +610,7 @@ namespace lib {
bool operator== (ConstIter<I1> const& il, ConstIter<I2> const& ir) { return il.getBase() == ir.getBase(); }
template<class I1, class I2>
bool operator!= (ConstIter<I1> const& il, ConstIter<I2> const& ir) { return !(il == ir); }
bool operator!= (ConstIter<I1> const& il, ConstIter<I2> const& ir) { return not (il == ir); }

View file

@ -83,20 +83,20 @@ namespace lib {
friend bool
checkPoint (IterDequeStorage const& elements)
{
return !elements.empty();
return not elements.empty();
}
friend TY &
yield (IterDequeStorage const& elements)
{
REQUIRE (!elements.empty());
REQUIRE (not elements.empty());
return unConst(elements).back();
}
friend void
iterNext (IterDequeStorage & elements)
{
REQUIRE (!elements.empty());
REQUIRE (not elements.empty());
elements.pop_back();
}
};

View file

@ -226,7 +226,7 @@ namespace lib {
bool
empty () const
{
return !isValid();
return not isValid();
}
};
@ -245,7 +245,7 @@ namespace lib {
inline bool
operator!= (IterTool<CX> const& ito1, IterTool<CX> const& ito2)
{
return !(ito1 == ito2);
return not (ito1 == ito2);
}

View file

@ -99,7 +99,7 @@ namespace meta{
friend bool
operator!= (FunErasure const& fer1, FunErasure const& fer2)
{
return !(fer1==fer2); // use equality defined by FH
return not (fer1==fer2); // use equality defined by FH
}
};

View file

@ -556,7 +556,7 @@ namespace lib {
friend bool
operator!= (PolymorphicValue const& v1, PolymorphicValue const& v2)
{
return ! (v1 == v2);
return not (v1 == v2);
}
};

View file

@ -233,7 +233,7 @@ namespace lib {
return created_? &_ThisType::created_ : 0;
}
bool operator! () const { return !created_; }
bool operator! () const { return not created_; }
friend void

View file

@ -38,11 +38,11 @@ namespace util {
using std::function;
typedef function<bool(string::value_type)> ChPredicate;
ChPredicate operator! (ChPredicate p) { return ! bind(p,_1); }
ChPredicate operator! (ChPredicate p) { return not bind(p,_1); }
// character classes used for sanitising a string
ChPredicate isValid (is_alnum() || is_any_of("-_.:+$'()@")); ///< characters to be retained
ChPredicate isPunct (is_space() || is_any_of(",;#*~´`?\\=/&%![]{}")); ///< punctuation to be replaced by '_'
ChPredicate isValid (is_alnum() or is_any_of("-_.:+$'()@")); ///< characters to be retained
ChPredicate isPunct (is_space() or is_any_of(",;#*~´`?\\=/&%![]{}")); ///< punctuation to be replaced by '_'
string

View file

@ -326,7 +326,7 @@ namespace wrapper {
inline bool
operator!= (ItemWrapper<TY> const& w1, ItemWrapper<TY> const& w2)
{
return !(w1 == w2);
return not (w1 == w2);
}

View file

@ -97,9 +97,9 @@ namespace asset {
bool
Asset::Ident::isValid() const
{
return !isnil (name)
&& !isnil (org)
&& version <= 1000000;
return not isnil (name)
and not isnil (org)
and version <= 1000000;
}
@ -124,7 +124,7 @@ namespace asset {
Asset::isActive () const
{
return this->enabled
&& all_parents_enabled (parents);
and all_parents_enabled (parents);
}
@ -140,7 +140,7 @@ namespace asset {
{
if (on == this->enabled)
return true;
if (on && !all_parents_enabled (parents))
if (on and not all_parents_enabled (parents))
return false;
// can indeed to do the toggle...

View file

@ -273,7 +273,7 @@ namespace control {
friend bool
operator!= (ArgumentHolder const& a1, ArgumentHolder const& a2)
{
return ! (a1 == a2);
return not (a1 == a2);
}
};

View file

@ -289,7 +289,7 @@ namespace control {
/// Supporting equality comparisons...
friend bool operator== (Closure const& c1, Closure const& c2) { return compare (c1.params_, c2.params_); }
friend bool operator!= (Closure const& c1, Closure const& c2) { return ! (c1 == c2); }
friend bool operator!= (Closure const& c1, Closure const& c2) { return not (c1 == c2); }
bool
equals (CmdClosure const& other) const

View file

@ -230,7 +230,7 @@ namespace control {
friend bool
operator!= (CommandImpl const& ci1, CommandImpl const& ci2)
{
return !(ci1==ci2);
return not (ci1==ci2);
}
};

View file

@ -104,7 +104,7 @@ namespace control {
friend bool
operator!= (Mutation const& m1, Mutation const& m2)
{
return !(m1==m2);
return not (m1==m2);
}
};

View file

@ -261,7 +261,7 @@ namespace control {
inline bool
operator!= (Command const& c1, Command const& c2)
{
return ! (c1 == c2);
return not (c1 == c2);
}
/** allow for sets and associative containers */

View file

@ -178,7 +178,7 @@ namespace engine {
friend bool
checkPoint (JobPlanning const& plan)
{
return !isnil (plan.plannedOperations_);
return not isnil (plan.plannedOperations_);
}
friend JobPlanning&
@ -302,8 +302,8 @@ namespace engine {
bool canContinue (FrameCoord const& location)
{
return !isEndOfChunk (location.absoluteFrameNumber,
location.modelPort);
return not isEndOfChunk (location.absoluteFrameNumber,
location.modelPort);
}
protected:

View file

@ -194,11 +194,9 @@ namespace engine {
static bool
is_in_sane_state (Block const& block)
{
return !block.was_used()
|| block.was_closed();
return not block.was_used() or block.was_closed();
}
};
}

View file

@ -148,7 +148,7 @@ namespace engine {
isValid() const
{
return bool(createAttached)
&& bool(destroyAttached);
and bool(destroyAttached);
}
friend HashVal
@ -166,7 +166,7 @@ namespace engine {
friend bool
operator== (TypeHandler const& left, TypeHandler const& right)
{
return (!left.isValid() && !right.isValid())
return (not left.isValid() and not right.isValid())
|| ( util::rawComparison(left.createAttached, right.createAttached)
&& util::rawComparison(left.destroyAttached, right.destroyAttached)
);
@ -174,7 +174,7 @@ namespace engine {
friend bool
operator!= (TypeHandler const& left, TypeHandler const& right)
{
return !(left == right);
return not (left == right);
}
};

View file

@ -311,8 +311,8 @@ namespace mobject {
bool
operator!= (MORef<MOX> const& oRef) const
{
return !isValid()
|| oRef != this->pRef_;
return not isValid()
or oRef != this->pRef_;
}
template<class MOX>
@ -320,15 +320,15 @@ namespace mobject {
operator== (MORef const& oRef, PlacementRef<MOX> const& pRef)
{
return oRef.isValid()
&& oRef.pRef_ == pRef;
and oRef.pRef_ == pRef;
}
template<class MOX>
friend bool
operator!= (MORef const& oRef, PlacementRef<MOX> const& pRef)
{
return !oRef.isValid()
|| oRef.pRef_ != pRef;
return not oRef.isValid()
or oRef.pRef_ != pRef;
}
template<class MOX>
@ -336,29 +336,29 @@ namespace mobject {
operator== (PlacementRef<MOX> const& pRef, MORef const& oRef)
{
return oRef.isValid()
&& pRef == oRef.pRef_;
and pRef == oRef.pRef_;
}
template<class MOX>
friend bool
operator!= (PlacementRef<MOX> const& pRef, MORef const& oRef)
{
return !oRef.isValid()
|| pRef != oRef.pRef_;
return not oRef.isValid()
or pRef != oRef.pRef_;
}
bool
operator== (PlacementMO::ID const& pID) const
{
return isValid()
&& PlacementMO::ID (pRef_) == pID;
and PlacementMO::ID (pRef_) == pID;
}
bool
operator!= (PlacementMO::ID const& pID) const
{
return !isValid()
|| PlacementMO::ID (pRef_) != pID;
return not isValid()
or PlacementMO::ID (pRef_) != pID;
}
};

View file

@ -55,7 +55,7 @@ namespace session {
Clip::isValid () const
{
TODO ("check consistency of clip length def, implies accessing the underlying media def");
return !isnil(length_);
return not isnil(length_);
}

View file

@ -35,7 +35,7 @@ namespace session {
bool
Label::isValid() const
{
return !isnil (typeID_);
return not isnil (typeID_);
}

View file

@ -169,7 +169,7 @@ namespace session {
bool
LocatingPin::LocatingSolution::still_to_solve ()
{
return !(is_definite() || is_impossible());
return not (is_definite() or is_impossible());
}

View file

@ -216,7 +216,7 @@ namespace session {
inline bool
operator!= (ScopePath const& path1, ScopePath const& path2)
{
return !(path1 == path2);
return not (path1 == path2);
}

View file

@ -56,7 +56,7 @@ namespace play {
bool
OutputSlot::isFree() const
{
return ! this->state_;
return not this->state_;
}
@ -77,7 +77,7 @@ namespace play {
OutputSlot::Allocation&
OutputSlot::allocate()
{
if (!isFree())
if (not isFree())
throw error::Logic ("Attempt to open/allocate an OutputSlot already in use.");
state_.reset (this->buildState());
@ -88,7 +88,7 @@ namespace play {
void
OutputSlot::disconnect()
{
if (!isFree())
if (not isFree())
state_.reset(0);
}

View file

@ -124,7 +124,7 @@ namespace play {
bool
isActive() const
{
return ! and_all (processes_, isDead);
return not and_all (processes_, isDead);
}
private:

View file

@ -125,7 +125,7 @@ namespace test {
virtual bool
empty() const
{
return !bool(access());
return not access();
}