summaryrefslogtreecommitdiff
path: root/scene/gui
diff options
context:
space:
mode:
authorRémi Verschelde <rverschelde@gmail.com>2020-05-12 17:01:17 +0200
committerRémi Verschelde <rverschelde@gmail.com>2020-05-14 10:01:56 +0200
commit1f6f364a56319eabd02c050746fe7df3f55ffee3 (patch)
tree8bebdce946466ce8e9476ccd46c9dba62c323938 /scene/gui
parente7c9d818766a119089873e4941e4865fb36883ec (diff)
Port member initialization from constructor to declaration (C++11)
Using `clang-tidy`'s `modernize-use-default-member-init` check and manual review of the changes, and some extra manual changes that `clang-tidy` failed to do. Also went manually through all of `core` to find occurrences that `clang-tidy` couldn't handle, especially all initializations done in a constructor without using initializer lists.
Diffstat (limited to 'scene/gui')
-rw-r--r--scene/gui/label.cpp17
-rw-r--r--scene/gui/label.h43
2 files changed, 19 insertions, 41 deletions
diff --git a/scene/gui/label.cpp b/scene/gui/label.cpp
index bedcef2df2..7490101ee3 100644
--- a/scene/gui/label.cpp
+++ b/scene/gui/label.cpp
@@ -29,6 +29,7 @@
/*************************************************************************/
#include "label.h"
+
#include "core/print_string.h"
#include "core/project_settings.h"
#include "core/translation.h"
@@ -693,24 +694,8 @@ void Label::_bind_methods() {
}
Label::Label(const String &p_text) {
-
- align = ALIGN_LEFT;
- valign = VALIGN_TOP;
- xl_text = "";
- word_cache = nullptr;
- word_cache_dirty = true;
- autowrap = false;
- line_count = 0;
- set_v_size_flags(0);
- clip = false;
set_mouse_filter(MOUSE_FILTER_IGNORE);
- total_char_cache = 0;
- visible_chars = -1;
- percent_visible = 1;
- lines_skipped = 0;
- max_lines_visible = -1;
set_text(p_text);
- uppercase = false;
set_v_size_flags(SIZE_SHRINK_CENTER);
}
diff --git a/scene/gui/label.h b/scene/gui/label.h
index ba6e627c58..0f84b01604 100644
--- a/scene/gui/label.h
+++ b/scene/gui/label.h
@@ -55,15 +55,15 @@ public:
};
private:
- Align align;
- VAlign valign;
+ Align align = ALIGN_LEFT;
+ VAlign valign = VALIGN_TOP;
String text;
String xl_text;
- bool autowrap;
- bool clip;
+ bool autowrap = false;
+ bool clip = false;
Size2 minsize;
- int line_count;
- bool uppercase;
+ int line_count = 0;
+ bool uppercase = false;
int get_longest_line_width() const;
@@ -73,30 +73,23 @@ private:
CHAR_NEWLINE = -1,
CHAR_WRAPLINE = -2
};
- int char_pos; // if -1, then newline
- int word_len;
- int pixel_width;
- int space_count;
- WordCache *next;
- WordCache() {
- char_pos = 0;
- word_len = 0;
- pixel_width = 0;
- next = 0;
- space_count = 0;
- }
+ int char_pos = 0; // if -1, then newline
+ int word_len = 0;
+ int pixel_width = 0;
+ int space_count = 0;
+ WordCache *next = nullptr;
};
- bool word_cache_dirty;
+ bool word_cache_dirty = true;
void regenerate_word_cache();
- float percent_visible;
+ float percent_visible = 1;
- WordCache *word_cache;
- int total_char_cache;
- int visible_chars;
- int lines_skipped;
- int max_lines_visible;
+ WordCache *word_cache = nullptr;
+ int total_char_cache = 0;
+ int visible_chars = -1;
+ int lines_skipped = 0;
+ int max_lines_visible = -1;
protected:
void _notification(int p_what);