| 42 | #include "core/string/ustring.h" |
| 43 | |
| 44 | class [[nodiscard]] NodePath { |
| 45 | struct Data { |
| 46 | SafeRefCount refcount; |
| 47 | Vector<StringName> path; |
| 48 | Vector<StringName> subpath; |
| 49 | StringName concatenated_path; |
| 50 | StringName concatenated_subpath; |
| 51 | bool absolute; |
| 52 | mutable bool hash_cache_valid; |
| 53 | mutable uint32_t hash_cache; |
| 54 | }; |
| 55 | |
| 56 | mutable Data *data = nullptr; |
| 57 | void unref(); |
| 58 | |
| 59 | void _update_hash_cache() const; |
| 60 | |
| 61 | public: |
| 62 | bool is_absolute() const; |
| 63 | int get_name_count() const; |
| 64 | StringName get_name(int p_idx) const; |
| 65 | int get_subname_count() const; |
| 66 | StringName get_subname(int p_idx) const; |
| 67 | int get_total_name_count() const; |
| 68 | Vector<StringName> get_names() const; |
| 69 | Vector<StringName> get_subnames() const; |
| 70 | StringName get_concatenated_names() const; |
| 71 | StringName get_concatenated_subnames() const; |
| 72 | NodePath slice(int p_begin, int p_end = INT_MAX) const; |
| 73 | |
| 74 | NodePath rel_path_to(const NodePath &p_np) const; |
| 75 | NodePath get_as_property_path() const; |
| 76 | |
| 77 | void prepend_period(); |
| 78 | |
| 79 | _FORCE_INLINE_ uint32_t hash() const { |
| 80 | if (!data) { |
| 81 | return 0; |
| 82 | } |
| 83 | if (!data->hash_cache_valid) { |
| 84 | _update_hash_cache(); |
| 85 | } |
| 86 | return data->hash_cache; |
| 87 | } |
| 88 | |
| 89 | explicit operator String() const; |
| 90 | bool is_empty() const; |
| 91 | |
| 92 | bool operator==(const NodePath &p_path) const; |
| 93 | bool operator!=(const NodePath &p_path) const; |
| 94 | void operator=(const NodePath &p_path); |
| 95 | |
| 96 | void simplify(); |
| 97 | NodePath simplified() const; |
| 98 | |
| 99 | NodePath(const Vector<StringName> &p_path, bool p_absolute); |
| 100 | NodePath(const Vector<StringName> &p_path, const Vector<StringName> &p_subpath, bool p_absolute); |
| 101 | NodePath(const NodePath &p_path); |
no outgoing calls
no test coverage detected