2017-03-04 02:04:16 +00:00
|
|
|
#ifndef ARRAY_H
|
|
|
|
#define ARRAY_H
|
|
|
|
|
2017-10-03 10:37:34 +00:00
|
|
|
#include <gdnative/array.h>
|
2017-03-04 02:04:16 +00:00
|
|
|
|
2018-03-07 10:27:34 +00:00
|
|
|
#include "Defs.hpp"
|
2017-03-06 07:49:24 +00:00
|
|
|
#include "String.hpp"
|
2017-03-04 02:04:16 +00:00
|
|
|
|
|
|
|
namespace godot {
|
|
|
|
|
2017-03-06 02:30:46 +00:00
|
|
|
class Variant;
|
|
|
|
class PoolByteArray;
|
|
|
|
class PoolIntArray;
|
|
|
|
class PoolRealArray;
|
|
|
|
class PoolStringArray;
|
|
|
|
class PoolVector2Array;
|
|
|
|
class PoolVector3Array;
|
|
|
|
class PoolColorArray;
|
|
|
|
|
|
|
|
class Object;
|
|
|
|
|
2017-07-23 15:53:50 +00:00
|
|
|
class Array {
|
2017-03-04 02:04:16 +00:00
|
|
|
godot_array _godot_array;
|
2018-11-23 22:09:41 +00:00
|
|
|
|
2017-03-04 02:04:16 +00:00
|
|
|
public:
|
2017-03-06 02:30:46 +00:00
|
|
|
Array();
|
2018-11-23 22:09:41 +00:00
|
|
|
Array(const Array &other);
|
|
|
|
Array &operator=(const Array &other);
|
2017-03-06 02:30:46 +00:00
|
|
|
|
2018-11-23 22:09:41 +00:00
|
|
|
Array(const PoolByteArray &a);
|
2017-03-06 02:30:46 +00:00
|
|
|
|
2018-11-23 22:09:41 +00:00
|
|
|
Array(const PoolIntArray &a);
|
2017-03-06 02:30:46 +00:00
|
|
|
|
2018-11-23 22:09:41 +00:00
|
|
|
Array(const PoolRealArray &a);
|
2017-03-06 02:30:46 +00:00
|
|
|
|
2018-11-23 22:09:41 +00:00
|
|
|
Array(const PoolStringArray &a);
|
2017-03-06 02:30:46 +00:00
|
|
|
|
2018-11-23 22:09:41 +00:00
|
|
|
Array(const PoolVector2Array &a);
|
2017-03-06 02:30:46 +00:00
|
|
|
|
2018-11-23 22:09:41 +00:00
|
|
|
Array(const PoolVector3Array &a);
|
2017-03-06 02:30:46 +00:00
|
|
|
|
2018-11-23 22:09:41 +00:00
|
|
|
Array(const PoolColorArray &a);
|
2017-03-06 02:30:46 +00:00
|
|
|
|
2018-03-07 10:27:34 +00:00
|
|
|
template <class... Args>
|
|
|
|
static Array make(Args... args) {
|
|
|
|
return helpers::append_all(Array(), args...);
|
|
|
|
}
|
|
|
|
|
2018-11-23 22:09:41 +00:00
|
|
|
Variant &operator[](const int idx);
|
2017-03-06 02:30:46 +00:00
|
|
|
|
2018-11-23 22:09:41 +00:00
|
|
|
Variant operator[](const int idx) const;
|
2017-03-06 02:30:46 +00:00
|
|
|
|
2018-11-23 22:09:41 +00:00
|
|
|
void append(const Variant &v);
|
2017-03-06 02:30:46 +00:00
|
|
|
|
|
|
|
void clear();
|
|
|
|
|
2018-11-23 22:09:41 +00:00
|
|
|
int count(const Variant &v);
|
2017-03-06 02:30:46 +00:00
|
|
|
|
|
|
|
bool empty() const;
|
|
|
|
|
2018-11-23 22:09:41 +00:00
|
|
|
void erase(const Variant &v);
|
2017-03-06 02:30:46 +00:00
|
|
|
|
|
|
|
Variant front() const;
|
|
|
|
|
|
|
|
Variant back() const;
|
|
|
|
|
2018-11-23 22:09:41 +00:00
|
|
|
int find(const Variant &what, const int from = 0);
|
2017-03-06 02:30:46 +00:00
|
|
|
|
2018-11-23 22:09:41 +00:00
|
|
|
int find_last(const Variant &what);
|
2017-03-06 02:30:46 +00:00
|
|
|
|
2018-11-23 22:09:41 +00:00
|
|
|
bool has(const Variant &what) const;
|
2017-03-06 02:30:46 +00:00
|
|
|
|
|
|
|
uint32_t hash() const;
|
|
|
|
|
2018-11-23 22:09:41 +00:00
|
|
|
void insert(const int pos, const Variant &value);
|
2017-03-06 02:30:46 +00:00
|
|
|
|
|
|
|
void invert();
|
|
|
|
|
|
|
|
bool is_shared() const;
|
|
|
|
|
|
|
|
Variant pop_back();
|
|
|
|
|
|
|
|
Variant pop_front();
|
|
|
|
|
2018-11-23 22:09:41 +00:00
|
|
|
void push_back(const Variant &v);
|
2017-03-06 02:30:46 +00:00
|
|
|
|
2018-11-23 22:09:41 +00:00
|
|
|
void push_front(const Variant &v);
|
2017-03-06 02:30:46 +00:00
|
|
|
|
|
|
|
void remove(const int idx);
|
|
|
|
|
|
|
|
int size() const;
|
|
|
|
|
|
|
|
void resize(const int size);
|
|
|
|
|
2018-11-23 22:09:41 +00:00
|
|
|
int rfind(const Variant &what, const int from = -1);
|
2017-03-06 02:30:46 +00:00
|
|
|
|
|
|
|
void sort();
|
|
|
|
|
2018-11-23 22:09:41 +00:00
|
|
|
void sort_custom(Object *obj, const String &func);
|
2017-03-04 02:04:16 +00:00
|
|
|
|
2017-03-06 02:30:46 +00:00
|
|
|
~Array();
|
2017-03-04 02:04:16 +00:00
|
|
|
};
|
|
|
|
|
2018-11-23 22:09:41 +00:00
|
|
|
} // namespace godot
|
2017-03-04 02:04:16 +00:00
|
|
|
|
|
|
|
#endif // ARRAY_H
|