Skip to content

Commit

Permalink
apply llvm-header-guard, llvm-namespaces (#218)
Browse files Browse the repository at this point in the history
run clang-tidy checks llvm-header-guard, llvm-namespaces to update code style
  • Loading branch information
rmorozov authored Aug 31, 2021
1 parent dae174c commit 4b86a7c
Show file tree
Hide file tree
Showing 34 changed files with 140 additions and 135 deletions.
2 changes: 1 addition & 1 deletion include/jinja2cpp/error_info.h
Original file line number Diff line number Diff line change
Expand Up @@ -180,6 +180,6 @@ using ErrorInfoW = ErrorInfoTpl<wchar_t>;

JINJA2CPP_EXPORT std::ostream& operator<<(std::ostream& os, const ErrorInfo& res);
JINJA2CPP_EXPORT std::wostream& operator<<(std::wostream& os, const ErrorInfoW& res);
} // jinja2
} // namespace jinja2

#endif // JINJA2CPP_ERROR_INFO_H
4 changes: 2 additions & 2 deletions include/jinja2cpp/filesystem_handler.h
Original file line number Diff line number Diff line change
Expand Up @@ -171,6 +171,6 @@ class JINJA2CPP_EXPORT RealFileSystem : public IFilesystemHandler
private:
std::string m_rootFolder;
};
} // jinja2
} // namespace jinja2

#endif // FILESYSTEM_HANDLER_H
#endif // JINJA2CPP_FILESYSTEM_HANDLER_H
10 changes: 5 additions & 5 deletions include/jinja2cpp/generic_list.h
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
#ifndef JINJA2_GENERIC_LIST_H
#define JINJA2_GENERIC_LIST_H
#ifndef JINJA2CPP_GENERIC_LIST_H
#define JINJA2CPP_GENERIC_LIST_H

#include <nonstd/optional.hpp>

Expand Down Expand Up @@ -157,7 +157,7 @@ struct ListItemAccessor
namespace detail
{
class GenericListIterator;
}
} // namespace detail

