Skip to content

Commit

Permalink
Style: Set clang-format Standard to Cpp11
Browse files Browse the repository at this point in the history
For us, it practically only changes the fact that `A<A<int>>` is now
used instead of the C++03 compatible `A<A<int> >`.

Note: clang-format 10+ changed the `Standard` arguments to fully
specified `c++11`, `c++14`, etc. versions, but we can't use `c++17`
now if we want to preserve compatibility with clang-format 8 and 9.
`Cpp11` is still supported as deprecated alias for `Latest`.
  • Loading branch information
akien-mga committed Mar 17, 2020
1 parent c5d7613 commit cb282c6
Show file tree
Hide file tree
Showing 247 changed files with 794 additions and 794 deletions.
4 changes: 2 additions & 2 deletions .clang-format
Original file line number Diff line number Diff line change
Expand Up @@ -112,11 +112,11 @@ UseTab: Always
---
### C++ specific config ###
Language: Cpp
Standard: Cpp03
Standard: Cpp11
---
### ObjC specific config ###
Language: ObjC
Standard: Cpp03
Standard: Cpp11
ObjCBlockIndentWidth: 4
# ObjCSpaceAfterProperty: false
# ObjCSpaceBeforeProtocolList: true
Expand Down
26 changes: 13 additions & 13 deletions core/bind/core_bind.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -964,10 +964,10 @@ void _OS::print_all_textures_by_size() {
List<_OSCoreBindImg> imgs;
int total = 0;
{
List<Ref<Resource> > rsrc;
List<Ref<Resource>> rsrc;
ResourceCache::get_cached_resources(&rsrc);

for (List<Ref<Resource> >::Element *E = rsrc.front(); E; E = E->next()) {
for (List<Ref<Resource>>::Element *E = rsrc.front(); E; E = E->next()) {

if (!E->get()->is_class("ImageTexture"))
continue;
Expand Down Expand Up @@ -998,13 +998,13 @@ void _OS::print_resources_by_type(const Vector<String> &p_types) {

Map<String, int> type_count;

List<Ref<Resource> > resources;
List<Ref<Resource>> resources;
ResourceCache::get_cached_resources(&resources);

List<Ref<Resource> > rsrc;
List<Ref<Resource>> rsrc;
ResourceCache::get_cached_resources(&rsrc);

for (List<Ref<Resource> >::Element *E = rsrc.front(); E; E = E->next()) {
for (List<Ref<Resource>>::Element *E = rsrc.front(); E; E = E->next()) {

Ref<Resource> r = E->get();

Expand Down Expand Up @@ -1633,7 +1633,7 @@ Vector<Vector3> _Geometry::clip_polygon(const Vector<Vector3> &p_points, const P

Array _Geometry::merge_polygons_2d(const Vector<Vector2> &p_polygon_a, const Vector<Vector2> &p_polygon_b) {

Vector<Vector<Point2> > polys = Geometry::merge_polygons_2d(p_polygon_a, p_polygon_b);
Vector<Vector<Point2>> polys = Geometry::merge_polygons_2d(p_polygon_a, p_polygon_b);

Array ret;

Expand All @@ -1645,7 +1645,7 @@ Array _Geometry::merge_polygons_2d(const Vector<Vector2> &p_polygon_a, const Vec

Array _Geometry::clip_polygons_2d(const Vector<Vector2> &p_polygon_a, const Vector<Vector2> &p_polygon_b) {

Vector<Vector<Point2> > polys = Geometry::clip_polygons_2d(p_polygon_a, p_polygon_b);
Vector<Vector<Point2>> polys = Geometry::clip_polygons_2d(p_polygon_a, p_polygon_b);

Array ret;

Expand All @@ -1657,7 +1657,7 @@ Array _Geometry::clip_polygons_2d(const Vector<Vector2> &p_polygon_a, const Vect

Array _Geometry::intersect_polygons_2d(const Vector<Vector2> &p_polygon_a, const Vector<Vector2> &p_polygon_b) {

Vector<Vector<Point2> > polys = Geometry::intersect_polygons_2d(p_polygon_a, p_polygon_b);
Vector<Vector<Point2>> polys = Geometry::intersect_polygons_2d(p_polygon_a, p_polygon_b);

Array ret;

Expand All @@ -1669,7 +1669,7 @@ Array _Geometry::intersect_polygons_2d(const Vector<Vector2> &p_polygon_a, const

Array _Geometry::exclude_polygons_2d(const Vector<Vector2> &p_polygon_a, const Vector<Vector2> &p_polygon_b) {

Vector<Vector<Point2> > polys = Geometry::exclude_polygons_2d(p_polygon_a, p_polygon_b);
Vector<Vector<Point2>> polys = Geometry::exclude_polygons_2d(p_polygon_a, p_polygon_b);

Array ret;

Expand All @@ -1681,7 +1681,7 @@ Array _Geometry::exclude_polygons_2d(const Vector<Vector2> &p_polygon_a, const V

Array _Geometry::clip_polyline_with_polygon_2d(const Vector<Vector2> &p_polyline, const Vector<Vector2> &p_polygon) {

Vector<Vector<Point2> > polys = Geometry::clip_polyline_with_polygon_2d(p_polyline, p_polygon);
Vector<Vector<Point2>> polys = Geometry::clip_polyline_with_polygon_2d(p_polyline, p_polygon);

Array ret;

Expand All @@ -1693,7 +1693,7 @@ Array _Geometry::clip_polyline_with_polygon_2d(const Vector<Vector2> &p_polyline

Array _Geometry::intersect_polyline_with_polygon_2d(const Vector<Vector2> &p_polyline, const Vector<Vector2> &p_polygon) {

Vector<Vector<Point2> > polys = Geometry::intersect_polyline_with_polygon_2d(p_polyline, p_polygon);
Vector<Vector<Point2>> polys = Geometry::intersect_polyline_with_polygon_2d(p_polyline, p_polygon);

Array ret;

Expand All @@ -1705,7 +1705,7 @@ Array _Geometry::intersect_polyline_with_polygon_2d(const Vector<Vector2> &p_pol

Array _Geometry::offset_polygon_2d(const Vector<Vector2> &p_polygon, real_t p_delta, PolyJoinType p_join_type) {

Vector<Vector<Point2> > polys = Geometry::offset_polygon_2d(p_polygon, p_delta, Geometry::PolyJoinType(p_join_type));
Vector<Vector<Point2>> polys = Geometry::offset_polygon_2d(p_polygon, p_delta, Geometry::PolyJoinType(p_join_type));

Array ret;

Expand All @@ -1717,7 +1717,7 @@ Array _Geometry::offset_polygon_2d(const Vector<Vector2> &p_polygon, real_t p_de

Array _Geometry::offset_polyline_2d(const Vector<Vector2> &p_polygon, real_t p_delta, PolyJoinType p_join_type, PolyEndType p_end_type) {

Vector<Vector<Point2> > polys = Geometry::offset_polyline_2d(p_polygon, p_delta, Geometry::PolyJoinType(p_join_type), Geometry::PolyEndType(p_end_type));
Vector<Vector<Point2>> polys = Geometry::offset_polyline_2d(p_polygon, p_delta, Geometry::PolyJoinType(p_join_type), Geometry::PolyEndType(p_end_type));

Array ret;

Expand Down
2 changes: 1 addition & 1 deletion core/class_db.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1401,7 +1401,7 @@ void ClassDB::get_extensions_for_type(const StringName &p_class, List<String> *p
}
}

HashMap<StringName, HashMap<StringName, Variant> > ClassDB::default_values;
HashMap<StringName, HashMap<StringName, Variant>> ClassDB::default_values;
Set<StringName> ClassDB::default_values_cached;

Variant ClassDB::class_get_default_property_value(const StringName &p_class, const StringName &p_property, bool *r_valid) {
Expand Down
4 changes: 2 additions & 2 deletions core/class_db.h
Original file line number Diff line number Diff line change
Expand Up @@ -119,7 +119,7 @@ class ClassDB {
void *class_ptr;
HashMap<StringName, MethodBind *> method_map;
HashMap<StringName, int> constant_map;
HashMap<StringName, List<StringName> > enum_map;
HashMap<StringName, List<StringName>> enum_map;
HashMap<StringName, MethodInfo> signal_map;
List<PropertyInfo> property_list;
#ifdef DEBUG_METHODS_ENABLED
Expand Down Expand Up @@ -160,7 +160,7 @@ class ClassDB {

static void _add_class2(const StringName &p_class, const StringName &p_inherits);

static HashMap<StringName, HashMap<StringName, Variant> > default_values;
static HashMap<StringName, HashMap<StringName, Variant>> default_values;
static Set<StringName> default_values_cached;

public:
Expand Down
6 changes: 3 additions & 3 deletions core/compressed_translation.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -50,8 +50,8 @@ void PHashTranslation::generate(const Ref<Translation> &p_from) {

int size = Math::larger_prime(keys.size());

Vector<Vector<Pair<int, CharString> > > buckets;
Vector<Map<uint32_t, int> > table;
Vector<Vector<Pair<int, CharString>>> buckets;
Vector<Map<uint32_t, int>> table;
Vector<uint32_t> hfunc_table;
Vector<_PHashTranslationCmp> compressed;

Expand Down Expand Up @@ -109,7 +109,7 @@ void PHashTranslation::generate(const Ref<Translation> &p_from) {

for (int i = 0; i < size; i++) {

const Vector<Pair<int, CharString> > &b = buckets[i];
const Vector<Pair<int, CharString>> &b = buckets[i];
Map<uint32_t, int> &t = table.write[i];

if (b.size() == 0)
Expand Down
4 changes: 2 additions & 2 deletions core/debugger/local_debugger.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -262,14 +262,14 @@ void LocalDebugger::debug(bool p_can_continue, bool p_is_error_breakpoint) {

if (line.get_slice_count(" ") <= 1) {

const Map<int, Set<StringName> > &breakpoints = script_debugger->get_breakpoints();
const Map<int, Set<StringName>> &breakpoints = script_debugger->get_breakpoints();
if (breakpoints.size() == 0) {
print_line("No Breakpoints.");
continue;
}

print_line("Breakpoint(s): " + itos(breakpoints.size()));
for (Map<int, Set<StringName> >::Element *E = breakpoints.front(); E; E = E->next()) {
for (Map<int, Set<StringName>>::Element *E = breakpoints.front(); E; E = E->next()) {
print_line("\t" + String(E->value().front()->get()) + ":" + itos(E->key()));
}

Expand Down
4 changes: 2 additions & 2 deletions core/debugger/script_debugger.h
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ class ScriptDebugger {
int depth = -1;
bool skip_breakpoints = false;

Map<int, Set<StringName> > breakpoints;
Map<int, Set<StringName>> breakpoints;

ScriptLanguage *break_lang = NULL;
Vector<StackInfo> error_stack_info;
Expand All @@ -67,7 +67,7 @@ class ScriptDebugger {
bool is_breakpoint(int p_line, const StringName &p_source) const;
bool is_breakpoint_line(int p_line) const;
void clear_breakpoints();
const Map<int, Set<StringName> > &get_breakpoints() const { return breakpoints; }
const Map<int, Set<StringName>> &get_breakpoints() const { return breakpoints; }

void debug(ScriptLanguage *p_lang, bool p_can_continue = true, bool p_is_error_breakpoint = false);
ScriptLanguage *get_break_language() const;
Expand Down
14 changes: 7 additions & 7 deletions core/input_map.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -99,9 +99,9 @@ List<StringName> InputMap::get_actions() const {
return actions;
}

List<Ref<InputEvent> >::Element *InputMap::_find_event(Action &p_action, const Ref<InputEvent> &p_event, bool *p_pressed, float *p_strength) const {
List<Ref<InputEvent>>::Element *InputMap::_find_event(Action &p_action, const Ref<InputEvent> &p_event, bool *p_pressed, float *p_strength) const {

for (List<Ref<InputEvent> >::Element *E = p_action.inputs.front(); E; E = E->next()) {
for (List<Ref<InputEvent>>::Element *E = p_action.inputs.front(); E; E = E->next()) {

const Ref<InputEvent> e = E->get();

Expand Down Expand Up @@ -151,7 +151,7 @@ void InputMap::action_erase_event(const StringName &p_action, const Ref<InputEve

ERR_FAIL_COND_MSG(!input_map.has(p_action), "Request for nonexistent InputMap action '" + String(p_action) + "'.");

List<Ref<InputEvent> >::Element *E = _find_event(input_map[p_action], p_event);
List<Ref<InputEvent>>::Element *E = _find_event(input_map[p_action], p_event);
if (E)
input_map[p_action].inputs.erase(E);
}
Expand All @@ -166,9 +166,9 @@ void InputMap::action_erase_events(const StringName &p_action) {
Array InputMap::_get_action_list(const StringName &p_action) {

Array ret;
const List<Ref<InputEvent> > *al = get_action_list(p_action);
const List<Ref<InputEvent>> *al = get_action_list(p_action);
if (al) {
for (const List<Ref<InputEvent> >::Element *E = al->front(); E; E = E->next()) {
for (const List<Ref<InputEvent>>::Element *E = al->front(); E; E = E->next()) {

ret.push_back(E->get());
}
Expand All @@ -177,7 +177,7 @@ Array InputMap::_get_action_list(const StringName &p_action) {
return ret;
}

const List<Ref<InputEvent> > *InputMap::get_action_list(const StringName &p_action) {
const List<Ref<InputEvent>> *InputMap::get_action_list(const StringName &p_action) {

const Map<StringName, Action>::Element *E = input_map.find(p_action);
if (!E)
Expand Down Expand Up @@ -205,7 +205,7 @@ bool InputMap::event_get_action_status(const Ref<InputEvent> &p_event, const Str

bool pressed;
float strength;
List<Ref<InputEvent> >::Element *event = _find_event(E->get(), p_event, &pressed, &strength);
List<Ref<InputEvent>>::Element *event = _find_event(E->get(), p_event, &pressed, &strength);
if (event != NULL) {
if (p_pressed != NULL)
*p_pressed = pressed;
Expand Down
6 changes: 3 additions & 3 deletions core/input_map.h
Original file line number Diff line number Diff line change
Expand Up @@ -47,15 +47,15 @@ class InputMap : public Object {
struct Action {
int id;
float deadzone;
List<Ref<InputEvent> > inputs;
List<Ref<InputEvent>> inputs;
};

private:
static InputMap *singleton;

mutable Map<StringName, Action> input_map;

List<Ref<InputEvent> >::Element *_find_event(Action &p_action, const Ref<InputEvent> &p_event, bool *p_pressed = NULL, float *p_strength = NULL) const;
List<Ref<InputEvent>>::Element *_find_event(Action &p_action, const Ref<InputEvent> &p_event, bool *p_pressed = NULL, float *p_strength = NULL) const;

Array _get_action_list(const StringName &p_action);
Array _get_actions();
Expand All @@ -77,7 +77,7 @@ class InputMap : public Object {
void action_erase_event(const StringName &p_action, const Ref<InputEvent> &p_event);
void action_erase_events(const StringName &p_action);

const List<Ref<InputEvent> > *get_action_list(const StringName &p_action);
const List<Ref<InputEvent>> *get_action_list(const StringName &p_action);
bool event_is_action(const Ref<InputEvent> &p_event, const StringName &p_action) const;
bool event_get_action_status(const Ref<InputEvent> &p_event, const StringName &p_action, bool *p_pressed = NULL, float *p_strength = NULL) const;

Expand Down
4 changes: 2 additions & 2 deletions core/io/config_file.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -107,7 +107,7 @@ bool ConfigFile::has_section_key(const String &p_section, const String &p_key) c

void ConfigFile::get_sections(List<String> *r_sections) const {

for (OrderedHashMap<String, OrderedHashMap<String, Variant> >::ConstElement E = values.front(); E; E = E.next()) {
for (OrderedHashMap<String, OrderedHashMap<String, Variant>>::ConstElement E = values.front(); E; E = E.next()) {
r_sections->push_back(E.key());
}
}
Expand Down Expand Up @@ -187,7 +187,7 @@ Error ConfigFile::save_encrypted_pass(const String &p_path, const String &p_pass

Error ConfigFile::_internal_save(FileAccess *file) {

for (OrderedHashMap<String, OrderedHashMap<String, Variant> >::Element E = values.front(); E; E = E.next()) {
for (OrderedHashMap<String, OrderedHashMap<String, Variant>>::Element E = values.front(); E; E = E.next()) {

if (E != values.front())
file->store_string("\n");
Expand Down
2 changes: 1 addition & 1 deletion core/io/config_file.h
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ class ConfigFile : public Reference {

GDCLASS(ConfigFile, Reference);

OrderedHashMap<String, OrderedHashMap<String, Variant> > values;
OrderedHashMap<String, OrderedHashMap<String, Variant>> values;

PackedStringArray _get_sections() const;
PackedStringArray _get_section_keys(const String &p_section) const;
Expand Down
6 changes: 3 additions & 3 deletions core/io/file_access_memory.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -35,12 +35,12 @@
#include "core/os/dir_access.h"
#include "core/project_settings.h"

static Map<String, Vector<uint8_t> > *files = NULL;
static Map<String, Vector<uint8_t>> *files = NULL;

void FileAccessMemory::register_file(String p_name, Vector<uint8_t> p_data) {

if (!files) {
files = memnew((Map<String, Vector<uint8_t> >));
files = memnew((Map<String, Vector<uint8_t>>));
}

String name;
Expand Down Expand Up @@ -89,7 +89,7 @@ Error FileAccessMemory::_open(const String &p_path, int p_mode_flags) {
String name = fix_path(p_path);
//name = DirAccess::normalize_path(name);

Map<String, Vector<uint8_t> >::Element *E = files->find(name);
Map<String, Vector<uint8_t>>::Element *E = files->find(name);
ERR_FAIL_COND_V_MSG(!E, ERR_FILE_NOT_FOUND, "Can't find file '" + p_path + "'.");

data = E->get().ptrw();
Expand Down
2 changes: 1 addition & 1 deletion core/io/http_client.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -350,7 +350,7 @@ Error HTTPClient::poll() {
handshaking = true;
} else {
// We are already handshaking, which means we can use your already active SSL connection
ssl = static_cast<Ref<StreamPeerSSL> >(connection);
ssl = static_cast<Ref<StreamPeerSSL>>(connection);
if (ssl.is_null()) {
close();
status = STATUS_SSL_HANDSHAKE_ERROR;
Expand Down
4 changes: 2 additions & 2 deletions core/io/resource_importer.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -362,7 +362,7 @@ Ref<ResourceImporter> ResourceFormatImporter::get_importer_by_name(const String
return Ref<ResourceImporter>();
}

void ResourceFormatImporter::get_importers_for_extension(const String &p_extension, List<Ref<ResourceImporter> > *r_importers) {
void ResourceFormatImporter::get_importers_for_extension(const String &p_extension, List<Ref<ResourceImporter>> *r_importers) {

for (int i = 0; i < importers.size(); i++) {
List<String> local_exts;
Expand Down Expand Up @@ -423,7 +423,7 @@ bool ResourceFormatImporter::are_import_settings_valid(const String &p_path) con

String ResourceFormatImporter::get_import_settings_hash() const {

Vector<Ref<ResourceImporter> > sorted_importers = importers;
Vector<Ref<ResourceImporter>> sorted_importers = importers;

sorted_importers.sort_custom<SortImporterByName>();

Expand Down
6 changes: 3 additions & 3 deletions core/io/resource_importer.h
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@ class ResourceFormatImporter : public ResourceFormatLoader {
bool operator()(const Ref<ResourceImporter> &p_a, const Ref<ResourceImporter> &p_b) const;
};

Vector<Ref<ResourceImporter> > importers;
Vector<Ref<ResourceImporter>> importers;

public:
static ResourceFormatImporter *get_singleton() { return singleton; }
Expand Down Expand Up @@ -83,7 +83,7 @@ class ResourceFormatImporter : public ResourceFormatLoader {
void remove_importer(const Ref<ResourceImporter> &p_importer) { importers.erase(p_importer); }
Ref<ResourceImporter> get_importer_by_name(const String &p_name) const;
Ref<ResourceImporter> get_importer_by_extension(const String &p_extension) const;
void get_importers_for_extension(const String &p_extension, List<Ref<ResourceImporter> > *r_importers);
void get_importers_for_extension(const String &p_extension, List<Ref<ResourceImporter>> *r_importers);

bool are_import_settings_valid(const String &p_path) const;
String get_import_settings_hash() const;
Expand Down Expand Up @@ -125,7 +125,7 @@ class ResourceImporter : public Reference {

virtual Error import(const String &p_source_file, const String &p_save_path, const Map<StringName, Variant> &p_options, List<String> *r_platform_variants, List<String> *r_gen_files = NULL, Variant *r_metadata = NULL) = 0;

virtual Error import_group_file(const String &p_group_file, const Map<String, Map<StringName, Variant> > &p_source_file_options, const Map<String, String> &p_base_paths) { return ERR_UNAVAILABLE; }
virtual Error import_group_file(const String &p_group_file, const Map<String, Map<StringName, Variant>> &p_source_file_options, const Map<String, String> &p_base_paths) { return ERR_UNAVAILABLE; }
virtual bool are_import_settings_valid(const String &p_path) const { return true; }
virtual String get_import_settings_string() const { return String(); }
};
Expand Down
4 changes: 2 additions & 2 deletions core/io/resource_loader.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1113,7 +1113,7 @@ void ResourceLoader::add_custom_loaders() {

void ResourceLoader::remove_custom_loaders() {

Vector<Ref<ResourceFormatLoader> > custom_loaders;
Vector<Ref<ResourceFormatLoader>> custom_loaders;
for (int i = 0; i < loader_count; ++i) {
if (loader[i]->get_script_instance()) {
custom_loaders.push_back(loader[i]);
Expand Down Expand Up @@ -1159,7 +1159,7 @@ int ResourceLoader::thread_suspended_count = 0;
int ResourceLoader::thread_load_max = 0;

SelfList<Resource>::List ResourceLoader::remapped_list;
HashMap<String, Vector<String> > ResourceLoader::translation_remaps;
HashMap<String, Vector<String>> ResourceLoader::translation_remaps;
HashMap<String, String> ResourceLoader::path_remaps;

ResourceLoaderImport ResourceLoader::import = NULL;
Loading

0 comments on commit cb282c6

Please sign in to comment.