From 5dbf1809c6e3e905b94b8764e99491e608122261 Mon Sep 17 00:00:00 2001
From: Rémi Verschelde
Date: Sun, 5 Mar 2017 16:44:50 +0100
Subject: A Whole New World (clang-format edition)
I can show you the code
Pretty, with proper whitespace
Tell me, coder, now when did
You last write readable code?
I can open your eyes
Make you see your bad indent
Force you to respect the style
The core devs agreed upon
A whole new world
A new fantastic code format
A de facto standard
With some sugar
Enforced with clang-format
A whole new world
A dazzling style we all dreamed of
And when we read it through
It's crystal clear
That now we're in a whole new world of code
---
modules/visual_script/visual_script_expression.h | 107 ++++++++++-------------
1 file changed, 45 insertions(+), 62 deletions(-)
(limited to 'modules/visual_script/visual_script_expression.h')
diff --git a/modules/visual_script/visual_script_expression.h b/modules/visual_script/visual_script_expression.h
index 5bd960f60..59a7d9fba 100644
--- a/modules/visual_script/visual_script_expression.h
+++ b/modules/visual_script/visual_script_expression.h
@@ -34,15 +34,15 @@
class VisualScriptExpression : public VisualScriptNode {
- GDCLASS(VisualScriptExpression,VisualScriptNode)
-friend class VisualScriptNodeInstanceExpression;
+ GDCLASS(VisualScriptExpression, VisualScriptNode)
+ friend class VisualScriptNodeInstanceExpression;
struct Input {
Variant::Type type;
String name;
- Input() { type=Variant::NIL; }
+ Input() { type = Variant::NIL; }
};
Vector inputs;
@@ -97,28 +97,25 @@ friend class VisualScriptNodeInstanceExpression;
TK_MAX
};
- static const char* token_name[TK_MAX];
+ static const char *token_name[TK_MAX];
struct Token {
TokenType type;
Variant value;
};
-
- void _set_error(const String& p_err) {
+ void _set_error(const String &p_err) {
if (error_set)
return;
- error_str=p_err;
- error_set=true;
+ error_str = p_err;
+ error_set = true;
}
- Error _get_token(Token& r_token);
+ Error _get_token(Token &r_token);
String error_str;
bool error_set;
-
-
struct ENode {
enum Type {
@@ -139,8 +136,12 @@ friend class VisualScriptNodeInstanceExpression;
Type type;
- ENode() { next=NULL; }
- virtual ~ENode() { if (next) { memdelete(next); } }
+ ENode() { next = NULL; }
+ virtual ~ENode() {
+ if (next) {
+ memdelete(next);
+ }
+ }
};
struct Expression {
@@ -152,22 +153,21 @@ friend class VisualScriptNodeInstanceExpression;
};
};
- ENode* _parse_expression();
+ ENode *_parse_expression();
struct InputNode : public ENode {
int index;
InputNode() {
- type=TYPE_INPUT;
+ type = TYPE_INPUT;
}
};
-
struct ConstantNode : public ENode {
Variant value;
ConstantNode() {
- type=TYPE_CONSTANT;
+ type = TYPE_CONSTANT;
}
};
@@ -175,119 +175,104 @@ friend class VisualScriptNodeInstanceExpression;
Variant::Operator op;
- ENode* nodes[2];
+ ENode *nodes[2];
OperatorNode() {
- type=TYPE_OPERATOR;
+ type = TYPE_OPERATOR;
}
};
struct SelfNode : public ENode {
-
SelfNode() {
- type=TYPE_SELF;
+ type = TYPE_SELF;
}
};
struct IndexNode : public ENode {
- ENode*base;
- ENode*index;
+ ENode *base;
+ ENode *index;
IndexNode() {
- type=TYPE_INDEX;
+ type = TYPE_INDEX;
}
};
struct NamedIndexNode : public ENode {
- ENode*base;
+ ENode *base;
StringName name;
NamedIndexNode() {
- type=TYPE_NAMED_INDEX;
+ type = TYPE_NAMED_INDEX;
}
-
};
struct ConstructorNode : public ENode {
Variant::Type data_type;
- Vector arguments;
+ Vector arguments;
ConstructorNode() {
- type=TYPE_CONSTRUCTOR;
+ type = TYPE_CONSTRUCTOR;
}
};
struct CallNode : public ENode {
- ENode*base;
+ ENode *base;
StringName method;
- Vector arguments;
+ Vector arguments;
CallNode() {
- type=TYPE_CALL;
+ type = TYPE_CALL;
}
-
};
struct ArrayNode : public ENode {
- Vector array;
+ Vector array;
ArrayNode() {
- type=TYPE_ARRAY;
+ type = TYPE_ARRAY;
}
-
};
struct DictionaryNode : public ENode {
- Vector dict;
+ Vector dict;
DictionaryNode() {
- type=TYPE_DICTIONARY;
+ type = TYPE_DICTIONARY;
}
-
};
struct BuiltinFuncNode : public ENode {
VisualScriptBuiltinFunc::BuiltinFunc func;
- Vector arguments;
+ Vector arguments;
BuiltinFuncNode() {
- type=TYPE_BUILTIN_FUNC;
+ type = TYPE_BUILTIN_FUNC;
}
};
- template
- T* alloc_node() {
- T* node = memnew(T);
- node->next=nodes;
- nodes=node;
+ template
+ T *alloc_node() {
+ T *node = memnew(T);
+ node->next = nodes;
+ nodes = node;
return node;
}
ENode *root;
ENode *nodes;
-
-
-
-
protected:
-
- bool _set(const StringName& p_name, const Variant& p_value);
- bool _get(const StringName& p_name,Variant &r_ret) const;
- void _get_property_list( List *p_list) const;
+ bool _set(const StringName &p_name, const Variant &p_value);
+ bool _get(const StringName &p_name, Variant &r_ret) const;
+ void _get_property_list(List *p_list) const;
public:
-
-
virtual int get_output_sequence_port_count() const;
virtual bool has_input_sequence_port() const;
-
virtual String get_output_sequence_port_text(int p_port) const;
-
virtual int get_input_value_port_count() const;
virtual int get_output_value_port_count() const;
-
virtual PropertyInfo get_input_value_port_info(int p_idx) const;
virtual PropertyInfo get_output_value_port_info(int p_idx) const;
@@ -295,14 +280,12 @@ public:
virtual String get_text() const;
virtual String get_category() const { return "operators"; }
- virtual VisualScriptNodeInstance* instance(VisualScriptInstance* p_instance);
+ virtual VisualScriptNodeInstance *instance(VisualScriptInstance *p_instance);
VisualScriptExpression();
~VisualScriptExpression();
};
-
void register_visual_script_expression_node();
-
#endif // VISUALSCRIPTEXPRESSION_H
--
cgit v1.2.3-70-g09d2