File: PWOCallable.h

package info (click to toggle)
metakit 2.4.3-3
  • links: PTS
  • area: main
  • in suites: woody
  • size: 6,468 kB
  • ctags: 3,548
  • sloc: xml: 29,455; cpp: 23,339; sh: 9,051; tcl: 1,195; python: 577; makefile: 254; ansic: 14
file content (40 lines) | stat: -rw-r--r-- 979 bytes parent folder | download | duplicates (2)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
/******************************************** 
  copyright 2000 McMillan Enterprises, Inc.
  www.mcmillan-inc.com
*********************************************/
#if !defined(PWOCALLABLE_H_INCLUDED_)
#define PWOCALLABLE_H_INCLUDED_

#include "PWOBase.h"
#include "PWOSequence.h"
#include "PWOMapping.h"

class PWOCallable : public PWOBase
{
public:
  PWOCallable() : PWOBase() {};
  PWOCallable(PyObject *obj) : PWOBase(obj) {
    _violentTypeCheck();
  };
  virtual ~PWOCallable() {};
  virtual PWOCallable& operator=(const PWOCallable& other) {
    GrabRef(other);
    return *this;
  };
  PWOCallable& operator=(const PWOBase& other) {
    GrabRef(other);
    _violentTypeCheck();
    return *this;
  };
  virtual void _violentTypeCheck() {
    if (!isCallable()) {
      GrabRef(0);
      Fail(PyExc_TypeError, "Not a callable object");
    }
  };
  PWOBase call() const;
  PWOBase call(PWOTuple& args) const;
  PWOBase call(PWOTuple& args, PWOMapping& kws) const;
};

#endif