-
Notifications
You must be signed in to change notification settings - Fork 52
/
PyInt.h
52 lines (45 loc) · 1.54 KB
/
PyInt.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
40
41
42
43
44
45
46
47
48
49
50
51
/*
* File: PyInt.h
* Author: Kent D. Lee
* (c) 2013
* Created on February 12, 2013, 10:13 PM
*
* 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:
* PyInt objects are limited to 32-bit or native ints in the CoCo unlike
* Python which allows arbitrarily large integers in its implementation.
*/
#ifndef PYINT_H
#define PYINT_H
#include "PyCallable.h"
#include <vector>
using namespace std;
class PyInt : public PyObject {
public:
PyInt(int val);
PyInt(const PyInt& orig);
virtual ~PyInt();
PyType* getType();
string toString();
int getVal();
protected:
int val;
virtual PyObject* __add__(vector<PyObject*>* args);
virtual PyObject* __sub__(vector<PyObject*>* args);
virtual PyObject* __mul__(vector<PyObject*>* args);
virtual PyObject* __floordiv__(vector<PyObject*>* args);
virtual PyObject* __truediv__(vector<PyObject*>* args);
virtual PyObject* __eq__(vector<PyObject*>* args);
virtual PyObject* __gt__(vector<PyObject*>* args);
virtual PyObject* __lt__(vector<PyObject*>* args);
virtual PyObject* __ge__(vector<PyObject*>* args);
virtual PyObject* __le__(vector<PyObject*>* args);
virtual PyObject* __float__(vector<PyObject*>* args);
virtual PyObject* __int__(vector<PyObject*>* args);
virtual PyObject* __bool__(vector<PyObject*>* args);
};
#endif /* PYINT_H */