1
0
mirror of https://github.com/godotengine/godot.git synced 2025-11-05 12:10:55 +00:00

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

@@ -30,8 +30,6 @@
#include "dir_access_android.h"
#include "file_access_android.h"
DirAccess *DirAccessAndroid::create_fs() {
return memnew(DirAccessAndroid);
@@ -41,36 +39,33 @@ Error DirAccessAndroid::list_dir_begin() {
list_dir_end();
AAssetDir* aad = AAssetManager_openDir(FileAccessAndroid::asset_manager,current_dir.utf8().get_data());
AAssetDir *aad = AAssetManager_openDir(FileAccessAndroid::asset_manager, current_dir.utf8().get_data());
if (!aad)
return ERR_CANT_OPEN; //nothing
return OK;
}
String DirAccessAndroid::get_next(){
String DirAccessAndroid::get_next() {
const char* fn= AAssetDir_getNextFileName(aad);
const char *fn = AAssetDir_getNextFileName(aad);
if (!fn)
return "";
String s;
s.parse_utf8(fn);
current=s;
current = s;
return s;
}
bool DirAccessAndroid::current_is_dir() const{
bool DirAccessAndroid::current_is_dir() const {
String sd;
if (current_dir=="")
sd=current;
if (current_dir == "")
sd = current;
else
sd=current_dir+"/"+current;
sd = current_dir + "/" + current;
AAssetDir* aad2 = AAssetManager_openDir(FileAccessAndroid::asset_manager,sd.utf8().get_data());
AAssetDir *aad2 = AAssetManager_openDir(FileAccessAndroid::asset_manager, sd.utf8().get_data());
if (aad2) {
AAssetDir_close(aad2);
@@ -78,56 +73,54 @@ bool DirAccessAndroid::current_is_dir() const{
}
return false;
}
bool DirAccessAndroid::current_is_hidden() const{
return current!="." && current!=".." && current.begins_with(".");
bool DirAccessAndroid::current_is_hidden() const {
return current != "." && current != ".." && current.begins_with(".");
}
void DirAccessAndroid::list_dir_end(){
void DirAccessAndroid::list_dir_end() {
if (aad==NULL)
if (aad == NULL)
return;
AAssetDir_close(aad);
aad=NULL;
aad = NULL;
}
int DirAccessAndroid::get_drive_count(){
int DirAccessAndroid::get_drive_count() {
return 0;
}
String DirAccessAndroid::get_drive(int p_drive){
String DirAccessAndroid::get_drive(int p_drive) {
return "";
}
Error DirAccessAndroid::change_dir(String p_dir){
Error DirAccessAndroid::change_dir(String p_dir) {
p_dir=p_dir.simplify_path();
p_dir = p_dir.simplify_path();
if (p_dir=="" || p_dir=="." || (p_dir==".." && current_dir==""))
if (p_dir == "" || p_dir == "." || (p_dir == ".." && current_dir == ""))
return OK;
String new_dir;
if (p_dir.begins_with("/"))
new_dir=p_dir.substr(1,p_dir.length());
new_dir = p_dir.substr(1, p_dir.length());
else if (p_dir.begins_with("res://"))
new_dir=p_dir.substr(6,p_dir.length());
else //relative
new_dir=new_dir+"/"+p_dir;
new_dir = p_dir.substr(6, p_dir.length());
else //relative
new_dir = new_dir + "/" + p_dir;
//test if newdir exists
new_dir=new_dir.simplify_path();
//test if newdir exists
new_dir = new_dir.simplify_path();
AAssetDir* aad = AAssetManager_openDir(FileAccessAndroid::asset_manager,new_dir.utf8().get_data());
AAssetDir *aad = AAssetManager_openDir(FileAccessAndroid::asset_manager, new_dir.utf8().get_data());
if (aad) {
current_dir=new_dir;
current_dir = new_dir;
AAssetDir_close(aad);
return OK;
}
@@ -135,21 +128,20 @@ Error DirAccessAndroid::change_dir(String p_dir){
return ERR_INVALID_PARAMETER;
}
String DirAccessAndroid::get_current_dir(){
String DirAccessAndroid::get_current_dir() {
return "/"+current_dir;
return "/" + current_dir;
}
bool DirAccessAndroid::file_exists(String p_file){
bool DirAccessAndroid::file_exists(String p_file) {
String sd;
if (current_dir=="")
sd=p_file;
if (current_dir == "")
sd = p_file;
else
sd=current_dir+"/"+p_file;
sd = current_dir + "/" + p_file;
AAsset *a=AAssetManager_open(FileAccessAndroid::asset_manager,sd.utf8().get_data(),AASSET_MODE_STREAMING);
AAsset *a = AAssetManager_open(FileAccessAndroid::asset_manager, sd.utf8().get_data(), AASSET_MODE_STREAMING);
if (a) {
AAsset_close(a);
return true;
@@ -158,18 +150,17 @@ bool DirAccessAndroid::file_exists(String p_file){
return false;
}
Error DirAccessAndroid::make_dir(String p_dir){
Error DirAccessAndroid::make_dir(String p_dir) {
ERR_FAIL_V(ERR_UNAVAILABLE);
}
Error DirAccessAndroid::rename(String p_from, String p_to){
Error DirAccessAndroid::rename(String p_from, String p_to) {
ERR_FAIL_V(ERR_UNAVAILABLE);
}
Error DirAccessAndroid::remove(String p_name){
Error DirAccessAndroid::remove(String p_name) {
ERR_FAIL_V(ERR_UNAVAILABLE);
}
@@ -182,12 +173,12 @@ size_t DirAccessAndroid::get_space_left() {
void DirAccessAndroid::make_default() {
instance_func=create_fs;
instance_func = create_fs;
}
DirAccessAndroid::DirAccessAndroid() {
aad=NULL;
aad = NULL;
}
DirAccessAndroid::~DirAccessAndroid() {