diff options
| author | Rémi Verschelde | 2017-03-19 00:36:26 +0100 |
|---|---|---|
| committer | Rémi Verschelde | 2017-03-19 00:36:26 +0100 |
| commit | f8db8a3faa30b71dca33ced38be16d3f93f43e8a (patch) | |
| tree | 3b798318132cca7eccfbca5818ab55656a2896d7 /core/reference.cpp | |
| parent | 1d418afe863c9e553b69174ce63aef203c46d2f0 (diff) | |
| download | godot-f8db8a3faa30b71dca33ced38be16d3f93f43e8a.tar.gz godot-f8db8a3faa30b71dca33ced38be16d3f93f43e8a.tar.zst godot-f8db8a3faa30b71dca33ced38be16d3f93f43e8a.zip | |
Bring that Whole New World to the Old Continent too
Applies the clang-format style to the 2.1 branch as done for master in
5dbf1809c6e3e905b94b8764e99491e608122261.
Diffstat (limited to 'core/reference.cpp')
| -rw-r--r-- | core/reference.cpp | 31 |
1 files changed, 12 insertions, 19 deletions
diff --git a/core/reference.cpp b/core/reference.cpp index 3e3355c21..d472f0f6a 100644 --- a/core/reference.cpp +++ b/core/reference.cpp @@ -29,7 +29,6 @@ #include "reference.h" #include "script_language.h" - bool Reference::init_ref() { if (refcount.ref()) { @@ -38,7 +37,7 @@ bool Reference::init_ref() { // at the same time, which is never likely to happen (would be crazy to do) // so don't do it. - if (refcount_init.get()>0) { + if (refcount_init.get() > 0) { refcount_init.unref(); refcount.unref(); // first referencing is already 1, so compensate for the ref above } @@ -48,30 +47,27 @@ bool Reference::init_ref() { return false; } - } - void Reference::_bind_methods() { - ObjectTypeDB::bind_method(_MD("init_ref"),&Reference::init_ref); - ObjectTypeDB::bind_method(_MD("reference"),&Reference::reference); - ObjectTypeDB::bind_method(_MD("unreference"),&Reference::unreference); + ObjectTypeDB::bind_method(_MD("init_ref"), &Reference::init_ref); + ObjectTypeDB::bind_method(_MD("reference"), &Reference::reference); + ObjectTypeDB::bind_method(_MD("unreference"), &Reference::unreference); } int Reference::reference_get_count() const { return refcount.get(); } -void Reference::reference(){ +void Reference::reference() { refcount.ref(); if (get_script_instance()) { get_script_instance()->refcount_incremented(); } - } -bool Reference::unreference(){ +bool Reference::unreference() { bool die = refcount.unref(); @@ -80,7 +76,6 @@ bool Reference::unreference(){ } return die; - } Reference::Reference() { @@ -89,14 +84,12 @@ Reference::Reference() { refcount_init.init(); } - Reference::~Reference() { - } Variant WeakRef::get_ref() const { - if (ref==0) + if (ref == 0) return Variant(); Object *obj = ObjectDB::get_instance(ref); @@ -112,21 +105,21 @@ Variant WeakRef::get_ref() const { } void WeakRef::set_obj(Object *p_object) { - ref=p_object ? p_object->get_instance_ID() : 0; + ref = p_object ? p_object->get_instance_ID() : 0; } -void WeakRef::set_ref(const REF& p_ref) { +void WeakRef::set_ref(const REF &p_ref) { - ref=p_ref.is_valid() ? p_ref->get_instance_ID() : 0; + ref = p_ref.is_valid() ? p_ref->get_instance_ID() : 0; } WeakRef::WeakRef() { - ref=0; + ref = 0; } void WeakRef::_bind_methods() { - ObjectTypeDB::bind_method(_MD("get_ref:Object"),&WeakRef::get_ref); + ObjectTypeDB::bind_method(_MD("get_ref:Object"), &WeakRef::get_ref); } #if 0 |
