atrooney-online-2/src/chatlogpiece.cpp
Crystalwarrior c8e12558cd Clang-ify the code with this styling using Visual Studio Code:
{ BasedOnStyle: LLVM, UseTab: Never, IndentWidth: 4, TabWidth: 4, BreakBeforeBraces: Stroustrup, AllowShortIfStatementsOnASingleLine: false, IndentCaseLabels: false, ColumnLimit: 0, AccessModifierOffset: -4, NamespaceIndentation: All }
(this is the Visual Studio preset with only "BreakBeforeBraces" changed from Allman to Stroustrup)
2020-05-22 01:18:24 +03:00

78 lines
1.4 KiB
C++

#include "chatlogpiece.h"
chatlogpiece::chatlogpiece()
{
name = "UNKNOWN";
showname = "UNKNOWN";
message = "UNKNOWN";
p_is_song = false;
datetime = QDateTime::currentDateTime().toUTC();
}
chatlogpiece::chatlogpiece(QString p_name, QString p_showname, QString p_message, bool p_song)
{
name = p_name;
showname = p_showname;
message = p_message;
p_is_song = p_song;
datetime = QDateTime::currentDateTime().toUTC();
}
chatlogpiece::chatlogpiece(QString p_name, QString p_showname, QString p_message, bool p_song, QDateTime p_datetime)
{
name = p_name;
showname = p_showname;
message = p_message;
p_is_song = p_song;
datetime = p_datetime.toUTC();
}
QString chatlogpiece::get_name()
{
return name;
}
QString chatlogpiece::get_showname()
{
return showname;
}
QString chatlogpiece::get_message()
{
return message;
}
QDateTime chatlogpiece::get_datetime()
{
return datetime;
}
bool chatlogpiece::is_song()
{
return p_is_song;
}
QString chatlogpiece::get_datetime_as_string()
{
return datetime.toString();
}
QString chatlogpiece::get_full()
{
QString full = "[";
full.append(get_datetime_as_string());
full.append("] ");
full.append(get_showname());
full.append(" (");
full.append(get_name());
full.append(")");
if (p_is_song)
full.append(" has played a song: ");
else
full.append(": ");
full.append(get_message());
return full;
}