Добавил:
farel
Опубликованный материал нарушает ваши авторские права? Сообщите нам.
Вуз:
Предмет:
Файл:
#pragma once
#include "includes.h"
#define INF 1
#define MESS 2
#define FILE 3
HANDLE hConsoleOutput = GetStdHandle(STD_OUTPUT_HANDLE);
class message
{
public:
int type;
std::string name;
std::string info;
std::string text;
message() {};
~message() {};
friend std::ostream& operator<< (std::ostream &os, const message &mess) {
switch (mess.type) {
case INF:
std::cout << mess.text;
break;
case MESS:
SetConsoleTextAttribute(hConsoleOutput, (WORD)((15 << 4) | 0));
std::cout << mess.name << ": " << mess.text;
SetConsoleTextAttribute(hConsoleOutput, (WORD)((0 << 4) | 15));
break;
default:
std::cout << "Невозможно вывести сообщение.";
}
return os;
}
};