summaryrefslogtreecommitdiff
path: root/core/method_bind.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'core/method_bind.cpp')
-rw-r--r--core/method_bind.cpp73
1 files changed, 31 insertions, 42 deletions
diff --git a/core/method_bind.cpp b/core/method_bind.cpp
index 3465edff63..0f192a3b8a 100644
--- a/core/method_bind.cpp
+++ b/core/method_bind.cpp
@@ -32,59 +32,54 @@
#include "method_bind.h"
-
#ifdef DEBUG_METHODS_ENABLED
PropertyInfo MethodBind::get_argument_info(int p_argument) const {
+ if (p_argument >= 0) {
- if (p_argument>=0) {
-
- String name = (p_argument<arg_names.size())?String(arg_names[p_argument]):String("arg"+itos(p_argument));
- PropertyInfo pi( get_argument_type(p_argument), name );
- if ((pi.type==Variant::OBJECT) && name.find(":")!=-1) {
- pi.hint=PROPERTY_HINT_RESOURCE_TYPE;
- pi.hint_string=name.get_slicec(':',1);
- pi.name=name.get_slicec(':',0);
+ String name = (p_argument < arg_names.size()) ? String(arg_names[p_argument]) : String("arg" + itos(p_argument));
+ PropertyInfo pi(get_argument_type(p_argument), name);
+ if ((pi.type == Variant::OBJECT) && name.find(":") != -1) {
+ pi.hint = PROPERTY_HINT_RESOURCE_TYPE;
+ pi.hint_string = name.get_slicec(':', 1);
+ pi.name = name.get_slicec(':', 0);
}
return pi;
} else {
Variant::Type at = get_argument_type(-1);
- if (at==Variant::OBJECT && ret_type)
- return PropertyInfo( at, "ret", PROPERTY_HINT_RESOURCE_TYPE, ret_type );
+ if (at == Variant::OBJECT && ret_type)
+ return PropertyInfo(at, "ret", PROPERTY_HINT_RESOURCE_TYPE, ret_type);
else
- return PropertyInfo( at, "ret" );
+ return PropertyInfo(at, "ret");
}
-
return PropertyInfo();
}
#endif
void MethodBind::_set_const(bool p_const) {
- _const=p_const;
+ _const = p_const;
}
void MethodBind::_set_returns(bool p_returns) {
- _returns=p_returns;
+ _returns = p_returns;
}
-
StringName MethodBind::get_name() const {
return name;
}
-void MethodBind::set_name(const StringName& p_name) {
- name=p_name;
+void MethodBind::set_name(const StringName &p_name) {
+ name = p_name;
}
#ifdef DEBUG_METHODS_ENABLED
-void MethodBind::set_argument_names(const Vector<StringName>& p_names) {
-
- arg_names=p_names;
+void MethodBind::set_argument_names(const Vector<StringName> &p_names) {
+ arg_names = p_names;
}
Vector<StringName> MethodBind::get_argument_names() const {
@@ -93,41 +88,36 @@ Vector<StringName> MethodBind::get_argument_names() const {
#endif
-
-
-void MethodBind::set_default_arguments(const Vector<Variant>& p_defargs) {
- default_arguments=p_defargs;
- default_argument_count=default_arguments.size();
-
+void MethodBind::set_default_arguments(const Vector<Variant> &p_defargs) {
+ default_arguments = p_defargs;
+ default_argument_count = default_arguments.size();
}
#ifdef DEBUG_METHODS_ENABLED
void MethodBind::_generate_argument_types(int p_count) {
-
set_argument_count(p_count);
- Variant::Type *argt = memnew_arr(Variant::Type,p_count+1);
- argt[0]=_gen_argument_type(-1);
- for(int i=0;i<p_count;i++) {
- argt[i+1]=_gen_argument_type(i);
+ Variant::Type *argt = memnew_arr(Variant::Type, p_count + 1);
+ argt[0] = _gen_argument_type(-1);
+ for (int i = 0; i < p_count; i++) {
+ argt[i + 1] = _gen_argument_type(i);
}
set_argument_types(argt);
-
}
#endif
MethodBind::MethodBind() {
- static int last_id=0;
- method_id=last_id++;
- hint_flags=METHOD_FLAGS_DEFAULT;
- argument_count=0;
- default_argument_count=0;
+ static int last_id = 0;
+ method_id = last_id++;
+ hint_flags = METHOD_FLAGS_DEFAULT;
+ argument_count = 0;
+ default_argument_count = 0;
#ifdef DEBUG_METHODS_ENABLED
- argument_types=NULL;
+ argument_types = NULL;
#endif
- _const=false;
- _returns=false;
+ _const = false;
+ _returns = false;
}
MethodBind::~MethodBind() {
@@ -136,4 +126,3 @@ MethodBind::~MethodBind() {
memdelete_arr(argument_types);
#endif
}
-