project: Apply clang-format

This commit is contained in:
Michael Fabian 'Xaymar' Dirks 2019-12-21 17:04:38 +01:00
parent 1482cb1d11
commit 7e5cbe18cf
20 changed files with 41 additions and 36 deletions

View file

@ -166,8 +166,7 @@ void gfx::shader::float_parameter::properties(obs_properties_t* props, obs_data_
_param.get_default_value(defaults, _len); _param.get_default_value(defaults, _len);
for (size_t len = 0; len < _len; len++) { for (size_t len = 0; len < _len; len++) {
auto p = auto p = obs_properties_add_float(grp, _key[len].c_str(), _name[len].c_str(), _min[len], _max[len], _step[len]);
obs_properties_add_float(grp, _key[len].c_str(), _name[len].c_str(), _min[len], _max[len], _step[len]);
obs_property_set_long_description(p, _desc.c_str()); obs_property_set_long_description(p, _desc.c_str());
obs_data_set_default_double(settings, _key[len].c_str(), static_cast<double_t>(defaults[len])); obs_data_set_default_double(settings, _key[len].c_str(), static_cast<double_t>(defaults[len]));
} }

View file

@ -42,7 +42,7 @@ namespace gfx {
}; };
struct float_parameter : public parameter { struct float_parameter : public parameter {
size_t _len; size_t _len;
std::string _key[5]; std::string _key[5];
std::string _name[5]; std::string _name[5];
std::string _desc; std::string _desc;

View file

@ -58,6 +58,6 @@ std::shared_ptr<gfx::shader::parameter> gfx::shader::parameter::make_parameter(g
return el; return el;
} }
default: default:
return nullptr; return nullptr;
} }
} }

View file

@ -48,16 +48,16 @@ namespace gs {
//gs::shader get_pixel_shader(); //gs::shader get_pixel_shader();
//gs::shader get_vertex_shader(); //gs::shader get_vertex_shader();
size_t count_vertex_parameters(); size_t count_vertex_parameters();
gs::effect_parameter get_vertex_parameter(size_t idx); gs::effect_parameter get_vertex_parameter(size_t idx);
gs::effect_parameter get_vertex_parameter(std::string name); gs::effect_parameter get_vertex_parameter(std::string name);
bool has_vertex_parameter(std::string name); bool has_vertex_parameter(std::string name);
bool has_vertex_parameter(std::string name, gs::effect_parameter::type type); bool has_vertex_parameter(std::string name, gs::effect_parameter::type type);
size_t count_pixel_parameters(); size_t count_pixel_parameters();
gs::effect_parameter get_pixel_parameter(size_t idx); gs::effect_parameter get_pixel_parameter(size_t idx);
gs::effect_parameter get_pixel_parameter(std::string name); gs::effect_parameter get_pixel_parameter(std::string name);
bool has_pixel_parameter(std::string name); bool has_pixel_parameter(std::string name);
bool has_pixel_parameter(std::string name, gs::effect_parameter::type type); bool has_pixel_parameter(std::string name, gs::effect_parameter::type type);
}; };
} // namespace gs } // namespace gs

View file

@ -33,8 +33,8 @@ gs::effect_technique::~effect_technique() {}
std::string gs::effect_technique::name() std::string gs::effect_technique::name()
{ {
const char* name_c = get()->name; const char* name_c = get()->name;
size_t name_len = strnlen_s(name_c, 256); size_t name_len = strnlen_s(name_c, 256);
return name_c ? std::string(name_c, name_c + name_len) : std::string(); return name_c ? std::string(name_c, name_c + name_len) : std::string();
} }

View file

