Format all C++ and Java code via clang-format

Signed-off-by: Konstantin Pastbin <konstantin.pastbin@gmail.com>
This commit is contained in:
Konstantin Pastbin
2025-08-17 14:32:37 +07:00
parent 9f0290c0ec
commit bfffa1fff4
2169 changed files with 56441 additions and 64188 deletions

View File

@@ -8,44 +8,37 @@ namespace base
{
namespace impl
{
/// Base class for all ScopeGuards.
class GuardBase
/// Base class for all ScopeGuards.
class GuardBase
{
public:
/// Disable ScopeGuard functionality on it's destruction
void release() const { m_bDoRollback = false; }
protected:
GuardBase() : m_bDoRollback(true) {}
// Do something in the destructor
mutable bool m_bDoRollback;
};
/// ScopeGuard for specific functor
template <typename TFunctor>
class GuardImpl : public GuardBase
{
public:
explicit GuardImpl(TFunctor const & F) : m_Functor(F) {}
~GuardImpl()
{
public:
/// Disable ScopeGuard functionality on it's destruction
void release() const
{
m_bDoRollback = false;
}
if (m_bDoRollback)
m_Functor();
}
protected:
GuardBase() : m_bDoRollback(true)
{
}
// Do something in the destructor
mutable bool m_bDoRollback;
};
/// ScopeGuard for specific functor
template <typename TFunctor> class GuardImpl : public GuardBase
{
public:
explicit GuardImpl(TFunctor const & F) : m_Functor(F)
{
}
~GuardImpl()
{
if (m_bDoRollback)
m_Functor();
}
private:
TFunctor m_Functor;
};
} // namespace impl
private:
TFunctor m_Functor;
};
} // namespace impl
typedef impl::GuardBase const & scope_guard;
@@ -55,7 +48,7 @@ impl::GuardImpl<TFunctor> make_scope_guard(TFunctor const & F)
{
return impl::GuardImpl<TFunctor>(F);
}
} // namespace base
} // namespace base
#define SCOPE_GUARD(name, func) \
::base::scope_guard name = base::make_scope_guard(func); \