forked from Distributive-Network/PythonMonkey
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathTupleType.hh
More file actions
65 lines (55 loc) · 1.24 KB
/
Copy pathTupleType.hh
File metadata and controls
65 lines (55 loc) · 1.24 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
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
/**
* @file TupleType.hh
* @author Giovanni Tedesco (giovanni@distributive.network)
* @brief Struct for representing python tuples
* @version 0.1
* @date 2022-08-19
*
* @copyright Copyright (c) 2022
*
*/
#ifndef PythonMonkey_TupleType_
#define PythonMonkey_TupleType_
#include "include/PyType.hh"
#include "include/TypeEnum.hh"
#include <Python.h>
#include <iostream>
/**
* @brief A struct to represent the tuple type in python
*
*/
struct TupleType : public PyType {
public:
TupleType(PyObject *obj);
const TYPE returnType = TYPE::TUPLE;
/**
* @brief Gets the tuple item at the given index
*
* @param index The index of the item in question
* @return PyType* Returns a pointer to the appropriate PyType object
*/
PyType *get(int index) const;
/**
* @brief
*
*
*
* @returns int length of the tuple
*/
int len() const;
/**
* @brief Helper function for print()
*
* @param os output stream to print to
* @param depth depth into sub-objects
*/
void print_helper(std::ostream &os, int depth = 0) const;
protected:
/**
* @brief Override to the print method defined in PyType to enable us to print this struct easily
*
* @param os output stream to print to
*/
virtual void print(std::ostream &os) const override;
};
#endif