summaryrefslogtreecommitdiff
path: root/core
diff options
context:
space:
mode:
Diffstat (limited to 'core')
-rw-r--r--core/bind/core_bind.cpp10
-rw-r--r--core/io/config_file.cpp2
-rw-r--r--core/ustring.cpp37
-rw-r--r--core/ustring.h2
-rw-r--r--core/variant_call.cpp6
5 files changed, 32 insertions, 25 deletions
diff --git a/core/bind/core_bind.cpp b/core/bind/core_bind.cpp
index 1eb7f790a3..45d089599b 100644
--- a/core/bind/core_bind.cpp
+++ b/core/bind/core_bind.cpp
@@ -1893,15 +1893,15 @@ void _Directory::_bind_methods() {
ObjectTypeDB::bind_method(_MD("get_drive","idx"),&_Directory::get_drive);
ObjectTypeDB::bind_method(_MD("change_dir:Error","todir"),&_Directory::change_dir);
ObjectTypeDB::bind_method(_MD("get_current_dir"),&_Directory::get_current_dir);
- ObjectTypeDB::bind_method(_MD("make_dir:Error","name"),&_Directory::make_dir);
- ObjectTypeDB::bind_method(_MD("make_dir_recursive:Error","name"),&_Directory::make_dir_recursive);
- ObjectTypeDB::bind_method(_MD("file_exists","name"),&_Directory::file_exists);
- ObjectTypeDB::bind_method(_MD("dir_exists","name"),&_Directory::dir_exists);
+ ObjectTypeDB::bind_method(_MD("make_dir:Error","path"),&_Directory::make_dir);
+ ObjectTypeDB::bind_method(_MD("make_dir_recursive:Error","path"),&_Directory::make_dir_recursive);
+ ObjectTypeDB::bind_method(_MD("file_exists","path"),&_Directory::file_exists);
+ ObjectTypeDB::bind_method(_MD("dir_exists","path"),&_Directory::dir_exists);
// ObjectTypeDB::bind_method(_MD("get_modified_time","file"),&_Directory::get_modified_time);
ObjectTypeDB::bind_method(_MD("get_space_left"),&_Directory::get_space_left);
ObjectTypeDB::bind_method(_MD("copy:Error","from","to"),&_Directory::copy);
ObjectTypeDB::bind_method(_MD("rename:Error","from","to"),&_Directory::rename);
- ObjectTypeDB::bind_method(_MD("remove:Error","file"),&_Directory::remove);
+ ObjectTypeDB::bind_method(_MD("remove:Error","path"),&_Directory::remove);
}
diff --git a/core/io/config_file.cpp b/core/io/config_file.cpp
index fd20ec9404..e0dc7ef9fa 100644
--- a/core/io/config_file.cpp
+++ b/core/io/config_file.cpp
@@ -207,7 +207,7 @@ Error ConfigFile::load(const String& p_path) {
void ConfigFile::_bind_methods(){
ObjectTypeDB::bind_method(_MD("set_value","section","key","value"),&ConfigFile::set_value);
- ObjectTypeDB::bind_method(_MD("get_value","section","key","default"),&ConfigFile::get_value,DEFVAL(Variant()));
+ ObjectTypeDB::bind_method(_MD("get_value:Variant","section","key","default"),&ConfigFile::get_value,DEFVAL(Variant()));
ObjectTypeDB::bind_method(_MD("has_section","section"),&ConfigFile::has_section);
ObjectTypeDB::bind_method(_MD("has_section_key","section","key"),&ConfigFile::has_section_key);
diff --git a/core/ustring.cpp b/core/ustring.cpp
index 573c362389..1f0eadc03f 100644
--- a/core/ustring.cpp
+++ b/core/ustring.cpp
@@ -2867,25 +2867,29 @@ CharType String::ord_at(int p_idx) const {
return operator[](p_idx);
}
-String String::strip_edges() const {
+String String::strip_edges(bool left, bool right) const {
int len=length();
int beg=0,end=len;
- for (int i=0;i<length();i++) {
+ if(left) {
+ for (int i=0;i<len;i++) {
- if (operator[](i)<=32)
- beg++;
- else
- break;
+ if (operator[](i)<=32)
+ beg++;
+ else
+ break;
+ }
}
- for (int i=(int)(length()-1);i>=0;i--) {
+ if(right) {
+ for (int i=(int)(len-1);i>=0;i--) {
- if (operator[](i)<=32)
- end--;
- else
- break;
+ if (operator[](i)<=32)
+ end--;
+ else
+ break;
+ }
}
if (beg==0 && end==len)
@@ -3629,13 +3633,14 @@ String String::percent_decode() const {
CharString pe;
- for(int i=0;i<length();i++) {
-
- uint8_t c=operator[](i);
+ CharString cs = utf8();
+ for(int i=0;i<cs.length();i++) {
+
+ uint8_t c = cs[i];
if (c=='%' && i<length()-2) {
- uint8_t a = LOWERCASE(operator[](i+1));
- uint8_t b = LOWERCASE(operator[](i+2));
+ uint8_t a = LOWERCASE(cs[i+1]);
+ uint8_t b = LOWERCASE(cs[i+2]);
c=0;
if (a>='0' && a<='9')
diff --git a/core/ustring.h b/core/ustring.h
index ec0932e54d..78c041fb92 100644
--- a/core/ustring.h
+++ b/core/ustring.h
@@ -169,7 +169,7 @@ public:
String left(int p_pos) const;
String right(int p_pos) const;
- String strip_edges() const;
+ String strip_edges(bool left = true, bool right = true) const;
String strip_escapes() const;
String extension() const;
String basename() const;
diff --git a/core/variant_call.cpp b/core/variant_call.cpp
index f3bf8f9e47..4be763a511 100644
--- a/core/variant_call.cpp
+++ b/core/variant_call.cpp
@@ -257,7 +257,7 @@ static void _call_##m_type##_##m_method(Variant& r_ret,Variant& p_self,const Var
VCALL_LOCALMEM0R(String,to_lower);
VCALL_LOCALMEM1R(String,left);
VCALL_LOCALMEM1R(String,right);
- VCALL_LOCALMEM0R(String,strip_edges);
+ VCALL_LOCALMEM2R(String,strip_edges);
VCALL_LOCALMEM0R(String,extension);
VCALL_LOCALMEM0R(String,basename);
VCALL_LOCALMEM1R(String,plus_file);
@@ -595,6 +595,7 @@ static void _call_##m_type##_##m_method(Variant& r_ret,Variant& p_self,const Var
VCALL_PTR0R(Image, get_data);
VCALL_PTR3(Image, blit_rect);
VCALL_PTR1R(Image, converted);
+ VCALL_PTR0(Image, fix_alpha_edges);
VCALL_PTR0R( AABB, get_area );
VCALL_PTR0R( AABB, has_no_area );
@@ -1276,7 +1277,7 @@ _VariantCall::addfunc(Variant::m_vtype,Variant::m_ret,_SCS(#m_method),VCALL(m_cl
ADDFUNC1(STRING,STRING,String,left,INT,"pos",varray());
ADDFUNC1(STRING,STRING,String,right,INT,"pos",varray());
- ADDFUNC0(STRING,STRING,String,strip_edges,varray());
+ ADDFUNC2(STRING,STRING,String,strip_edges,BOOL,"left",BOOL,"right",varray(true,true));
ADDFUNC0(STRING,STRING,String,extension,varray());
ADDFUNC0(STRING,STRING,String,basename,varray());
ADDFUNC1(STRING,STRING,String,plus_file,STRING,"file",varray());
@@ -1411,6 +1412,7 @@ _VariantCall::addfunc(Variant::m_vtype,Variant::m_ret,_SCS(#m_method),VCALL(m_cl
ADDFUNC0(IMAGE, RAW_ARRAY, Image, get_data, varray());
ADDFUNC3(IMAGE, NIL, Image, blit_rect, IMAGE, "src", RECT2, "src_rect", VECTOR2, "dest", varray(0));
ADDFUNC1(IMAGE, IMAGE, Image, converted, INT, "format", varray(0));
+ ADDFUNC0(IMAGE, NIL, Image, fix_alpha_edges, varray());
ADDFUNC0(_RID,INT,RID,get_id,varray());