mirror of
https://github.com/polybar/polybar.git
synced 2025-02-17 15:55:20 -05:00

- use "#pragma once" instead of the regular include guard - fix errors and warnings reported by cppcheck
16 lines
512 B
C++
16 lines
512 B
C++
#pragma once
|
|
|
|
#include <string>
|
|
#include <stdexcept>
|
|
|
|
struct Exception : public std::runtime_error
|
|
{
|
|
explicit Exception(const std::string& error_message = "")
|
|
: std::runtime_error(error_message.c_str()) {}
|
|
};
|
|
|
|
#define DefineChildException(ExName, ParentEx) struct ExName : public ParentEx { \
|
|
explicit ExName(const std::string& error_message = "") \
|
|
: ParentEx("["+ std::string(__FUNCTION__) +"] => "+ error_message) {} \
|
|
}
|
|
#define DefineBaseException(ExName) DefineChildException(ExName, Exception)
|