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
This commit is contained in:
Rémi Verschelde
2017-03-05 16:44:50 +01:00
parent 45438e9918
commit 5dbf1809c6
1318 changed files with 140051 additions and 166004 deletions

View File

@ -33,7 +33,6 @@
#include "io/resource_saver.h"
#include "os/file_access.h"
class ResourceInteractiveLoaderBinary : public ResourceInteractiveLoader {
String local_path;
@ -43,7 +42,6 @@ class ResourceInteractiveLoaderBinary : public ResourceInteractiveLoader {
FileAccess *f;
bool endian_swap;
bool use_real64;
uint64_t importmd_ofs;
@ -73,58 +71,46 @@ class ResourceInteractiveLoaderBinary : public ResourceInteractiveLoader {
String get_unicode_string();
void _advance_padding(uint32_t p_len);
Map<String,String> remaps;
Map<String, String> remaps;
Error error;
int stage;
friend class ResourceFormatLoaderBinary;
friend class ResourceFormatLoaderBinary;
Error parse_variant(Variant& r_v);
Error parse_variant(Variant &r_v);
public:
virtual void set_local_path(const String& p_local_path);
virtual void set_local_path(const String &p_local_path);
virtual Ref<Resource> get_resource();
virtual Error poll();
virtual int get_stage() const;
virtual int get_stage_count() const;
void set_remaps(const Map<String,String>& p_remaps) { remaps=p_remaps; }
void set_remaps(const Map<String, String> &p_remaps) { remaps = p_remaps; }
void open(FileAccess *p_f);
String recognize(FileAccess *p_f);
void get_dependencies(FileAccess *p_f, List<String> *p_dependencies, bool p_add_types);
ResourceInteractiveLoaderBinary();
~ResourceInteractiveLoaderBinary();
};
class ResourceFormatLoaderBinary : public ResourceFormatLoader {
public:
virtual Ref<ResourceInteractiveLoader> load_interactive(const String &p_path,Error *r_error=NULL);
virtual void get_recognized_extensions_for_type(const String& p_type,List<String> *p_extensions) const;
virtual Ref<ResourceInteractiveLoader> load_interactive(const String &p_path, Error *r_error = NULL);
virtual void get_recognized_extensions_for_type(const String &p_type, List<String> *p_extensions) const;
virtual void get_recognized_extensions(List<String> *p_extensions) const;
virtual bool handles_type(const String& p_type) const;
virtual bool handles_type(const String &p_type) const;
virtual String get_resource_type(const String &p_path) const;
virtual void get_dependencies(const String& p_path, List<String> *p_dependencies, bool p_add_types=false);
virtual Error rename_dependencies(const String &p_path,const Map<String,String>& p_map);
virtual void get_dependencies(const String &p_path, List<String> *p_dependencies, bool p_add_types = false);
virtual Error rename_dependencies(const String &p_path, const Map<String, String> &p_map);
};
class ResourceFormatSaverBinaryInstance {
class ResourceFormatSaverBinaryInstance {
String local_path;
bool relative_paths;
bool bundle_resources;
bool skip_editor;
@ -134,19 +120,16 @@ class ResourceFormatSaverBinaryInstance {
FileAccess *f;
String magic;
Set<RES> resource_set;
Map<StringName,int> string_map;
Map<StringName, int> string_map;
Vector<StringName> strings;
Map<RES,int> external_resources;
Map<RES, int> external_resources;
List<RES> saved_resources;
struct Property {
int name_idx;
Variant value;
PropertyInfo pi;
};
struct ResourceData {
@ -155,36 +138,25 @@ class ResourceFormatSaverBinaryInstance {
List<Property> properties;
};
void _pad_buffer(int p_bytes);
void write_variant(const Variant& p_property,const PropertyInfo& p_hint=PropertyInfo());
void _find_resources(const Variant& p_variant,bool p_main=false);
void save_unicode_string(const String& p_string);
int get_string_index(const String& p_string);
void write_variant(const Variant &p_property, const PropertyInfo &p_hint = PropertyInfo());
void _find_resources(const Variant &p_variant, bool p_main = false);
void save_unicode_string(const String &p_string);
int get_string_index(const String &p_string);
public:
Error save(const String &p_path,const RES& p_resource,uint32_t p_flags=0);
Error save(const String &p_path, const RES &p_resource, uint32_t p_flags = 0);
};
class ResourceFormatSaverBinary : public ResourceFormatSaver {
class ResourceFormatSaverBinary : public ResourceFormatSaver {
public:
static ResourceFormatSaverBinary* singleton;
virtual Error save(const String &p_path,const RES& p_resource,uint32_t p_flags=0);
virtual bool recognize(const RES& p_resource) const;
virtual void get_recognized_extensions(const RES& p_resource,List<String> *p_extensions) const;
static ResourceFormatSaverBinary *singleton;
virtual Error save(const String &p_path, const RES &p_resource, uint32_t p_flags = 0);
virtual bool recognize(const RES &p_resource) const;
virtual void get_recognized_extensions(const RES &p_resource, List<String> *p_extensions) const;
ResourceFormatSaverBinary();
};
#endif // RESOURCE_FORMAT_BINARY_H