Skip to content
Snippets Groups Projects
tratador.cpp 2.1 KiB
Newer Older
#include <iostream>
#include <string>
using namespace std;
#include <fstream>
#define CARACTER_SEPARADOR ';'
/**
* @brief Metodo de Sobrecarga do operador extração
* @param input - stream de entrada, t = objeto do tipo Tratador
*/
std::istream& operator>> (std::istream &input,Tratador &t){
    string aux;
    getline (input,aux,CARACTER_SEPARADOR);
    t.id = atoi(aux.c_str());
    getline (input,aux,CARACTER_SEPARADOR);
    t.funcao = aux;
    getline (input,aux,CARACTER_SEPARADOR);
    t.nome = aux;
    getline (input,aux,CARACTER_SEPARADOR);
    t.cpf = aux;
    getline (input,aux,CARACTER_SEPARADOR);
    t.idade = atoi(aux.c_str());
    getline (input,aux,CARACTER_SEPARADOR);
    t.tipo_sanguineo = aux;
    getline (input,aux,CARACTER_SEPARADOR);
    t.fator_RH = aux;
    getline (input, aux);
    t.especialidade = aux;
    return input;
}
/**
* @brief Metodo de Sobrecarga do operador inserção
* @param output - stream de entrada, t = objeto do tipo Tratador
*/
std::ostream& operator<< (std::ostream &output, Tratador const t) {
output << t.id << ";";
output << t.funcao << ";";
output << t.nome << ";";
output << t.cpf << ";";
output << t.idade << ";";
output << t.tipo_sanguineo << ";";
output << t.fator_RH << ";";
output << t.especialidade << endl;
/**
* @brief Construtor cria um Tratador, que tem Funcionario como classe pai e lhe herda os atributos
* @param identity - ID, role - funçao do tratador, name - nome do tratador, doc_cpf - CPF do tratador,
*					age - idade do tratador, blood_type - tipo sanguineo do tratador, rh_factor - fator RH do tratador,
* 				specialty - especialidade do tratador
*/
Tratador::Tratador(int identity, string role, string name, string doc_cpf, short age, char blood_type, char rh_factor, string specialty):

						Funcionario(identity, role, name, doc_cpf, age, blood_type, rh_factor, specialty)
{}

//Contrutor com valores default
Tratador::Tratador(){
	id = 0;
	funcao = "-";
	cpf = "-";
	nome = "-";
	idade = 0;
	tipo_sanguineo = '-';
	fator_RH = '-';
	especialidade = "-";
}

/**
* @brief Destrutor de Tratador
*/
Tratador::~Tratador(){

}