Clean up signal.h a little

This commit is contained in:
Thomas Goyne 2013-06-30 15:51:51 -07:00
parent 7473fb1af6
commit 098ffd0a92

View file

@ -63,15 +63,14 @@ public:
/// automatically closed when all Connection objects referring to it are /// automatically closed when all Connection objects referring to it are
/// gone. To temporarily enable or disable a connection, use Block/Unblock /// gone. To temporarily enable or disable a connection, use Block/Unblock
/// instead /// instead
void Disconnect() { if (token.get()) token->Disconnect(); } void Disconnect() { if (token) token->Disconnect(); }
/// @brief Disable this connection until Unblock is called /// @brief Disable this connection until Unblock is called
void Block() { if (token.get()) token->blocked = true; } void Block() { if (token) token->blocked = true; }
/// @brief Reenable this connection after it was disabled by Block /// @brief Reenable this connection after it was disabled by Block
void Unblock() { if (token.get()) token->blocked = false; } void Unblock() { if (token) token->blocked = false; }
}; };
/// @class UnscopedConnection /// @class UnscopedConnection
/// @brief A connection which is not automatically closed /// @brief A connection which is not automatically closed
/// ///
@ -144,9 +143,9 @@ namespace detail {
/// Protected destructor so that we don't need a virtual destructor /// Protected destructor so that we don't need a virtual destructor
~SignalBaseImpl() { ~SignalBaseImpl() {
for (typename SlotMap::iterator cur = slots.begin(); cur != slots.end(); ++cur) { for (auto& slot : slots) {
DisconnectToken(cur->first); DisconnectToken(slot.first);
if (!TokenClaimed(cur->first)) delete cur->first; if (!TokenClaimed(slot.first)) delete slot.first;
} }
} }
public: public: