//static std::error_condition open_zip(std::unique_ptr<random_read> &&file, ptr &result) noexcept; // open a 7Z file and parse its central directory public static std.error_condition open_7z(string filename, out archive_file result) { // ensure we start with a nullptr result result = null; //result.reset(); // see if we are in the cache, and reopen if so m7z_file_impl newimpl = m7z_file_impl.find_cached(filename); //m7z_file_impl::ptr newimpl(m7z_file_impl::find_cached(filename)); if (newimpl == null) { // allocate memory for the 7z file structure try { newimpl = new m7z_file_impl(filename); } //try { newimpl = std.make_unique<m7z_file_impl>(filename); } catch (Exception e) { return(std.errc.not_enough_memory); } var err = newimpl.initialize(); if (err) { return(err); } } // allocate the archive API wrapper result = new m7z_file_wrapper(newimpl); //result.reset(new (std::nothrow) m7z_file_wrapper(std::move(newimpl))); if (result != null) { return(new std.error_condition()); } else { m7z_file_impl.close(newimpl); //m7z_file_impl::close(std::move(newimpl)); return(std.errc.not_enough_memory); } }
//typedef std::unique_ptr<archive_file> ptr; /* ----- archive file access ----- */ // open a ZIP file and parse its central directory /*------------------------------------------------- * zip_file_open - opens a ZIP file for reading * -------------------------------------------------*/ public static std.error_condition open_zip(string filename, out archive_file result) { //throw new emu_unimplemented(); result = null; return(std.errc.not_supported); }