/*!
* \brief Facade class for generic lists
Expand Down Expand Up @@ -265,7 +265,7 @@ inline ListEnumeratorPtr ListItemAccessor::MakeEnumerator(Args&& ...args)
{
return ListEnumeratorPtr(new T(std::forward<Args>(args)...), [](ListEnumerator* e) { delete e; });
}
}
} // namespace jinja2


#endif // JINJA2_GENERIC_LIST_H
#endif // JINJA2CPP_GENERIC_LIST_H
6 changes: 3 additions & 3 deletions include/jinja2cpp/generic_list_impl.h
Original file line number Diff line number Diff line change
Expand Up @@ -343,7 +343,7 @@ auto MakeGeneratedList(ListGenerator&& fn)
{
return GenericList([accessor = GeneratedListAccessor(std::move(fn))]() {return &accessor;});
}
}
} // namespace lists_impl

/*!
* \brief Create instance of the GenericList from the pair of iterators
Expand Down Expand Up @@ -385,6 +385,6 @@ auto MakeGenericList(lists_impl::ListGenerator fn)
return lists_impl::MakeGeneratedList(std::move(fn));
}

}
} // namespace jinja2

#endif //JINJA2CPP_GENERIC_LIST_IMPL_H
#endif // JINJA2CPP_GENERIC_LIST_IMPL_H
10 changes: 5 additions & 5 deletions include/jinja2cpp/generic_list_iterator.h
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
#ifndef JINJA2_GENERIC_LIST_ITERATOR_H
#define JINJA2_GENERIC_LIST_ITERATOR_H
#ifndef JINJA2CPP_GENERIC_LIST_ITERATOR_H
#define JINJA2CPP_GENERIC_LIST_ITERATOR_H

#include "generic_list.h"
#include "value.h"
Expand Down Expand Up @@ -94,7 +94,7 @@ class GenericListIterator
Value m_current;
};

}
} // namespace detail

inline detail::GenericListIterator GenericList::begin() const
{
Expand All @@ -108,6 +108,6 @@ inline detail::GenericListIterator GenericList::end() const

inline auto GenericList::cbegin() const {return begin();}
inline auto GenericList::cend() const {return end();}
}
} // namespace jinja2

#endif // JINJA2_GENERIC_LIST_ITERATOR_H
#endif // JINJA2CPP_GENERIC_LIST_ITERATOR_H
10 changes: 5 additions & 5 deletions include/jinja2cpp/reflected_value.h
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
#ifndef JINJA2_REFLECTED_VALUE_H
#define JINJA2_REFLECTED_VALUE_H
#ifndef JINJA2CPP_REFLECTED_VALUE_H
#define JINJA2CPP_REFLECTED_VALUE_H

#include "value.h"

Expand Down Expand Up @@ -522,7 +522,7 @@ JINJA2_INT_REFLECTOR(int32_t);
JINJA2_INT_REFLECTOR(uint32_t);
JINJA2_INT_REFLECTOR(int64_t);
JINJA2_INT_REFLECTOR(uint64_t);
} // detail
} // namespace detail
#endif

template<typename T>
Expand All @@ -531,6 +531,6 @@ Value Reflect(T&& val)
return detail::Reflector<T>::Create(std::forward<T>(val));
}

} // jinja2
} // namespace jinja2

#endif // JINJA2_REFLECTED_VALUE_H
#endif // JINJA2CPP_REFLECTED_VALUE_H
12 changes: 6 additions & 6 deletions include/jinja2cpp/string_helpers.h
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
#ifndef JINJA2_STRING_HELPERS_H
#define JINJA2_STRING_HELPERS_H
#ifndef JINJA2CPP_STRING_HELPERS_H
#define JINJA2CPP_STRING_HELPERS_H

#include <nonstd/string_view.hpp>
#include "value.h"
Expand Down Expand Up @@ -98,7 +98,7 @@ namespace detail
template<typename CharT, typename T>
struct StringConverter<nonstd::basic_string_view<CharT>, T> : public StringConverter<std::basic_string<CharT>, T> {};

} // detail
} // namespace detail

/*!
* \brief Convert string objects from one representation or another
Expand Down Expand Up @@ -261,7 +261,7 @@ struct WStringGetter
return std::wstring();
}
};
}
} // namespace detail
/*!
* \brief Gets std::string from the arbitrary \ref Value
*
Expand Down Expand Up @@ -290,6 +290,6 @@ inline std::wstring AsWString(const Value& val)
{
return nonstd::visit(detail::WStringGetter(), val.data());
}
}
} // namespace jinja2

#endif // JINJA2_STRING_HELPERS_H
#endif // JINJA2CPP_STRING_HELPERS_H
8 changes: 4 additions & 4 deletions include/jinja2cpp/template.h
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
#ifndef JINJA2_TEMPLATE_H
#define JINJA2_TEMPLATE_H
#ifndef JINJA2CPP_TEMPLATE_H
#define JINJA2CPP_TEMPLATE_H

#include "config.h"
#include "error_info.h"
Expand Down Expand Up @@ -279,6 +279,6 @@ class JINJA2CPP_EXPORT TemplateW
std::shared_ptr<ITemplateImpl> m_impl;
friend class TemplateImpl<wchar_t>;
};
} // jinja2
} // namespace jinja2

#endif // JINJA2_TEMPLATE_H
#endif // JINJA2CPP_TEMPLATE_H
2 changes: 1 addition & 1 deletion include/jinja2cpp/template_env.h
Original file line number Diff line number Diff line change
Expand Up @@ -242,6 +242,6 @@ class JINJA2CPP_EXPORT TemplateEnv
std::unordered_map<std::string, TemplateWCacheEntry> m_templateWCache;
};

} // jinja2
} // namespace jinja2

#endif // JINJA2CPP_TEMPLATE_ENV_H
10 changes: 5 additions & 5 deletions include/jinja2cpp/user_callable.h
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
#ifndef USER_CALLABLE_H
#define USER_CALLABLE_H
#ifndef JINJA2CPP_USER_CALLABLE_H
#define JINJA2CPP_USER_CALLABLE_H

#include "string_helpers.h"
#include "value.h"
Expand Down Expand Up @@ -340,7 +340,7 @@ template<typename... T>
struct ArgDescrHasType<ArgInfoT<T>...> : std::true_type
{
};
} // detail
} // namespace detail
#endif // JINJA2CPP_NO_DOXYGEN

/*!
Expand Down Expand Up @@ -431,6 +431,6 @@ auto MakeCallable(Fn&& f)
{
return UserCallable{ [=, fn = std::forward<Fn>(f)](const UserCallableParams&) { return fn(); }, {} };
}
} // jinja2
} // namespace jinja2

#endif // USER_CALLABLE_H
#endif // JINJA2CPP_USER_CALLABLE_H
8 changes: 4 additions & 4 deletions include/jinja2cpp/value.h
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
#ifndef JINJA2_VALUE_H
#define JINJA2_VALUE_H
#ifndef JINJA2CPP_VALUE_H
#define JINJA2CPP_VALUE_H

#include "generic_list.h"
#include "value_ptr.hpp"
Expand Down Expand Up @@ -652,6 +652,6 @@ inline Value::Value(ValuesMap&& map) noexcept
{
}

} // jinja2
} // namespace jinja2

#endif // JINJA2_VALUE_H
#endif // JINJA2CPP_VALUE_H
5 changes: 5 additions & 0 deletions include/jinja2cpp/value_ptr.hpp
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
#ifndef JINJA2CPP_VALUE_PTR_HPP
#define JINJA2CPP_VALUE_PTR_HPP

//
// Copyright 2017-2018 by Martin Moene
//
Expand Down Expand Up @@ -1288,3 +1291,5 @@ struct hash< nonstd::value_ptr<T, D, C> >
#endif

#endif // NONSTD_VALUE_PTR_LITE_HPP

#endif
8 changes: 4 additions & 4 deletions src/ast_visitor.h
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
#ifndef AST_VISITOR_H
#define AST_VISITOR_H
#ifndef JINJA2CPP_SRC_AST_VISITOR_H
#define JINJA2CPP_SRC_AST_VISITOR_H

namespace jinja2
{
Expand Down Expand Up @@ -76,7 +76,7 @@ struct VisitorBase
{
using type = typename VisitorBaseImpl<void, Types ...>::base_type;
};
}
} // namespace detail

template<typename ... Types>
using VisitorBase = typename detail::VisitorBase<Types...>::type;
Expand Down Expand Up @@ -109,7 +109,7 @@ class StatementVisitor : public VisitorBase<
stmt->ApplyVisitor(this);
}
};
}
} // namespace jinja2


#endif
8 changes: 4 additions & 4 deletions src/error_handling.h
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
#ifndef ERROR_HANDLING_H
#define ERROR_HANDLING_H
#ifndef JINJA2CPP_SRC_ERROR_HANDLING_H
#define JINJA2CPP_SRC_ERROR_HANDLING_H

#include "lexer.h"
#include <jinja2cpp/error_info.h>
Expand Down Expand Up @@ -59,5 +59,5 @@ inline auto MakeParseError(ErrorCode code, Token tok, std::initializer_list<Toke
return nonstd::make_unexpected(ParseError{code, tok, toks});
}

} // jinja2
#endif // ERROR_HANDLING_H
} // namespace jinja2
#endif // JINJA2CPP_SRC_ERROR_HANDLING_H
10 changes: 5 additions & 5 deletions src/expression_evaluator.h
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
#ifndef EXPRESSION_EVALUATOR_H
#define EXPRESSION_EVALUATOR_H
#ifndef JINJA2CPP_SRC_EXPRESSION_EVALUATOR_H
#define JINJA2CPP_SRC_EXPRESSION_EVALUATOR_H

#include "internal_value.h"
#include "render_context.h"
Expand Down Expand Up @@ -376,7 +376,7 @@ ParsedArguments ParseCallParams(const std::vector<ArgumentInfo>& args, const Cal
ParsedArgumentsInfo ParseCallParamsInfo(const std::initializer_list<ArgumentInfo>& argsInfo, const CallParamsInfo& params, bool& isSucceeded);
ParsedArgumentsInfo ParseCallParamsInfo(const std::vector<ArgumentInfo>& args, const CallParamsInfo& params, bool& isSucceeded);
CallParams EvaluateCallParams(const CallParamsInfo& info, RenderContext& context);
}
} // jinja2
} // namespace helpers
} // namespace jinja2

#endif // EXPRESSION_EVALUATOR_H
#endif // JINJA2CPP_SRC_EXPRESSION_EVALUATOR_H
8 changes: 4 additions & 4 deletions src/expression_parser.h
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
#ifndef EXPRESSION_PARSER_H
#define EXPRESSION_PARSER_H
#ifndef JINJA2CPP_SRC_EXPRESSION_PARSER_H
#define JINJA2CPP_SRC_EXPRESSION_PARSER_H

#include "lexer.h"
#include "error_handling.h"
Expand Down Expand Up @@ -44,6 +44,6 @@ class ExpressionParser
ComposedRenderer* m_topLevelRenderer = nullptr;
};

} // jinja2
} // namespace jinja2

#endif // EXPRESSION_PARSER_H
#endif // JINJA2CPP_SRC_EXPRESSION_PARSER_H
10 changes: 5 additions & 5 deletions src/filters.h
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
#ifndef FILTERS_H
#define FILTERS_H
#ifndef JINJA2CPP_SRC_FILTERS_H
#define JINJA2CPP_SRC_FILTERS_H

#include "expression_evaluator.h"
#include "function_base.h"
Expand Down Expand Up @@ -273,7 +273,7 @@ class UserDefinedFilter : public FilterBase
FilterParams m_callParams;
};

} // filters
} // jinja2
} // namespace filters
} // namespace jinja2

#endif // FILTERS_H
#endif // JINJA2CPP_SRC_FILTERS_H
8 changes: 4 additions & 4 deletions src/function_base.h
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
#ifndef FUNCTION_BASE_H
#define FUNCTION_BASE_H
#ifndef JINJA2CPP_SRC_FUNCTION_BASE_H
#define JINJA2CPP_SRC_FUNCTION_BASE_H

#include "expression_evaluator.h"
#include "internal_value.h"
Expand Down Expand Up @@ -31,6 +31,6 @@ inline InternalValue FunctionBase::GetArgumentValue(const std::string& argName,
return argExpr ? argExpr->Evaluate(context) : std::move(defVal);
}

} // jinja2
} // namespace jinja2

#endif // FUNCTION_BASE_H
#endif // JINJA2CPP_SRC_FUNCTION_BASE_H
8 changes: 4 additions & 4 deletions src/generic_adapters.h
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
#ifndef GENERIC_ADAPTERS_H
#define GENERIC_ADAPTERS_H
#ifndef JINJA2CPP_SRC_GENERIC_ADAPTERS_H
#define JINJA2CPP_SRC_GENERIC_ADAPTERS_H

#include <jinja2cpp/value.h>
#include "internal_value.h"
Expand Down Expand Up @@ -183,6 +183,6 @@ inline ListEnumeratorPtr IndexedListItemAccessorImpl<T>::CreateEnumerator() cons
return MakeEnumerator<Enumerator>(this);
}

} // jinja2
} // namespace jinja2

#endif // GENERIC_ADAPTERS_H
#endif // JINJA2CPP_SRC_GENERIC_ADAPTERS_H
8 changes: 4 additions & 4 deletions src/helpers.h
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
#ifndef HELPERS_H
#define HELPERS_H
#ifndef JINJA2CPP_SRC_HELPERS_H
#define JINJA2CPP_SRC_HELPERS_H

#include <nonstd/string_view.hpp>
#include <jinja2cpp/string_helpers.h>
Expand Down Expand Up @@ -114,6 +114,6 @@ Sequence CompileEscapes(Sequence s)
return s;
}

} // jinja2
} // namespace jinja2

#endif // HELPERS_H
#endif // JINJA2CPP_SRC_HELPERS_H
Loading

0 comments on commit 4b86a7c

Please sign in to comment.