-
Notifications
You must be signed in to change notification settings - Fork 52
/
Copy pathPyBuiltInLen.h
40 lines (34 loc) · 1.05 KB
/
PyBuiltInLen.h
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
/*
* File: PyBuiltInLen.h
* Author: Kent D. Lee
* (c) 2013
* Created on February 28, 2013, 10:57 AM
*
* License:
* Please read the LICENSE file in this distribution for details regarding
* the licensing of this code. This code is freely available for educational
* use. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND.
*
* Description:
* This is the built-in len function. It is called on a sequence of some sort.
* The len function calls the __len__ attribute (i.e. method) of the type of
* its argument. In this way the type controls the behavior of the len
* built-in function.
*/
#ifndef PYBUILTINLEN_H
#define PYBUILTINLEN_H
#include "PyCallable.h"
#include "PyType.h"
class PyBuiltInLen : public PyCallable {
public:
PyBuiltInLen();
PyBuiltInLen(const PyBuiltInLen& orig);
virtual ~PyBuiltInLen();
PyType* getType();
bool allowableArgCount(int count);
string callName();
string toString();
protected:
virtual PyObject* __call__(vector<PyObject*>* args);
};
#endif /* PYBUILTINLEN_H */