~ubuntu-branches/ubuntu/utopic/gccgo-go/utopic

« back to all changes in this revision

Viewing changes to misc/swig/callback/callback.h

  • Committer: Package Import Robot
  • Author(s): James Page
  • Date: 2014-01-27 09:18:55 UTC
  • Revision ID: package-import@ubuntu.com-20140127091855-zxfshmykfsyyw4b2
Tags: upstream-1.2
ImportĀ upstreamĀ versionĀ 1.2

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
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
};