OLD | NEW |
---|---|
(Empty) | |
1 // Copyright (c) 2011 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 DISK_H__ | |
6 #define DISK_H__ | |
7 | |
8 #include <base/basictypes.h> | |
9 #include <dbus-c++/dbus.h> // NOLINT | |
10 #include <map> | |
11 #include <string> | |
12 #include <vector> | |
13 | |
14 namespace cros_disks { | |
15 | |
16 typedef std::map<std::string, DBus::Variant> DBusDisk; | |
17 typedef std::vector<DBusDisk> DBusDisks; | |
18 | |
19 // A simple type that describes a storage device attached to our system. | |
20 // | |
21 // This class was designed to run in a single threaded context and should not | |
22 // be considered thread safe. | |
23 class Disk { | |
24 public: | |
25 | |
26 Disk(); | |
27 virtual ~Disk(); | |
28 | |
29 bool is_drive() const { return is_drive_; } | |
30 void is_drive(bool is_drive) { is_drive_ = is_drive; } | |
Chris Masone
2011/04/11 02:50:45
Setters should start with set_
| |
31 | |
32 bool is_hidden() const { return is_hidden_; } | |
33 void is_hidden(bool is_hidden) { is_hidden_ = is_hidden; } | |
34 | |
35 bool is_mounted() const { return is_mounted_; } | |
36 void is_mounted(bool is_mounted) { is_mounted_ = is_mounted; } | |
37 | |
38 bool is_media_available() const { return is_media_available_; } | |
39 void is_media_available(bool is_media_available) { | |
40 is_media_available_ = is_media_available; | |
41 } | |
42 | |
43 bool is_rotational() const { return is_rotational_; } | |
44 void is_rotational(bool is_rotational) { is_rotational_ = is_rotational; } | |
45 | |
46 bool is_optical_disk() const { return is_optical_disk_; } | |
47 void is_optical_disk(bool is_optical_disk) { | |
48 is_optical_disk_ = is_optical_disk; | |
49 } | |
50 | |
51 bool is_read_only() const { return is_read_only_; } | |
52 void is_read_only(bool is_read_only) { is_read_only_ = is_read_only; } | |
53 | |
54 std::string mount_path() const { return mount_path_; } | |
Chris Masone
2011/04/11 02:50:45
const std::string&
| |
55 void mount_path(const std::string& mount_path) { mount_path_ = mount_path; } | |
56 | |
57 std::string native_path() const { return native_path_; } | |
58 void native_path(const std::string& native_path) { | |
59 native_path_ = native_path; | |
60 } | |
61 | |
62 std::string device_file() const { return device_file_; } | |
63 void device_file(const std::string& device_file) { | |
64 device_file_ = device_file; | |
65 } | |
66 | |
67 std::string label() const { return label_; } | |
68 void label(const std::string& label) { label_ = label; } | |
69 | |
70 std::string drive_model() const { return drive_model_; } | |
71 void drive_model(const std::string& drive_model) { | |
72 drive_model_ = drive_model; | |
73 } | |
74 | |
75 uint64 device_capacity() const { return device_capacity_; } | |
76 void device_capacity(uint64 device_capacity) { | |
77 device_capacity_ = device_capacity; | |
78 } | |
79 | |
80 uint64 bytes_remaining() { return bytes_remaining_; } | |
81 void bytes_remaining(uint64 bytes_remaining) { | |
82 bytes_remaining_ = bytes_remaining; | |
83 } | |
84 | |
85 private: | |
86 | |
87 bool is_drive_; | |
88 bool is_hidden_; | |
89 bool is_mounted_; | |
90 bool is_media_available_; | |
91 bool is_rotational_; | |
92 bool is_optical_disk_; | |
93 bool is_read_only_; | |
94 std::string mount_path_; | |
95 std::string native_path_; | |
96 std::string device_file_; | |
97 std::string label_; | |
98 std::string drive_model_; | |
99 uint64 device_capacity_; | |
100 uint64 bytes_remaining_; | |
101 }; | |
102 | |
103 } // namespace cros_disks | |
104 | |
105 | |
106 #endif // DISK_H__ | |
OLD | NEW |