@ -41,7 +41,7 @@ extern "C" {
namespace gs { namespace gs {
class effect : public std::shared_ptr<gs_effect_t> { class effect : public std::shared_ptr<gs_effect_t> {
public: public:
effect() {}; effect(){};
effect(std::string code, std::string name); effect(std::string code, std::string name);
effect(std::filesystem::path file); effect(std::filesystem::path file);
~effect(); ~effect();

View file

@ -18,8 +18,8 @@
*/ */
#pragma once #pragma once
#include <vector>
#include <string> #include <string>
#include <vector>
#include "plugin.hpp" #include "plugin.hpp"
// OBS // OBS

View file

@ -45,8 +45,8 @@ namespace gs {
protected: protected:
gs_texture_t* _texture; gs_texture_t* _texture;
bool _is_owner = true; bool _is_owner = true;
type _type = type::Normal; type _type = type::Normal;
public: public:
~texture(); ~texture();

View file

@ -18,4 +18,3 @@
*/ */
#include "obs-source-factory.hpp" #include "obs-source-factory.hpp"

View file

@ -21,8 +21,8 @@
#define STREAMEFFECTS_SOURCE_FACTORY_HPP #define STREAMEFFECTS_SOURCE_FACTORY_HPP
#pragma once #pragma once
#include "plugin.hpp"
#include <stdexcept> #include <stdexcept>
#include "plugin.hpp"
#ifdef _MSC_VER #ifdef _MSC_VER
#pragma warning(push) #pragma warning(push)

View file

@ -23,7 +23,8 @@
static std::shared_ptr<obs::source_tracker> source_tracker_instance; static std::shared_ptr<obs::source_tracker> source_tracker_instance;
void obs::source_tracker::source_create_handler(void* ptr, calldata_t* data) noexcept try { void obs::source_tracker::source_create_handler(void* ptr, calldata_t* data) noexcept
try {
obs::source_tracker* self = reinterpret_cast<obs::source_tracker*>(ptr); obs::source_tracker* self = reinterpret_cast<obs::source_tracker*>(ptr);
obs_source_t* target = nullptr; obs_source_t* target = nullptr;
@ -49,7 +50,8 @@ void obs::source_tracker::source_create_handler(void* ptr, calldata_t* data) noe
P_LOG_ERROR("Unexpected exception in function '%s'.", __FUNCTION_NAME__); P_LOG_ERROR("Unexpected exception in function '%s'.", __FUNCTION_NAME__);
} }
void obs::source_tracker::source_destroy_handler(void* ptr, calldata_t* data) noexcept try { void obs::source_tracker::source_destroy_handler(void* ptr, calldata_t* data) noexcept
try {
obs::source_tracker* self = reinterpret_cast<obs::source_tracker*>(ptr); obs::source_tracker* self = reinterpret_cast<obs::source_tracker*>(ptr);
obs_source_t* target = nullptr; obs_source_t* target = nullptr;
@ -76,7 +78,8 @@ void obs::source_tracker::source_destroy_handler(void* ptr, calldata_t* data) no
P_LOG_ERROR("Unexpected exception in function '%s'.", __FUNCTION_NAME__); P_LOG_ERROR("Unexpected exception in function '%s'.", __FUNCTION_NAME__);
} }
void obs::source_tracker::source_rename_handler(void* ptr, calldata_t* data) noexcept try { void obs::source_tracker::source_rename_handler(void* ptr, calldata_t* data) noexcept
try {
obs::source_tracker* self = reinterpret_cast<obs::source_tracker*>(ptr); obs::source_tracker* self = reinterpret_cast<obs::source_tracker*>(ptr);
obs_source_t* target = nullptr; obs_source_t* target = nullptr;

View file

@ -30,14 +30,16 @@ struct scs_searchdata {
static bool scs_contains(scs_searchdata& sd, obs_source_t* source); static bool scs_contains(scs_searchdata& sd, obs_source_t* source);
static void scs_enum_active_cb(obs_source_t*, obs_source_t* child, void* searchdata) noexcept try { static void scs_enum_active_cb(obs_source_t*, obs_source_t* child, void* searchdata) noexcept
try {
scs_searchdata& sd = reinterpret_cast<scs_searchdata&>(*reinterpret_cast<scs_searchdata*>(searchdata)); scs_searchdata& sd = reinterpret_cast<scs_searchdata&>(*reinterpret_cast<scs_searchdata*>(searchdata));
scs_contains(sd, child); scs_contains(sd, child);
} catch (...) { } catch (...) {
P_LOG_ERROR("Unexpected exception in function '%s'.", __FUNCTION_NAME__); P_LOG_ERROR("Unexpected exception in function '%s'.", __FUNCTION_NAME__);
} }
static bool scs_enum_items_cb(obs_scene_t*, obs_sceneitem_t* item, void* searchdata) noexcept try { static bool scs_enum_items_cb(obs_scene_t*, obs_sceneitem_t* item, void* searchdata) noexcept
try {
scs_searchdata& sd = reinterpret_cast<scs_searchdata&>(*reinterpret_cast<scs_searchdata*>(searchdata)); scs_searchdata& sd = reinterpret_cast<scs_searchdata&>(*reinterpret_cast<scs_searchdata*>(searchdata));
obs_source_t* source = obs_sceneitem_get_source(item); obs_source_t* source = obs_sceneitem_get_source(item);
return scs_contains(sd, source); return scs_contains(sd, source);

View file

@ -30,7 +30,8 @@
#include "sources/source-mirror.hpp" #include "sources/source-mirror.hpp"
#include "sources/source-shader.hpp" #include "sources/source-shader.hpp"
MODULE_EXPORT bool obs_module_load(void) try { MODULE_EXPORT bool obs_module_load(void)
try {
P_LOG_INFO("Loading Version %s", STREAMEFFECTS_VERSION_STRING); P_LOG_INFO("Loading Version %s", STREAMEFFECTS_VERSION_STRING);
// Initialize Source Tracker // Initialize Source Tracker
@ -55,7 +56,8 @@ MODULE_EXPORT bool obs_module_load(void) try {
return false; return false;
} }
MODULE_EXPORT void obs_module_unload(void) try { MODULE_EXPORT void obs_module_unload(void)
try {
P_LOG_INFO("Unloading Version %s", STREAMEFFECTS_VERSION_STRING); P_LOG_INFO("Unloading Version %s", STREAMEFFECTS_VERSION_STRING);
// Clean up Sources // Clean up Sources

View file

@ -115,7 +115,7 @@ namespace util {
} }
#pragma push_macro("P_IS_POWER_OF_TWO_AS_LOOP") #pragma push_macro("P_IS_POWER_OF_TWO_AS_LOOP")
#define P_IS_POWER_OF_TWO_AS_LOOP(x) \ #define P_IS_POWER_OF_TWO_AS_LOOP(x) \
template<> \ template<> \
inline bool is_power_of_two(x v) \ inline bool is_power_of_two(x v) \
{ \ { \

View file

@ -20,8 +20,8 @@
#include "utility.hpp" #include "utility.hpp"
#include <sstream> #include <sstream>
#include <stdexcept> #include <stdexcept>
#include "plugin.hpp"
#include <unordered_map> #include <unordered_map>
#include "plugin.hpp"
// OBS // OBS
#ifdef _MSC_VER #ifdef _MSC_VER

View file

@ -18,9 +18,9 @@
*/ */
#pragma once #pragma once
#include <type_traits>
#include <cinttypes> #include <cinttypes>
#include <limits> #include <limits>
#include <type_traits>
extern "C" { extern "C" {
#include <obs-config.h> #include <obs-config.h>
@ -48,7 +48,7 @@ typename std::enable_if<enable_bitmask_operators<Enum>::enable, Enum>::type oper
return static_cast<Enum>(static_cast<underlying>(lhs) & static_cast<underlying>(rhs)); return static_cast<Enum>(static_cast<underlying>(lhs) & static_cast<underlying>(rhs));
} }
#define P_ENABLE_BITMASK_OPERATORS(x) \ #define P_ENABLE_BITMASK_OPERATORS(x) \
template<> \ template<> \
struct enable_bitmask_operators<x> { \ struct enable_bitmask_operators<x> { \
static const bool enable = true; \ static const bool enable = true; \
@ -62,4 +62,4 @@ namespace util {
{ {
return obs_get_version() < MAKE_SEMANTIC_VERSION(24, 0, 0); return obs_get_version() < MAKE_SEMANTIC_VERSION(24, 0, 0);
} }
} } // namespace util