forked from Distributive-Network/PythonMonkey
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathIntType.hh
More file actions
48 lines (39 loc) · 1.05 KB
/
IntType.hh
File metadata and controls
48 lines (39 loc) · 1.05 KB
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
/**
* @file IntType.hh
* @author Caleb Aikens (caleb@distributive.network) & Giovanni Tedesco (giovanni@distributive.network) & Tom Tang (xmader@distributive.network)
* @brief Struct for representing python ints
* @version 0.2
* @date 2023-03-16
*
* @copyright Copyright (c) 2023
*
*/
#ifndef PythonMonkey_IntType_
#define PythonMonkey_IntType_
#include "PyType.hh"
#include "TypeEnum.hh"
#include <jsapi.h>
#include <Python.h>
/**
* @brief This struct represents the 'int' type (arbitrary-precision) in Python. It inherits from the PyType struct
*/
struct IntType : public PyType {
public:
IntType(PyObject *object);
IntType(long n);
/**
* @brief Construct a new IntType object from a JS::BigInt.
*
* @param cx - javascript context pointer
* @param bigint - JS::BigInt pointer
*/
IntType(JSContext *cx, JS::BigInt *bigint);
const TYPE returnType = TYPE::INT;
/**
* @brief Convert the IntType object to a JS::BigInt
*
* @param cx - javascript context pointer
*/
JS::BigInt *toJsBigInt(JSContext *cx);
};
#endif