-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathspreadsheet_cell.cpp
More file actions
53 lines (40 loc) · 879 Bytes
/
spreadsheet_cell.cpp
File metadata and controls
53 lines (40 loc) · 879 Bytes
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
module spreadsheet_cell;
import std;
using namespace std;
SpreadsheetCell::SpreadsheetCell(double initialValue)
{
setValue(initialValue);
}
SpreadsheetCell::SpreadsheetCell(std::string_view initialValue)
{
setString(initialValue);
}
SpreadsheetCell::SpreadsheetCell(const SpreadsheetCell& src)
{
}
SpreadsheetCell& SpreadsheetCell::operator=(const SpreadsheetCell& rhs)
{
if(this == &rhs) {
return *this;
}
m_value = rhs.m_value;
return *this;
}
void SpreadsheetCell::setValue(double value)
{
m_value = value;
}
void SpreadsheetCell::setString(string_view value)
{
m_value = stringToDouble(value);
}
std::string SpreadsheetCell::doubleToString(double value)
{
return to_string(value);
}
double SpreadsheetCell::stringToDouble(std::string_view value)
{
double number{ 0 };
from_chars(value.data(), value.data() + value.size(), number);
return number;
}