Browse Source

core_bind: Use the appropriate enum instead of int

Ignacio Etcheverry 6 years ago
parent
commit
ebe2f4ea09
2 changed files with 15 additions and 14 deletions
  1. 7 7
      core/bind/core_bind.cpp
  2. 8 7
      core/bind/core_bind.h

+ 7 - 7
core/bind/core_bind.cpp

@@ -148,7 +148,7 @@ _ResourceLoader::_ResourceLoader() {
 	singleton = this;
 	singleton = this;
 }
 }
 
 
-Error _ResourceSaver::save(const String &p_path, const RES &p_resource, uint32_t p_flags) {
+Error _ResourceSaver::save(const String &p_path, const RES &p_resource, SaverFlags p_flags) {
 
 
 	ERR_FAIL_COND_V(p_resource.is_null(), ERR_INVALID_PARAMETER);
 	ERR_FAIL_COND_V(p_resource.is_null(), ERR_INVALID_PARAMETER);
 	return ResourceSaver::save(p_path, p_resource, p_flags);
 	return ResourceSaver::save(p_path, p_resource, p_flags);
@@ -1579,7 +1579,7 @@ _Geometry::_Geometry() {
 
 
 ///////////////////////// FILE
 ///////////////////////// FILE
 
 
-Error _File::open_encrypted(const String &p_path, int p_mode_flags, const Vector<uint8_t> &p_key) {
+Error _File::open_encrypted(const String &p_path, ModeFlags p_mode_flags, const Vector<uint8_t> &p_key) {
 
 
 	Error err = open(p_path, p_mode_flags);
 	Error err = open(p_path, p_mode_flags);
 	if (err)
 	if (err)
@@ -1596,7 +1596,7 @@ Error _File::open_encrypted(const String &p_path, int p_mode_flags, const Vector
 	return OK;
 	return OK;
 }
 }
 
 
-Error _File::open_encrypted_pass(const String &p_path, int p_mode_flags, const String &p_pass) {
+Error _File::open_encrypted_pass(const String &p_path, ModeFlags p_mode_flags, const String &p_pass) {
 
 
 	Error err = open(p_path, p_mode_flags);
 	Error err = open(p_path, p_mode_flags);
 	if (err)
 	if (err)
@@ -1614,7 +1614,7 @@ Error _File::open_encrypted_pass(const String &p_path, int p_mode_flags, const S
 	return OK;
 	return OK;
 }
 }
 
 
-Error _File::open_compressed(const String &p_path, int p_mode_flags, int p_compress_mode) {
+Error _File::open_compressed(const String &p_path, ModeFlags p_mode_flags, CompressionMode p_compress_mode) {
 
 
 	FileAccessCompressed *fac = memnew(FileAccessCompressed);
 	FileAccessCompressed *fac = memnew(FileAccessCompressed);
 
 
@@ -1631,7 +1631,7 @@ Error _File::open_compressed(const String &p_path, int p_mode_flags, int p_compr
 	return OK;
 	return OK;
 }
 }
 
 
-Error _File::open(const String &p_path, int p_mode_flags) {
+Error _File::open(const String &p_path, ModeFlags p_mode_flags) {
 
 
 	close();
 	close();
 	Error err;
 	Error err;
@@ -2453,12 +2453,12 @@ void _Thread::_start_func(void *ud) {
 	}
 	}
 }
 }
 
 
-Error _Thread::start(Object *p_instance, const StringName &p_method, const Variant &p_userdata, int p_priority) {
+Error _Thread::start(Object *p_instance, const StringName &p_method, const Variant &p_userdata, Priority p_priority) {
 
 
 	ERR_FAIL_COND_V(active, ERR_ALREADY_IN_USE);
 	ERR_FAIL_COND_V(active, ERR_ALREADY_IN_USE);
 	ERR_FAIL_COND_V(!p_instance, ERR_INVALID_PARAMETER);
 	ERR_FAIL_COND_V(!p_instance, ERR_INVALID_PARAMETER);
 	ERR_FAIL_COND_V(p_method == StringName(), ERR_INVALID_PARAMETER);
 	ERR_FAIL_COND_V(p_method == StringName(), ERR_INVALID_PARAMETER);
-	ERR_FAIL_INDEX_V(p_priority, 3, ERR_INVALID_PARAMETER);
+	ERR_FAIL_INDEX_V(p_priority, PRIORITY_MAX, ERR_INVALID_PARAMETER);
 
 
 	ret = Variant();
 	ret = Variant();
 	target_method = p_method;
 	target_method = p_method;

+ 8 - 7
core/bind/core_bind.h

@@ -85,7 +85,7 @@ public:
 
 
 	static _ResourceSaver *get_singleton() { return singleton; }
 	static _ResourceSaver *get_singleton() { return singleton; }
 
 
-	Error save(const String &p_path, const RES &p_resource, uint32_t p_flags);
+	Error save(const String &p_path, const RES &p_resource, SaverFlags p_flags);
 	PoolVector<String> get_recognized_extensions(const RES &p_resource);
 	PoolVector<String> get_recognized_extensions(const RES &p_resource);
 
 
 	_ResourceSaver();
 	_ResourceSaver();
@@ -436,11 +436,11 @@ public:
 		COMPRESSION_GZIP = Compression::MODE_GZIP
 		COMPRESSION_GZIP = Compression::MODE_GZIP
 	};
 	};
 
 
-	Error open_encrypted(const String &p_path, int p_mode_flags, const Vector<uint8_t> &p_key);
-	Error open_encrypted_pass(const String &p_path, int p_mode_flags, const String &p_pass);
-	Error open_compressed(const String &p_path, int p_mode_flags, int p_compress_mode = 0);
+	Error open_encrypted(const String &p_path, ModeFlags p_mode_flags, const Vector<uint8_t> &p_key);
+	Error open_encrypted_pass(const String &p_path, ModeFlags p_mode_flags, const String &p_pass);
+	Error open_compressed(const String &p_path, ModeFlags p_mode_flags, CompressionMode p_compress_mode = COMPRESSION_FASTLZ);
 
 
-	Error open(const String &p_path, int p_mode_flags); ///< open a file
+	Error open(const String &p_path, ModeFlags p_mode_flags); ///< open a file
 	void close(); ///< close a file
 	void close(); ///< close a file
 	bool is_open() const; ///< true when file is open
 	bool is_open() const; ///< true when file is open
 
 
@@ -632,10 +632,11 @@ public:
 
 
 		PRIORITY_LOW,
 		PRIORITY_LOW,
 		PRIORITY_NORMAL,
 		PRIORITY_NORMAL,
-		PRIORITY_HIGH
+		PRIORITY_HIGH,
+		PRIORITY_MAX
 	};
 	};
 
 
-	Error start(Object *p_instance, const StringName &p_method, const Variant &p_userdata = Variant(), int p_priority = PRIORITY_NORMAL);
+	Error start(Object *p_instance, const StringName &p_method, const Variant &p_userdata = Variant(), Priority p_priority = PRIORITY_NORMAL);
 	String get_id() const;
 	String get_id() const;
 	bool is_active() const;
 	bool is_active() const;
 	Variant wait_to_finish();
 	Variant wait_to_finish();