mirror of
https://github.com/Relintai/sfw.git
synced 2025-04-07 17:01:48 +02:00
- Now unicode error printing is disabled by default. Also can be enabled via a macro. 2e41d4dfcda7ff2c35a1326f0de71b0714524f11 - Added to_real helper methods to String. 43b14a071c6ccf7c3062e0568e3d7bb05d8a83d2 - Fix AABB.encloses failing on shared upper bound. 8341ddc450bd160b5cb44eeb0400da2e5a151ed0 - Fix incorrect clipping in String::substr_index(). dcd00dec81a2841ad5244e043379697c68d681f7 - Backported create_reference() helper methods for InputEvents from godot 4. 4cdb1636264d8a6cef0881a37a7fad72ac262f3f - Backported comparison operators to Array from godot4. 7779439e284bf8a0534f606d5c7f929674764941 - Removed Vector2i(Vector2) constructor, added a Vector2i conversion operator to Vector2 instead. This solves ambigous Variant to Vector2i conversion errors. 27b73fa9f9984709b0c8eb77bfeea5cab8d9fee3 - Added exp2 to the Math singleton. e17cc864bc339c1f4d1ce6acd4cabf4a6593c6cc - Add a get_or_add method to Dictionary. 487b454506259c080306098093875ea7bda5b5ad - Add is_zero_approx methods to Vector{2,3} 441bb29fd3bd758ff783e4122e6b2d512dc8529f - Also add is_zero_approx() to Vector4. ed224298e5ae951093b42a004afacbd275e54494 - Transform now uses Basis::create_looking_at. 6f53257e05d72088c28028eb568526f4da146ae0 - Backported from godot4: Add the ability to look-at in model-space. 951ae7b11db0376dd0dbdf080e2f2e3652ac33ed - Fix split_floats behavior when spaces are used as separators 4585110a298487081f026827e3395c4feaf35f9a - Better solution for the previous fix. d75d3591edf13ae0dd6aa989962595aa1280ae73 - Fix the fix. 48935e93b3f5849a52b0e7fc0b6ede36a7b61123
102 lines
2.6 KiB
C++
102 lines
2.6 KiB
C++
//--STRIP
|
|
#ifndef ARRAY_H
|
|
#define ARRAY_H
|
|
//--STRIP
|
|
|
|
/*************************************************************************/
|
|
/* array.h */
|
|
/* From https://github.com/Relintai/pandemonium_engine (MIT) */
|
|
/*************************************************************************/
|
|
|
|
//--STRIP
|
|
#include "core/typedefs.h"
|
|
//--STRIP
|
|
|
|
class Variant;
|
|
class ArrayPrivate;
|
|
class Object;
|
|
class StringName;
|
|
class String;
|
|
|
|
class Array {
|
|
mutable ArrayPrivate *_p;
|
|
void _ref(const Array &p_from) const;
|
|
void _unref() const;
|
|
|
|
inline int _clamp_slice_index(int p_index) const;
|
|
|
|
public:
|
|
Variant &operator[](int p_idx);
|
|
const Variant &operator[](int p_idx) const;
|
|
|
|
void set(int p_idx, const Variant &p_value);
|
|
const Variant &get(int p_idx) const;
|
|
|
|
int size() const;
|
|
bool empty() const;
|
|
void clear();
|
|
|
|
bool deep_equal(const Array &p_array, int p_recursion_count = 0) const;
|
|
bool operator==(const Array &p_array) const;
|
|
|
|
uint32_t hash() const;
|
|
uint32_t recursive_hash(int p_recursion_count) const;
|
|
void operator=(const Array &p_array);
|
|
|
|
void push_back(const Variant &p_value);
|
|
_FORCE_INLINE_ void append(const Variant &p_value) { push_back(p_value); } //for python compatibility
|
|
void append_array(const Array &p_array);
|
|
Error resize(int p_new_size);
|
|
|
|
void insert(int p_pos, const Variant &p_value);
|
|
void remove(int p_pos);
|
|
void fill(const Variant &p_value);
|
|
|
|
Variant front() const;
|
|
Variant back() const;
|
|
|
|
Array &sort();
|
|
Array &sort_custom(Object *p_obj);
|
|
void shuffle();
|
|
int bsearch(const Variant &p_value, bool p_before = true);
|
|
int bsearch_custom(const Variant &p_value, Object *p_obj, const StringName &p_function, bool p_before = true);
|
|
Array &invert();
|
|
|
|
int find(const Variant &p_value, int p_from = 0) const;
|
|
int rfind(const Variant &p_value, int p_from = -1) const;
|
|
int find_last(const Variant &p_value) const;
|
|
int count(const Variant &p_value) const;
|
|
bool has(const Variant &p_value) const;
|
|
|
|
void erase(const Variant &p_value);
|
|
|
|
void push_front(const Variant &p_value);
|
|
Variant pop_back();
|
|
Variant pop_front();
|
|
Variant pop_at(int p_pos);
|
|
|
|
Array duplicate(bool p_deep = false) const;
|
|
|
|
Array slice(int p_begin, int p_end, int p_step = 1, bool p_deep = false) const;
|
|
|
|
Variant min() const;
|
|
Variant max() const;
|
|
|
|
bool operator<(const Array &p_array) const;
|
|
bool operator<=(const Array &p_array) const;
|
|
bool operator>(const Array &p_array) const;
|
|
bool operator>=(const Array &p_array) const;
|
|
|
|
const void *id() const;
|
|
|
|
String sprintf(const String &p_format, bool *error) const;
|
|
|
|
Array(const Array &p_from);
|
|
Array();
|
|
~Array();
|
|
};
|
|
|
|
//--STRIP
|
|
#endif // ARRAY_H
|
|
//--STRIP
|