Text file misc/swig/callback/callback.h

     1  // Copyright 2011 The Go Authors. All rights reserved.
     2  // Use of this source code is governed by a BSD-style
     3  // license that can be found in the LICENSE file.
     4  
     5  class Callback {
     6  public:
     7  	virtual ~Callback() { }
     8  	virtual std::string run() { return "Callback::run"; }
     9  };
    10  
    11  class Caller {
    12  private:
    13  	Callback *callback_;
    14  public:
    15  	Caller(): callback_(0) { }
    16  	~Caller() { delCallback(); }
    17  	void delCallback() { delete callback_; callback_ = 0; }
    18  	void setCallback(Callback *cb) { delCallback(); callback_ = cb; }
    19  	std::string call();
    20  };
    21  

View as plain text