2 // Tizen Web Device API
3 // Copyright (c) 2014 Samsung Electronics Co., Ltd.
5 // Licensed under the Apache License, Version 2.0 (the License);
6 // you may not use this file except in compliance with the License.
7 // You may obtain a copy of the License at
9 // http://www.apache.org/licenses/LICENSE-2.0
11 // Unless required by applicable law or agreed to in writing, software
12 // distributed under the License is distributed on an "AS IS" BASIS,
13 // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14 // See the License for the specific language governing permissions and
15 // limitations under the License.
18 #ifndef __TIZEN_ARCHIVE_UNZIP_EXTRACT_REQUEST_H__
19 #define __TIZEN_ARCHIVE_UNZIP_EXTRACT_REQUEST_H__
34 class UnZipExtractRequest
37 static void execute(UnZip& owner,
38 const std::string& extract_path,
39 const std::string& base_strip_path,
40 BaseProgressCallback* callback);
42 ~UnZipExtractRequest();
45 UnZipExtractRequest(UnZip& owner,
46 const std::string& extract_path,
47 const std::string& base_strip_path,
48 BaseProgressCallback* callback);
51 void getCurrentFileInfo();
53 void handleDirectoryEntry();
55 void handleFileEntry();
56 bool prepareOutputSubdirectory();
58 //-----------------------------------------------------------------------------
59 //Input request variables
61 const std::string m_extract_path;
62 const std::string m_base_strip_path;
63 BaseProgressCallback* m_callback;
65 //-----------------------------------------------------------------------------
67 FILE* m_output_file; //Used to write extracted file into output directory
68 char* m_buffer; //Memory buffer passed between Minizip lib and fwrite function
70 bool m_delete_output_file;
71 bool m_close_unz_current_file;
73 unz_file_info m_file_info; //Informations about current archive entry (from minizip)
74 char m_filename_inzip[512]; //Name of archive file entry (from minizip)
75 std::string m_output_filepath; //Extracted output file name with full path
77 FilePathStatus m_new_dir_status;
78 bool m_is_directory_entry; //Is this request for directory
79 std::string m_new_dir_path;
83 } //namespace DeviceAPI
85 #endif // __TIZEN_ARCHIVE_UNZIP_EXTRACT_REQUEST_H__