add clang-format file

reformat code
This commit is contained in:
badaix 2019-09-24 22:42:36 +02:00
parent b733f646ea
commit b20add3815
105 changed files with 7773 additions and 7723 deletions

View file

@ -1,6 +1,6 @@
/***
This file is part of snapcast
Copyright (C) 2014-2018 Johannes Pohl
Copyright (C) 2014-2019 Johannes Pohl
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
@ -19,9 +19,9 @@
#ifndef HELLO_MSG_H
#define HELLO_MSG_H
#include "jsonMessage.h"
#include "common/utils.h"
#include "common/strCompat.h"
#include "common/utils.h"
#include "jsonMessage.h"
#include <string>
@ -31,87 +31,84 @@ namespace msg
class Hello : public JsonMessage
{
public:
Hello() : JsonMessage(message_type::kHello)
{
}
Hello() : JsonMessage(message_type::kHello)
{
}
Hello(const std::string& macAddress, const std::string& id, size_t instance) : JsonMessage(message_type::kHello)
{
msg["MAC"] = macAddress;
msg["HostName"] = ::getHostName();
msg["Version"] = VERSION;
msg["ClientName"] = "Snapclient";
msg["OS"] = ::getOS();
msg["Arch"] = ::getArch();
msg["Instance"] = instance;
msg["ID"] = id;
msg["SnapStreamProtocolVersion"] = 2;
}
Hello(const std::string& macAddress, const std::string& id, size_t instance) : JsonMessage(message_type::kHello)
{
msg["MAC"] = macAddress;
msg["HostName"] = ::getHostName();
msg["Version"] = VERSION;
msg["ClientName"] = "Snapclient";
msg["OS"] = ::getOS();
msg["Arch"] = ::getArch();
msg["Instance"] = instance;
msg["ID"] = id;
msg["SnapStreamProtocolVersion"] = 2;
}
virtual ~Hello()
{
}
virtual ~Hello()
{
}
std::string getMacAddress() const
{
return msg["MAC"];
}
std::string getMacAddress() const
{
return msg["MAC"];
}
std::string getHostName() const
{
return msg["HostName"];
}
std::string getHostName() const
{
return msg["HostName"];
}
std::string getVersion() const
{
return msg["Version"];
}
std::string getVersion() const
{
return msg["Version"];
}
std::string getClientName() const
{
return msg["ClientName"];
}
std::string getClientName() const
{
return msg["ClientName"];
}
std::string getOS() const
{
return msg["OS"];
}
std::string getOS() const
{
return msg["OS"];
}
std::string getArch() const
{
return msg["Arch"];
}
std::string getArch() const
{
return msg["Arch"];
}
int getInstance() const
{
return get("Instance", 1);
}
int getInstance() const
{
return get("Instance", 1);
}
int getProtocolVersion() const
{
return get("SnapStreamProtocolVersion", 1);
}
int getProtocolVersion() const
{
return get("SnapStreamProtocolVersion", 1);
}
std::string getId() const
{
return get("ID", getMacAddress());
}
std::string getId() const
{
return get("ID", getMacAddress());
}
std::string getUniqueId() const
{
std::string id = getId();
int instance = getInstance();
if (instance != 1)
{
id = id + "#" + cpt::to_string(instance);
}
return id;
}
std::string getUniqueId() const
{
std::string id = getId();
int instance = getInstance();
if (instance != 1)
{
id = id + "#" + cpt::to_string(instance);
}
return id;
}
};
}
#endif