aboutsummaryrefslogtreecommitdiff
path: root/src/aopacket.cpp
diff options
context:
space:
mode:
authoroldmud0 <oldmud0@users.noreply.github.com>2020-04-17 21:57:16 -0500
committeroldmud0 <oldmud0@users.noreply.github.com>2020-04-17 21:57:16 -0500
commit13942345c6a3e7e1625c6c26cc2f2f368a3bff23 (patch)
tree73ce940217b57fd47afb6a95e828e6309ed5e683 /src/aopacket.cpp
parentfaac191f0b9e99b82614ed3959ec5c67f56a1fc3 (diff)
Run clang-format on entire project
Indentation fixed to 2 spaces per tab. Braces set to Stroustrup style. Lines reflow at 80 characters. One-line method bodies are on the same line as the signature. Space always after `//`. No indentation on preprocessor macros. Includes are sorted lexicographically. If you don't want to see this commit on blames, use the hidden whitespace option on GitHub, or use `-w` in git-blame.
Diffstat (limited to 'src/aopacket.cpp')
-rw-r--r--src/aopacket.cpp29
1 files changed, 13 insertions, 16 deletions
diff --git a/src/aopacket.cpp b/src/aopacket.cpp
index b957efea..6afd39e7 100644
--- a/src/aopacket.cpp
+++ b/src/aopacket.cpp
@@ -8,8 +8,7 @@ AOPacket::AOPacket(QString p_packet_string)
m_header = packet_contents.at(0);
- for(int n_string = 1 ; n_string < packet_contents.size() - 1 ; ++n_string)
- {
+ for (int n_string = 1; n_string < packet_contents.size() - 1; ++n_string) {
m_contents.append(packet_contents.at(n_string));
}
}
@@ -20,23 +19,18 @@ AOPacket::AOPacket(QString p_header, QStringList &p_contents)
m_contents = p_contents;
}
-AOPacket::~AOPacket()
-{
-
-}
+AOPacket::~AOPacket() {}
QString AOPacket::to_string()
{
QString f_string = m_header;
- for (QString i_string : m_contents)
- {
+ for (QString i_string : m_contents) {
f_string += ("#" + i_string);
}
f_string += "#%";
-
if (encrypted)
return "#" + f_string;
else
@@ -59,10 +53,12 @@ void AOPacket::decrypt_header(unsigned int p_key)
void AOPacket::net_encode()
{
- for (int n_element = 0 ; n_element < m_contents.size() ; ++n_element)
- {
+ for (int n_element = 0; n_element < m_contents.size(); ++n_element) {
QString f_element = m_contents.at(n_element);
- f_element.replace("#", "<num>").replace("%", "<percent>").replace("$", "<dollar>").replace("&", "<and>");
+ f_element.replace("#", "<num>")
+ .replace("%", "<percent>")
+ .replace("$", "<dollar>")
+ .replace("&", "<and>");
m_contents.removeAt(n_element);
m_contents.insert(n_element, f_element);
@@ -71,13 +67,14 @@ void AOPacket::net_encode()
void AOPacket::net_decode()
{
- for (int n_element = 0 ; n_element < m_contents.size() ; ++n_element)
- {
+ for (int n_element = 0; n_element < m_contents.size(); ++n_element) {
QString f_element = m_contents.at(n_element);
- f_element.replace("<num>", "#").replace("<percent>", "%").replace("<dollar>", "$").replace("<and>", "&");
+ f_element.replace("<num>", "#")
+ .replace("<percent>", "%")
+ .replace("<dollar>", "$")
+ .replace("<and>", "&");
m_contents.removeAt(n_element);
m_contents.insert(n_element, f_element);
}
}
-