-
Notifications
You must be signed in to change notification settings - Fork 0
/
address.h
62 lines (48 loc) · 1.51 KB
/
address.h
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
#ifndef ADDRESS_H
#define ADDRESS_H
#include <string>
#include <iostream>
#include <fstream>
class Address
{
public:
Address();
// GET methods
std::string getStreet() const;
std::string getDoorNumber() const;
std::string getFloor() const;
std::string getZipCode() const;
std::string getLocality() const;
// SET methods
bool setStreet(const std::string street);
bool setDoorNumber(const std::string doorNumber);
bool setFloor(const std::string floor);
bool setZipCode(const std::string zipCode);
bool setLocality(const std::string locality);
// Other methods
/**
Outputs Address to ostream, does not get called on ofstream
*/
friend std::ostream& operator<< (std::ostream& stream, const Address& address);
/**
Literally only differs from a regular ostream because of a goddamned whitespace...
*/
friend std::ofstream& operator<<(std::ofstream& stream, const Address& address);
/**
Read an Address from user input
Ctrl + Z to abort input (returns false)
*/
bool readUserInput();
/**
Call to read an Address from a file (ifstream)
LineTracker is used to be able to produce a better error message in case something breaks
Returns false if the file ends or an unexpected input is found
*/
bool readFromFile(std::ifstream& fin, unsigned int& lineTracker, std::string & error);
private:
std::string street, doorNumber, floor, zipCode, locality;
};
#endif // ADDRESS_H
// T1G02
// up201800170 Breno Accioly
// up201806516 Tiago Silva