Automated style fixes in order to bring the code a little bit closer to compliance with MISRA C++ rules. No changes in logic.

This commit is contained in:
Pavel Kirienko
2014-03-25 03:04:36 +04:00
parent cce657e1fe
commit 0cc627016a
64 changed files with 777 additions and 283 deletions
+15 -9
View File
@@ -23,7 +23,7 @@ struct StaticAssert<true>
* Usage:
* ShowIntegerAsError<integer_expression>::foobar();
*/
template<long N> struct ShowIntegerAsError;
template <long N> struct ShowIntegerAsError;
/**
* Prevents copying when inherited
@@ -39,15 +39,21 @@ protected:
/**
* Compile time conditions
*/
template<bool B, typename T = void>
template <bool B, typename T = void>
struct EnableIf { };
template<typename T>
struct EnableIf<true, T> { typedef T Type; };
template <typename T>
struct EnableIf<true, T>
{
typedef T Type;
};
template<typename T, typename R = void>
struct EnableIfType { typedef R Type; };
template <typename T, typename R = void>
struct EnableIfType
{
typedef R Type;
};
template <bool Condition, typename TrueType, typename FalseType>
@@ -68,7 +74,7 @@ struct Select<false, TrueType, FalseType>
/**
* Value types
*/
template<bool> struct BooleanType { };
template <bool> struct BooleanType { };
typedef BooleanType<true> TrueType;
typedef BooleanType<false> FalseType;
@@ -102,14 +108,14 @@ template <typename To, typename From>
To try_implicit_cast(const From& from, const To& default_)
{
return TryImplicitCastImpl<From, To>::impl(from, default_,
BooleanType<IsImplicitlyConvertibleFromTo<From, To>::Result>());
BooleanType<IsImplicitlyConvertibleFromTo<From, To>::Result>());
}
template <typename To, typename From>
To try_implicit_cast(const From& from)
{
return TryImplicitCastImpl<From, To>::impl(from, To(),
BooleanType<IsImplicitlyConvertibleFromTo<From, To>::Result>());
BooleanType<IsImplicitlyConvertibleFromTo<From, To>::Result>());
}
}
@@ -24,13 +24,17 @@ class LazyConstructor
void ensureConstructed() const
{
if (!ptr_)
{
handleFatalError("LazyConstructor<T> is not constructed");
}
}
void ensureNotConstructed() const
{
if (ptr_)
{
handleFatalError("LazyConstructor<T> is already constructed");
}
}
template <typename U> struct ParamType { typedef const U& Type; };
@@ -41,17 +45,19 @@ class LazyConstructor
public:
LazyConstructor()
: ptr_(NULL)
: ptr_(NULL)
{
std::fill(data_, data_ + sizeof(T), 0);
}
LazyConstructor(const LazyConstructor<T>& rhs)
: ptr_(NULL)
: ptr_(NULL)
{
std::fill(data_, data_ + sizeof(T), 0);
if (rhs)
{
construct<const T&>(*rhs); // Invoke copy constructor
}
}
~LazyConstructor() { destroy(); }
@@ -60,7 +66,9 @@ public:
{
destroy();
if (rhs)
{
construct<const T&>(*rhs); // Invoke copy constructor
}
return *this;
}
@@ -77,7 +85,9 @@ public:
void destroy()
{
if (ptr_)
{
ptr_->~T();
}
ptr_ = NULL;
std::fill(data_, data_ + sizeof(T), 0);
}
@@ -20,18 +20,20 @@ class MethodBinder
void validateBeforeCall() const
{
if (!operator bool())
{
handleFatalError("Null method binder");
}
}
public:
MethodBinder()
: obj_()
, fun_()
: obj_()
, fun_()
{ }
MethodBinder(ObjectPtr o, MemFunPtr f)
: obj_(o)
, fun_(f)
: obj_(o)
, fun_(f)
{ }
operator bool() const