summaryrefslogtreecommitdiffstats
path: root/src/core/RID.cpp
blob: 58548063eeaa55283353821c1f8ae70c70165870 (plain)
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
#include "RID.hpp"

#include <gdnative/rid.h>

#include "GodotGlobal.hpp"

namespace godot {

RID::RID() {
	godot::api->godot_rid_new(&_godot_rid);
}

RID::RID(Object *p) {
	godot::api->godot_rid_new_with_resource(&_godot_rid, (const godot_object *)p);
}

godot_rid RID::_get_godot_rid() const {
	return _godot_rid;
}

int32_t RID::get_id() const {
	return godot::api->godot_rid_get_id(&_godot_rid);
}

bool RID::operator==(const RID &p_other) const {
	return godot::api->godot_rid_operator_equal(&_godot_rid, &p_other._godot_rid);
}

bool RID::operator!=(const RID &p_other) const {
	return !(*this == p_other);
}

bool RID::operator<(const RID &p_other) const {
	return godot::api->godot_rid_operator_less(&_godot_rid, &p_other._godot_rid);
}

bool RID::operator>(const RID &p_other) const {
	return !(*this < p_other) && *this != p_other;
}

bool RID::operator<=(const RID &p_other) const {
	return (*this < p_other) || *this == p_other;
}

bool RID::operator>=(const RID &p_other) const {
	return !(*this < p_other);
}

} // namespace godot