blob: e8434227025cc000045c64a114fbff5b0f16b810 [file] [log] [blame]
Lei Zhang91af91d2012-08-03 11:02:20 -07001// Copyright (c) 2012 The Chromium OS Authors. All rights reserved.
2// Use of this source code is governed by a BSD-style license that can be
3// found in the LICENSE file.
4
5#ifndef MTPD_FILE_ENTRY_H_
6#define MTPD_FILE_ENTRY_H_
7
8#include <libmtp.h>
9
Lei Zhang91af91d2012-08-03 11:02:20 -070010#include <string>
11#include <vector>
12
13#include <base/basictypes.h>
14
Lei Zhangfa9e19a2012-08-31 14:36:59 -070015#include "mtp_file_entry.pb.h"
Lei Zhang91af91d2012-08-03 11:02:20 -070016
Lei Zhangfa9e19a2012-08-31 14:36:59 -070017namespace mtpd {
Lei Zhang91af91d2012-08-03 11:02:20 -070018
19class FileEntry {
20 public:
21 explicit FileEntry(const LIBMTP_file_struct& file);
Lei Zhangfa9e19a2012-08-31 14:36:59 -070022 FileEntry();
Lei Zhang91af91d2012-08-03 11:02:20 -070023 ~FileEntry();
24
Lei Zhangfa9e19a2012-08-31 14:36:59 -070025 MtpFileEntry ToProtobuf() const;
26 std::string ToDBusFormat() const;
27
28 static std::string EmptyFileEntriesToDBusFormat();
29 static std::string FileEntriesToDBusFormat(std::vector<FileEntry>& entries);
Lei Zhang91af91d2012-08-03 11:02:20 -070030
Lei Zhang12f55c22012-09-05 14:54:48 -070031 uint32_t item_id() const { return item_id_; }
32 uint32_t parent_id() const { return parent_id_; }
33 const std::string& file_name() const { return file_name_; }
34 uint64_t file_size() const { return file_size_; }
35 time_t modification_time() const { return modification_time_; }
36 LIBMTP_filetype_t file_type() const { return file_type_; }
37
Lei Zhang91af91d2012-08-03 11:02:20 -070038 private:
39 uint32_t item_id_;
40 uint32_t parent_id_;
41 std::string file_name_;
42 uint64_t file_size_;
Lei Zhangfa9e19a2012-08-31 14:36:59 -070043 time_t modification_time_;
Lei Zhang91af91d2012-08-03 11:02:20 -070044 LIBMTP_filetype_t file_type_;
45};
46
47} // namespace mtpd
48
49#endif // MTPD_FILE_ENTRY_H_