callback::TempConnect: also allow temporarily disconnecting a callback.
[platform/upstream/libzypp.git] / zypp / Callback.h
index 6596bfe..a9c84c2 100644 (file)
@@ -226,6 +226,7 @@ namespace zypp
      * to the ctor. The ReceiveReport is connected, a previously
      * connected ReceiveReport is remembered and re-connected in
      * the dtor.
+     * Use the default ctpr to temporarily disconnect any connected report.
      * \code
      *  struct FooReceive : public callback::ReceiveReport<Foo>
      *  {..};
@@ -250,6 +251,12 @@ namespace zypp
         typedef ReceiveReport<_Report>    Receiver;
         typedef DistributeReport<_Report> Distributor;
 
+        TempConnect()
+        : _oldRec( Distributor::instance().getReceiver() )
+        {
+          Distributor::instance().noReceiver();
+        }
+
         TempConnect( Receiver & rec_r )
         : _oldRec( Distributor::instance().getReceiver() )
         {