Advertisement
Guest User

Untitled

a guest
Jun 28th, 2019
111
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. struct TChangeBlock
  2. {
  3.     TChangeBlock( TBase & base ):
  4.         base( &base),
  5.         previousState( base.isChangeBlocked() )
  6.     {
  7.         base.setChangeBlock( true );
  8.     }
  9.  
  10.     ~TChangeBlock()
  11.     {
  12.         base->setChangeBlock( previousState );
  13.     }
  14.  
  15. private:
  16.     TChangeBlock( const TChangeBlock & );
  17.     TChangeBlock & operator = ( const TChangeBlock & );
  18.  
  19.     TBase * base;
  20.     bool previousState;
  21. };
  22.  
  23.  
  24.  
  25.  
  26.  
  27. class TBase(...)
  28. {
  29. ...
  30. public:
  31.     void setChangeBlock(bool block )
  32. {
  33. ...
  34. }
  35. ...
  36. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement