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,37 +19,39 @@
#ifndef SNAP_EXCEPTION_H
#define SNAP_EXCEPTION_H
#include <cstring> // std::strlen, std::strcpy
#include <exception>
#include <string>
#include <cstring> // std::strlen, std::strcpy
// text_exception uses a dynamically-allocated internal c-string for what():
class SnapException : public std::exception {
char* text_;
class SnapException : public std::exception
{
char* text_;
public:
SnapException(const char* text)
{
text_ = new char[std::strlen(text) + 1];
std::strcpy(text_, text);
}
SnapException(const char* text)
{
text_ = new char[std::strlen(text) + 1];
std::strcpy(text_, text);
}
SnapException(const std::string& text) : SnapException(text.c_str())
{
}
SnapException(const std::string& text) : SnapException(text.c_str())
{
}
SnapException(const SnapException& e) : SnapException(e.what())
{
}
SnapException(const SnapException& e) : SnapException(e.what())
{
}
virtual ~SnapException() throw()
{
delete[] text_;
}
virtual ~SnapException() throw()
{
delete[] text_;
}
virtual const char* what() const noexcept
{
return text_;
}
virtual const char* what() const noexcept
{
return text_;
}
};
@ -57,26 +59,24 @@ public:
class AsyncSnapException : public SnapException
{
public:
AsyncSnapException(const char* text) : SnapException(text)
{
}
AsyncSnapException(const char* text) : SnapException(text)
{
}
AsyncSnapException(const std::string& text) : SnapException(text)
{
}
AsyncSnapException(const std::string& text) : SnapException(text)
{
}
AsyncSnapException(const AsyncSnapException& e) : SnapException(e.what())
{
}
AsyncSnapException(const AsyncSnapException& e) : SnapException(e.what())
{
}
virtual ~AsyncSnapException() throw()
{
}
virtual ~AsyncSnapException() throw()
{
}
};
#endif