diff options
Diffstat (limited to 'core/io')
-rw-r--r-- | core/io/config_file.cpp | 3 | ||||
-rw-r--r-- | core/io/file_access_compressed.cpp | 4 | ||||
-rw-r--r-- | core/io/file_access_encrypted.cpp | 4 | ||||
-rw-r--r-- | core/io/file_access_network.cpp | 3 | ||||
-rw-r--r-- | core/io/file_access_pack.cpp | 8 | ||||
-rw-r--r-- | core/io/multiplayer_api.cpp | 2 | ||||
-rw-r--r-- | core/io/packet_peer.cpp | 1 | ||||
-rw-r--r-- | core/io/packet_peer_udp.cpp | 1 | ||||
-rw-r--r-- | core/io/resource_format_binary.cpp | 2 | ||||
-rw-r--r-- | core/io/resource_loader.cpp | 2 | ||||
-rw-r--r-- | core/io/stream_peer.cpp | 24 | ||||
-rw-r--r-- | core/io/translation_loader_po.cpp | 1 | ||||
-rw-r--r-- | core/io/xml_parser.cpp | 8 |
13 files changed, 63 insertions, 0 deletions
diff --git a/core/io/config_file.cpp b/core/io/config_file.cpp index 902d3cde9f..334c8f143e 100644 --- a/core/io/config_file.cpp +++ b/core/io/config_file.cpp @@ -78,6 +78,7 @@ void ConfigFile::set_value(const String &p_section, const String &p_key, const V values[p_section][p_key] = p_value; } } + Variant ConfigFile::get_value(const String &p_section, const String &p_key, Variant p_default) const { if (!values.has(p_section) || !values[p_section].has(p_key)) { ERR_FAIL_COND_V_MSG(p_default.get_type() == Variant::NIL, Variant(), @@ -91,6 +92,7 @@ Variant ConfigFile::get_value(const String &p_section, const String &p_key, Vari bool ConfigFile::has_section(const String &p_section) const { return values.has(p_section); } + bool ConfigFile::has_section_key(const String &p_section, const String &p_key) const { if (!values.has(p_section)) return false; @@ -102,6 +104,7 @@ void ConfigFile::get_sections(List<String> *r_sections) const { r_sections->push_back(E.key()); } } + void ConfigFile::get_section_keys(const String &p_section, List<String> *r_keys) const { ERR_FAIL_COND_MSG(!values.has(p_section), vformat("Cannot get keys from nonexistent section \"%s\".", p_section)); diff --git a/core/io/file_access_compressed.cpp b/core/io/file_access_compressed.cpp index cbb9786af4..422100010c 100644 --- a/core/io/file_access_compressed.cpp +++ b/core/io/file_access_compressed.cpp @@ -132,6 +132,7 @@ Error FileAccessCompressed::_open(const String &p_path, int p_mode_flags) { return OK; } + void FileAccessCompressed::close() { if (!f) return; @@ -221,6 +222,7 @@ void FileAccessCompressed::seek_end(int64_t p_position) { seek(read_total + p_position); } } + size_t FileAccessCompressed::get_position() const { ERR_FAIL_COND_V_MSG(!f, 0, "File must be opened before use."); if (writing) { @@ -229,6 +231,7 @@ size_t FileAccessCompressed::get_position() const { return read_block * block_size + read_pos; } } + size_t FileAccessCompressed::get_len() const { ERR_FAIL_COND_V_MSG(!f, 0, "File must be opened before use."); if (writing) { @@ -277,6 +280,7 @@ uint8_t FileAccessCompressed::get_8() const { return ret; } + int FileAccessCompressed::get_buffer(uint8_t *p_dst, int p_length) const { ERR_FAIL_COND_V_MSG(!f, 0, "File must be opened before use."); ERR_FAIL_COND_V_MSG(writing, 0, "File has not been opened in read mode."); diff --git a/core/io/file_access_encrypted.cpp b/core/io/file_access_encrypted.cpp index aaf21ad143..ceda6c5eb2 100644 --- a/core/io/file_access_encrypted.cpp +++ b/core/io/file_access_encrypted.cpp @@ -113,6 +113,7 @@ Error FileAccessEncrypted::open_and_parse_password(FileAccess *p_base, const Str Error FileAccessEncrypted::_open(const String &p_path, int p_mode_flags) { return OK; } + void FileAccessEncrypted::close() { if (!file) return; @@ -189,9 +190,11 @@ void FileAccessEncrypted::seek(size_t p_position) { void FileAccessEncrypted::seek_end(int64_t p_position) { seek(data.size() + p_position); } + size_t FileAccessEncrypted::get_position() const { return pos; } + size_t FileAccessEncrypted::get_len() const { return data.size(); } @@ -211,6 +214,7 @@ uint8_t FileAccessEncrypted::get_8() const { pos++; return b; } + int FileAccessEncrypted::get_buffer(uint8_t *p_dst, int p_length) const { ERR_FAIL_COND_V_MSG(writing, 0, "File has not been opened in read mode."); diff --git a/core/io/file_access_network.cpp b/core/io/file_access_network.cpp index 690a2bb269..4b7f99e5b0 100644 --- a/core/io/file_access_network.cpp +++ b/core/io/file_access_network.cpp @@ -300,6 +300,7 @@ void FileAccessNetwork::close() { opened = false; nc->unlock_mutex(); } + bool FileAccessNetwork::is_open() const { return opened; } @@ -318,10 +319,12 @@ void FileAccessNetwork::seek(size_t p_position) { void FileAccessNetwork::seek_end(int64_t p_position) { seek(total_size + p_position); } + size_t FileAccessNetwork::get_position() const { ERR_FAIL_COND_V_MSG(!opened, 0, "File must be opened before use."); return pos; } + size_t FileAccessNetwork::get_len() const { ERR_FAIL_COND_V_MSG(!opened, 0, "File must be opened before use."); return total_size; diff --git a/core/io/file_access_pack.cpp b/core/io/file_access_pack.cpp index 4fd4d117af..bb65a1afbc 100644 --- a/core/io/file_access_pack.cpp +++ b/core/io/file_access_pack.cpp @@ -224,12 +224,15 @@ void FileAccessPack::seek(size_t p_position) { f->seek(pf.offset + p_position); pos = p_position; } + void FileAccessPack::seek_end(int64_t p_position) { seek(pf.size + p_position); } + size_t FileAccessPack::get_position() const { return pos; } + size_t FileAccessPack::get_len() const { return pf.size; } @@ -343,12 +346,15 @@ String DirAccessPack::get_next() { return String(); } } + bool DirAccessPack::current_is_dir() const { return cdir; } + bool DirAccessPack::current_is_hidden() const { return false; } + void DirAccessPack::list_dir_end() { list_dirs.clear(); list_files.clear(); @@ -357,6 +363,7 @@ void DirAccessPack::list_dir_end() { int DirAccessPack::get_drive_count() { return 0; } + String DirAccessPack::get_drive(int p_drive) { return ""; } @@ -440,6 +447,7 @@ Error DirAccessPack::make_dir(String p_dir) { Error DirAccessPack::rename(String p_from, String p_to) { return ERR_UNAVAILABLE; } + Error DirAccessPack::remove(String p_name) { return ERR_UNAVAILABLE; } diff --git a/core/io/multiplayer_api.cpp b/core/io/multiplayer_api.cpp index b819725155..a2f65660f2 100644 --- a/core/io/multiplayer_api.cpp +++ b/core/io/multiplayer_api.cpp @@ -179,6 +179,7 @@ void _profile_node_data(const String &p_what, ObjectID p_id) { EngineDebugger::profiler_add_frame_data("multiplayer", values); } } + void _profile_bandwidth_data(const String &p_inout, int p_size) { if (EngineDebugger::is_profiling("multiplayer")) { Array values; @@ -668,6 +669,7 @@ Error MultiplayerAPI::_encode_and_compress_variant(const Variant &p_variant, uin return OK; } + Error MultiplayerAPI::_decode_and_decompress_variant(Variant &r_variant, const uint8_t *p_buffer, int p_len, int *r_len) { const uint8_t *buf = p_buffer; int len = p_len; diff --git a/core/io/packet_peer.cpp b/core/io/packet_peer.cpp index 34fb5510b9..fe1c9a2eb1 100644 --- a/core/io/packet_peer.cpp +++ b/core/io/packet_peer.cpp @@ -117,6 +117,7 @@ Variant PacketPeer::_bnd_get_var(bool p_allow_objects) { Error PacketPeer::_put_packet(const Vector<uint8_t> &p_buffer) { return put_packet_buffer(p_buffer); } + Vector<uint8_t> PacketPeer::_get_packet() { Vector<uint8_t> raw; last_get_error = get_packet_buffer(raw); diff --git a/core/io/packet_peer_udp.cpp b/core/io/packet_peer_udp.cpp index 0640d56c47..e36de8c228 100644 --- a/core/io/packet_peer_udp.cpp +++ b/core/io/packet_peer_udp.cpp @@ -291,6 +291,7 @@ Error PacketPeerUDP::_poll() { return OK; } + bool PacketPeerUDP::is_listening() const { return _sock.is_valid() && _sock->is_open(); } diff --git a/core/io/resource_format_binary.cpp b/core/io/resource_format_binary.cpp index 77fe331929..230925c29b 100644 --- a/core/io/resource_format_binary.cpp +++ b/core/io/resource_format_binary.cpp @@ -607,6 +607,7 @@ void ResourceLoaderBinary::set_local_path(const String &p_local_path) { Ref<Resource> ResourceLoaderBinary::get_resource() { return resource; } + Error ResourceLoaderBinary::load() { if (error != OK) return error; @@ -996,6 +997,7 @@ void ResourceFormatLoaderBinary::get_recognized_extensions_for_type(const String p_extensions->push_back(ext); } } + void ResourceFormatLoaderBinary::get_recognized_extensions(List<String> *p_extensions) const { List<String> extensions; ClassDB::get_resource_base_extensions(&extensions); diff --git a/core/io/resource_loader.cpp b/core/io/resource_loader.cpp index 361f40cbc6..8490cb5627 100644 --- a/core/io/resource_loader.cpp +++ b/core/io/resource_loader.cpp @@ -260,6 +260,7 @@ void ResourceLoader::_thread_load_function(void *p_userdata) { thread_load_mutex->unlock(); } + Error ResourceLoader::load_threaded_request(const String &p_path, const String &p_type_hint, bool p_use_sub_threads, const String &p_source_resource) { String local_path; if (p_path.is_rel_path()) @@ -412,6 +413,7 @@ ResourceLoader::ThreadLoadStatus ResourceLoader::load_threaded_get_status(const return status; } + RES ResourceLoader::load_threaded_get(const String &p_path, Error *r_error) { String local_path; if (p_path.is_rel_path()) diff --git a/core/io/stream_peer.cpp b/core/io/stream_peer.cpp index 2e63adcae9..e6175e78da 100644 --- a/core/io/stream_peer.cpp +++ b/core/io/stream_peer.cpp @@ -122,6 +122,7 @@ void StreamPeer::put_u8(uint8_t p_val) { void StreamPeer::put_8(int8_t p_val) { put_data((const uint8_t *)&p_val, 1); } + void StreamPeer::put_u16(uint16_t p_val) { if (big_endian) { p_val = BSWAP16(p_val); @@ -130,6 +131,7 @@ void StreamPeer::put_u16(uint16_t p_val) { encode_uint16(p_val, buf); put_data(buf, 2); } + void StreamPeer::put_16(int16_t p_val) { if (big_endian) { p_val = BSWAP16(p_val); @@ -138,6 +140,7 @@ void StreamPeer::put_16(int16_t p_val) { encode_uint16(p_val, buf); put_data(buf, 2); } + void StreamPeer::put_u32(uint32_t p_val) { if (big_endian) { p_val = BSWAP32(p_val); @@ -146,6 +149,7 @@ void StreamPeer::put_u32(uint32_t p_val) { encode_uint32(p_val, buf); put_data(buf, 4); } + void StreamPeer::put_32(int32_t p_val) { if (big_endian) { p_val = BSWAP32(p_val); @@ -154,6 +158,7 @@ void StreamPeer::put_32(int32_t p_val) { encode_uint32(p_val, buf); put_data(buf, 4); } + void StreamPeer::put_u64(uint64_t p_val) { if (big_endian) { p_val = BSWAP64(p_val); @@ -162,6 +167,7 @@ void StreamPeer::put_u64(uint64_t p_val) { encode_uint64(p_val, buf); put_data(buf, 8); } + void StreamPeer::put_64(int64_t p_val) { if (big_endian) { p_val = BSWAP64(p_val); @@ -170,6 +176,7 @@ void StreamPeer::put_64(int64_t p_val) { encode_uint64(p_val, buf); put_data(buf, 8); } + void StreamPeer::put_float(float p_val) { uint8_t buf[4]; @@ -181,6 +188,7 @@ void StreamPeer::put_float(float p_val) { put_data(buf, 4); } + void StreamPeer::put_double(double p_val) { uint8_t buf[8]; encode_double(p_val, buf); @@ -190,16 +198,19 @@ void StreamPeer::put_double(double p_val) { } put_data(buf, 8); } + void StreamPeer::put_string(const String &p_string) { CharString cs = p_string.ascii(); put_u32(cs.length()); put_data((const uint8_t *)cs.get_data(), cs.length()); } + void StreamPeer::put_utf8_string(const String &p_string) { CharString cs = p_string.utf8(); put_u32(cs.length()); put_data((const uint8_t *)cs.get_data(), cs.length()); } + void StreamPeer::put_var(const Variant &p_variant, bool p_full_objects) { int len = 0; Vector<uint8_t> buf; @@ -215,11 +226,13 @@ uint8_t StreamPeer::get_u8() { get_data(buf, 1); return buf[0]; } + int8_t StreamPeer::get_8() { uint8_t buf[1]; get_data(buf, 1); return buf[0]; } + uint16_t StreamPeer::get_u16() { uint8_t buf[2]; get_data(buf, 2); @@ -229,6 +242,7 @@ uint16_t StreamPeer::get_u16() { } return r; } + int16_t StreamPeer::get_16() { uint8_t buf[2]; get_data(buf, 2); @@ -238,6 +252,7 @@ int16_t StreamPeer::get_16() { } return r; } + uint32_t StreamPeer::get_u32() { uint8_t buf[4]; get_data(buf, 4); @@ -247,6 +262,7 @@ uint32_t StreamPeer::get_u32() { } return r; } + int32_t StreamPeer::get_32() { uint8_t buf[4]; get_data(buf, 4); @@ -256,6 +272,7 @@ int32_t StreamPeer::get_32() { } return r; } + uint64_t StreamPeer::get_u64() { uint8_t buf[8]; get_data(buf, 8); @@ -265,6 +282,7 @@ uint64_t StreamPeer::get_u64() { } return r; } + int64_t StreamPeer::get_64() { uint8_t buf[8]; get_data(buf, 8); @@ -274,6 +292,7 @@ int64_t StreamPeer::get_64() { } return r; } + float StreamPeer::get_float() { uint8_t buf[4]; get_data(buf, 4); @@ -297,6 +316,7 @@ double StreamPeer::get_double() { return decode_double(buf); } + String StreamPeer::get_string(int p_bytes) { if (p_bytes < 0) p_bytes = get_u32(); @@ -310,6 +330,7 @@ String StreamPeer::get_string(int p_bytes) { buf.write[p_bytes] = 0; return buf.ptr(); } + String StreamPeer::get_utf8_string(int p_bytes) { if (p_bytes < 0) p_bytes = get_u32(); @@ -325,6 +346,7 @@ String StreamPeer::get_utf8_string(int p_bytes) { ret.parse_utf8((const char *)buf.ptr(), buf.size()); return ret; } + Variant StreamPeer::get_var(bool p_allow_objects) { int len = get_32(); Vector<uint8_t> var; @@ -382,6 +404,7 @@ void StreamPeer::_bind_methods() { ADD_PROPERTY(PropertyInfo(Variant::BOOL, "big_endian"), "set_big_endian", "is_big_endian_enabled"); } + //////////////////////////////// void StreamPeerBuffer::_bind_methods() { @@ -455,6 +478,7 @@ void StreamPeerBuffer::seek(int p_pos) { ERR_FAIL_COND(p_pos > data.size()); pointer = p_pos; } + int StreamPeerBuffer::get_size() const { return data.size(); } diff --git a/core/io/translation_loader_po.cpp b/core/io/translation_loader_po.cpp index b47e634a5a..5e109699f5 100644 --- a/core/io/translation_loader_po.cpp +++ b/core/io/translation_loader_po.cpp @@ -190,6 +190,7 @@ void TranslationLoaderPO::get_recognized_extensions(List<String> *p_extensions) p_extensions->push_back("po"); //p_extensions->push_back("mo"); //mo in the future... } + bool TranslationLoaderPO::handles_type(const String &p_type) const { return (p_type == "Translation"); } diff --git a/core/io/xml_parser.cpp b/core/io/xml_parser.cpp index 2926f4c92a..d575e75f0c 100644 --- a/core/io/xml_parser.cpp +++ b/core/io/xml_parser.cpp @@ -390,6 +390,7 @@ Error XMLParser::read() { XMLParser::NodeType XMLParser::get_node_type() { return node_type; } + String XMLParser::get_node_data() const { ERR_FAIL_COND_V(node_type != NODE_TEXT, ""); return node_name; @@ -399,17 +400,21 @@ String XMLParser::get_node_name() const { ERR_FAIL_COND_V(node_type == NODE_TEXT, ""); return node_name; } + int XMLParser::get_attribute_count() const { return attributes.size(); } + String XMLParser::get_attribute_name(int p_idx) const { ERR_FAIL_INDEX_V(p_idx, attributes.size(), ""); return attributes[p_idx].name; } + String XMLParser::get_attribute_value(int p_idx) const { ERR_FAIL_INDEX_V(p_idx, attributes.size(), ""); return attributes[p_idx].value; } + bool XMLParser::has_attribute(const String &p_name) const { for (int i = 0; i < attributes.size(); i++) { if (attributes[i].name == p_name) @@ -418,6 +423,7 @@ bool XMLParser::has_attribute(const String &p_name) const { return false; } + String XMLParser::get_attribute_value(const String &p_name) const { int idx = -1; for (int i = 0; i < attributes.size(); i++) { @@ -445,6 +451,7 @@ String XMLParser::get_attribute_value_safe(const String &p_name) const { return ""; return attributes[idx].value; } + bool XMLParser::is_empty() const { return node_empty; } @@ -526,6 +533,7 @@ XMLParser::XMLParser() { special_characters.push_back("\"quot;"); special_characters.push_back("'apos;"); } + XMLParser::~XMLParser() { if (data) memdelete_arr(data); |