Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(83)

Side by Side Diff: ui/file_manager/zip_archiver/cpp/volume_archive.h

Issue 2807063002: Replace Libarchive with MiniZip. (Closed)
Patch Set: Delete BUILD.gn Created 3 years, 8 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
1 // Copyright 2014 The Chromium OS Authors. All rights reserved. 1 // Copyright 2014 The Chromium OS Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #ifndef VOLUME_ARCHIVE_H_ 5 #ifndef VOLUME_ARCHIVE_H_
6 #define VOLUME_ARCHIVE_H_ 6 #define VOLUME_ARCHIVE_H_
7 7
8 #include <string> 8 #include <string>
9 9
10 #include "volume_reader.h" 10 #include "volume_reader.h"
(...skipping 13 matching lines...) Expand all
24 RESULT_FAIL, 24 RESULT_FAIL,
25 }; 25 };
26 26
27 // Initializes VolumeArchive. Should be called only once. 27 // Initializes VolumeArchive. Should be called only once.
28 // In case of any errors call VolumeArchive::Cleanup and the error message can 28 // In case of any errors call VolumeArchive::Cleanup and the error message can
29 // be obtained with VolumeArchive::error_message(). Encoding is the default 29 // be obtained with VolumeArchive::error_message(). Encoding is the default
30 // encoding. Note, that other encoding may be used if specified in the 30 // encoding. Note, that other encoding may be used if specified in the
31 // archive file. 31 // archive file.
32 virtual bool Init(const std::string& encoding) = 0; 32 virtual bool Init(const std::string& encoding) = 0;
33 33
34 // Gets the next header. In case of failure the error message can be 34 // Gets the next header. If path_name is set to NULL, then there are no more
35 // obtained with VolumeArchive::error_message(). 35 // available headers. Returns true if reading next header was successful.
36 virtual Result GetNextHeader() = 0; 36 // In case of failure the error message can be obtained with
37 virtual Result GetNextHeader(const char** path_name, 37 // VolumeArchive::error_message().
38 int64_t* size, 38 virtual VolumeArchive::Result GetCurrentFileInfo(
39 bool* is_directory, 39 std::string* path_name,
40 time_t* modification_time) = 0; 40 int64_t* size,
41 bool* is_directory,
42 time_t* modification_time) = 0;
43
44 virtual VolumeArchive::Result GoToNextFile() = 0;
41 45
42 // Seeks to the |index|-th header. 46 // Seeks to the |index|-th header.
mtomasz 2017/04/10 07:15:09 nit: Please update comment.
takise 2017/04/11 06:00:51 Done.
43 virtual bool SeekHeader(int64_t index) = 0; 47 virtual bool SeekHeader(const std::string& path_name) = 0;
44 48
45 // Gets data from offset to offset + length for the file reached with 49 // Gets data from offset to offset + length for the file reached with
46 // VolumeArchive::GetNextHeader. The data is stored in an internal buffer 50 // VolumeArchive::GetNextHeader. The data is stored in an internal buffer
47 // in the implementation of VolumeArchive and it will be returned 51 // in the implementation of VolumeArchive and it will be returned
48 // via *buffer parameter to avoid an extra copy. *buffer is owned by 52 // via *buffer parameter to avoid an extra copy. *buffer is owned by
49 // VolumeArchive. 53 // VolumeArchive.
50 // 54 //
51 // Supports file seek by using the offset parameter. In case offset is less 55 // Supports file seek by using the offset parameter. In case offset is less
52 // then last VolumeArchive::ReadData offset, then the read will be restarted 56 // then last VolumeArchive::ReadData offset, then the read will be restarted
53 // from the beginning of the archive. 57 // from the beginning of the archive.
(...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after
92 void set_error_message(const std::string& error_message) { 96 void set_error_message(const std::string& error_message) {
93 error_message_ = error_message; 97 error_message_ = error_message;
94 } 98 }
95 99
96 private: 100 private:
97 VolumeReader* reader_; // The reader that actually reads the archive data. 101 VolumeReader* reader_; // The reader that actually reads the archive data.
98 std::string error_message_; // An error message set in case of any errors. 102 std::string error_message_; // An error message set in case of any errors.
99 }; 103 };
100 104
101 #endif // VOLUME_ARCHIVE_H_ 105 #endif // VOLUME_ARCHIVE_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698