-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathEmployee.h
More file actions
59 lines (51 loc) · 1.63 KB
/
Employee.h
File metadata and controls
59 lines (51 loc) · 1.63 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
//
// Employee.h
// xml
//
// Created by Kirsti Norton on 2/25/14.
// Copyright (c) 2014 Kirsti Norton. All rights reserved.
//
#include "parse.h"
#include <string>
#include <iostream>
#include <vector>
#ifndef __xml__Employee__
#define __xml__Employee__
class Employee {
std::string name = "";
int id = 0;
std::string address = "";
std::string city = "";
std::string state = "";
std::string country = "";
std::string phone = "";
double salary = 0.0;
static Parse p;
struct emprec { // Used for file transfer
int id;
char name[31];
char address[26];
char city[21];
char state[21];
char country[21];
char phone[21];
int salary;
};
public:
Employee() {}
Employee(int id, std::string name, std::string address = NULL, std::string city = NULL,
std::string state = NULL, std::string country = NULL, std::string phone = NULL, double salary = NULL)
: id(id), name(name), address(address), city(city), state(state), country(country), phone(phone), salary(salary) {}
void display(std::ostream&) const;
void write(std::ostream&) const;
void store(std::iostream&) const;
void toXML(std::ostream&) const;
void setSalary(const double s) { salary = s; }
const double getSalary() { return salary; }
bool isValid() const { return (id != 0) && name.compare(""); }
static Employee* read(std::istream&);
static Employee* retrieve(std::istream&,int);
static Employee* fromXML(std::istream&);
static size_t recordSize() { return sizeof(emprec); }
};
#endif /* defined(__xml__Employee__) */