| 121 | }; |
| 122 | |
| 123 | class Object |
| 124 | { |
| 125 | public: |
| 126 | // Alias |
| 127 | using PythonObject = std::variant< |
| 128 | std::string, |
| 129 | bool, |
| 130 | long, |
| 131 | double, |
| 132 | TupleObject, |
| 133 | ListObject, |
| 134 | DictObject, |
| 135 | LongObject, |
| 136 | NoneObject, |
| 137 | GenericObject>; |
| 138 | |
| 139 | // Enums |
| 140 | enum class ObjectType { |
| 141 | BYTES, |
| 142 | STRING, |
| 143 | NONE, |
| 144 | INT_BOOL, |
| 145 | LONG_BOOL, |
| 146 | INT, |
| 147 | LONG, |
| 148 | FLOAT, |
| 149 | TUPLE, |
| 150 | LIST, |
| 151 | DICT, |
| 152 | CODE, |
| 153 | OTHER |
| 154 | }; |
| 155 | |
| 156 | static constexpr int MAX_LOCAL_STR_SIZE = 80; |
| 157 | |
| 158 | // Constructors |
| 159 | Object(const std::shared_ptr<const AbstractProcessManager>& manager, remote_addr_t addr); |
| 160 | |
| 161 | // Methods |
| 162 | ObjectType objectType() const; |
| 163 | PythonObject toConcreteObject() const; |
| 164 | bool hasFlags(unsigned long flags) const; |
| 165 | std::string toString(ssize_t max_size = MAX_LOCAL_STR_SIZE) const; |
| 166 | remote_addr_t typeAddr() const; |
| 167 | |
| 168 | private: |
| 169 | // Data members |
| 170 | remote_addr_t d_addr; |
| 171 | remote_addr_t d_type_addr; |
| 172 | std::string d_classname{}; |
| 173 | unsigned long d_flags{}; |
| 174 | std::shared_ptr<const AbstractProcessManager> d_manager{nullptr}; |
| 175 | |
| 176 | // Methods |
| 177 | bool toBool() const; |
| 178 | long toInteger() const; |
| 179 | double toFloat() const; |
| 180 | std::string guessClassName(Structure<py_type_v>& type) const; |
no outgoing calls
no test coverage detected