This repository was archived by the owner on Apr 21, 2022. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathstorage.cpp
More file actions
154 lines (147 loc) · 3.09 KB
/
Copy pathstorage.cpp
File metadata and controls
154 lines (147 loc) · 3.09 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
/**
* @file storage.cpp
* @brief The implementation for the Storage class.
*
* @author Evan Elias Young
* @date 2019-03-25
* @date 2020-02-29
* @copyright Copyright 2019-2020 Evan Elias Young. All rights reserved.
*/
#include "pch.h"
#include "storage.h"
#include "os.h"
#include "utils.h"
#pragma region "Contructors"
/**
* @brief Construct a new Graphics object
*/
Storage::Storage()
{
name = "";
identifier = "";
type = "";
filesystem = "";
mount = "";
total = 0;
physical = "";
uuid = "";
label = "";
model = "";
serial = "";
removable = false;
protocol = "";
}
/**
* @brief Construct a new Graphics object
*
* @param nm The name
* @param id The ID
* @param tp The type
* @param fs The filesystem
* @param mnt The mount point
* @param ttl The total storage
* @param psy The physical location
* @param uid The UUID
* @param lbl The drive label
* @param mdl The model number
* @param srl The serial number
* @param rmv Whether or not it's removable
* @param prt The drive protocol
*/
Storage::Storage(std::string nm, std::string id, std::string tp, std::string fs, std::string mnt, std::uint64_t ttl, std::string psy, std::string uid, std::string lbl, std::string mdl, std::string srl, bool rmv, std::string prt)
{
name = nm;
identifier = id;
type = tp;
filesystem = fs;
mount = mnt;
total = ttl;
physical = psy;
uuid = uid;
label = lbl;
model = mdl;
serial = srl;
removable = rmv;
protocol = prt;
}
/**
* @brief Construct a new Storage object from another Storage object
*
* @param o The Storage object to copy from
*/
Storage::Storage(const Storage &o)
{
name = o.name;
identifier = o.identifier;
type = o.type;
filesystem = o.filesystem;
mount = o.mount;
total = o.total;
physical = o.physical;
uuid = o.uuid;
label = o.label;
model = o.model;
serial = o.serial;
removable = o.removable;
protocol = o.protocol;
}
#pragma endregion "Contructors"
#pragma region "Operators"
/**
* @brief Reserves memory for a new Storage object
*
* @param size The amount of memory to allocate
* @return void* A pointer to the allocated memory
*/
void *Storage::operator new(std::size_t size)
{
void *o = ::new (Storage);
return o;
}
/**
* @brief Sets equal two Storage objects
*
* @param o The Storage object to copy from
*/
void Storage::operator=(const Storage &o)
{
if (&o == this)
{
return;
}
name = o.name;
identifier = o.identifier;
type = o.type;
filesystem = o.filesystem;
mount = o.mount;
total = o.total;
physical = o.physical;
uuid = o.uuid;
label = o.label;
model = o.model;
serial = o.serial;
removable = o.removable;
protocol = o.protocol;
}
/**
* @brief Sets equal two Storage objects
*
* @param o The Storage object to copy from
*/
void Storage::operator=(Storage *o)
{
name = o->name;
identifier = o->identifier;
type = o->type;
filesystem = o->filesystem;
mount = o->mount;
total = o->total;
physical = o->physical;
uuid = o->uuid;
label = o->label;
model = o->model;
serial = o->serial;
removable = o->removable;
protocol = o->protocol;
}
#pragma endregion "Operators"