Skip to content

Commit 4b86a7c

Browse files
authored
apply llvm-header-guard, llvm-namespaces (#218)
run clang-tidy checks llvm-header-guard, llvm-namespaces to update code style
1 parent dae174c commit 4b86a7c

34 files changed

+140
-135
lines changed

Diff for: include/jinja2cpp/error_info.h

+1-1
Original file line numberDiff line numberDiff line change
@@ -180,6 +180,6 @@ using ErrorInfoW = ErrorInfoTpl<wchar_t>;
180180

181181
JINJA2CPP_EXPORT std::ostream& operator<<(std::ostream& os, const ErrorInfo& res);
182182
JINJA2CPP_EXPORT std::wostream& operator<<(std::wostream& os, const ErrorInfoW& res);
183-
} // jinja2
183+
} // namespace jinja2
184184

185185
#endif // JINJA2CPP_ERROR_INFO_H

Diff for: include/jinja2cpp/filesystem_handler.h

+2-2
Original file line numberDiff line numberDiff line change
@@ -171,6 +171,6 @@ class JINJA2CPP_EXPORT RealFileSystem : public IFilesystemHandler
171171
private:
172172
std::string m_rootFolder;
173173
};
174-
} // jinja2
174+
} // namespace jinja2
175175

176-
#endif // FILESYSTEM_HANDLER_H
176+
#endif // JINJA2CPP_FILESYSTEM_HANDLER_H

Diff for: include/jinja2cpp/generic_list.h

+5-5
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
1-
#ifndef JINJA2_GENERIC_LIST_H
2-
#define JINJA2_GENERIC_LIST_H
1+
#ifndef JINJA2CPP_GENERIC_LIST_H
2+
#define JINJA2CPP_GENERIC_LIST_H
33

44
#include <nonstd/optional.hpp>
55

@@ -157,7 +157,7 @@ struct ListItemAccessor
157157
namespace detail
158158
{
159159
class GenericListIterator;
160-
}
160+
} // namespace detail
161161

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

270270

271-
#endif // JINJA2_GENERIC_LIST_H
271+
#endif // JINJA2CPP_GENERIC_LIST_H

Diff for: include/jinja2cpp/generic_list_impl.h

+3-3
Original file line numberDiff line numberDiff line change
@@ -343,7 +343,7 @@ auto MakeGeneratedList(ListGenerator&& fn)
343343
{
344344
return GenericList([accessor = GeneratedListAccessor(std::move(fn))]() {return &accessor;});
345345
}
346-
}
346+
} // namespace lists_impl
347347

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

388-
}
388+
} // namespace jinja2
389389

390-
#endif //JINJA2CPP_GENERIC_LIST_IMPL_H
390+
#endif // JINJA2CPP_GENERIC_LIST_IMPL_H

Diff for: include/jinja2cpp/generic_list_iterator.h

+5-5
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
1-
#ifndef JINJA2_GENERIC_LIST_ITERATOR_H
2-
#define JINJA2_GENERIC_LIST_ITERATOR_H
1+
#ifndef JINJA2CPP_GENERIC_LIST_ITERATOR_H
2+
#define JINJA2CPP_GENERIC_LIST_ITERATOR_H
33

44
#include "generic_list.h"
55
#include "value.h"
@@ -94,7 +94,7 @@ class GenericListIterator
9494
Value m_current;
9595
};
9696

97-
}
97+
} // namespace detail
9898

9999
inline detail::GenericListIterator GenericList::begin() const
100100
{
@@ -108,6 +108,6 @@ inline detail::GenericListIterator GenericList::end() const
108108

109109
inline auto GenericList::cbegin() const {return begin();}
110110
inline auto GenericList::cend() const {return end();}
111-
}
111+
} // namespace jinja2
112112

113-
#endif // JINJA2_GENERIC_LIST_ITERATOR_H
113+
#endif // JINJA2CPP_GENERIC_LIST_ITERATOR_H

Diff for: include/jinja2cpp/reflected_value.h

+5-5
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
1-
#ifndef JINJA2_REFLECTED_VALUE_H
2-
#define JINJA2_REFLECTED_VALUE_H
1+
#ifndef JINJA2CPP_REFLECTED_VALUE_H
2+
#define JINJA2CPP_REFLECTED_VALUE_H
33

44
#include "value.h"
55

@@ -522,7 +522,7 @@ JINJA2_INT_REFLECTOR(int32_t);
522522
JINJA2_INT_REFLECTOR(uint32_t);
523523
JINJA2_INT_REFLECTOR(int64_t);
524524
JINJA2_INT_REFLECTOR(uint64_t);
525-
} // detail
525+
} // namespace detail
526526
#endif
527527

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

534-
} // jinja2
534+
} // namespace jinja2
535535

536-
#endif // JINJA2_REFLECTED_VALUE_H
536+
#endif // JINJA2CPP_REFLECTED_VALUE_H

Diff for: include/jinja2cpp/string_helpers.h

+6-6
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
1-
#ifndef JINJA2_STRING_HELPERS_H
2-
#define JINJA2_STRING_HELPERS_H
1+
#ifndef JINJA2CPP_STRING_HELPERS_H
2+
#define JINJA2CPP_STRING_HELPERS_H
33

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

101-
} // detail
101+
} // namespace detail
102102

103103
/*!
104104
* \brief Convert string objects from one representation or another
@@ -261,7 +261,7 @@ struct WStringGetter
261261
return std::wstring();
262262
}
263263
};
264-
}
264+
} // namespace detail
265265
/*!
266266
* \brief Gets std::string from the arbitrary \ref Value
267267
*
@@ -290,6 +290,6 @@ inline std::wstring AsWString(const Value& val)
290290
{
291291
return nonstd::visit(detail::WStringGetter(), val.data());
292292
}
293-
}
293+
} // namespace jinja2
294294

295-
#endif // JINJA2_STRING_HELPERS_H
295+
#endif // JINJA2CPP_STRING_HELPERS_H

Diff for: include/jinja2cpp/template.h

+4-4
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
1-
#ifndef JINJA2_TEMPLATE_H
2-
#define JINJA2_TEMPLATE_H
1+
#ifndef JINJA2CPP_TEMPLATE_H
2+
#define JINJA2CPP_TEMPLATE_H
33

44
#include "config.h"
55
#include "error_info.h"
@@ -279,6 +279,6 @@ class JINJA2CPP_EXPORT TemplateW
279279
std::shared_ptr<ITemplateImpl> m_impl;
280280
friend class TemplateImpl<wchar_t>;
281281
};
282-
} // jinja2
282+
} // namespace jinja2
283283

284-
#endif // JINJA2_TEMPLATE_H
284+
#endif // JINJA2CPP_TEMPLATE_H

Diff for: include/jinja2cpp/template_env.h

+1-1
Original file line numberDiff line numberDiff line change
@@ -242,6 +242,6 @@ class JINJA2CPP_EXPORT TemplateEnv
242242
std::unordered_map<std::string, TemplateWCacheEntry> m_templateWCache;
243243
};
244244

245-
} // jinja2
245+
} // namespace jinja2
246246

247247
#endif // JINJA2CPP_TEMPLATE_ENV_H

Diff for: include/jinja2cpp/user_callable.h

+5-5
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
1-
#ifndef USER_CALLABLE_H
2-
#define USER_CALLABLE_H
1+
#ifndef JINJA2CPP_USER_CALLABLE_H
2+
#define JINJA2CPP_USER_CALLABLE_H
33

44
#include "string_helpers.h"
55
#include "value.h"
@@ -340,7 +340,7 @@ template<typename... T>
340340
struct ArgDescrHasType<ArgInfoT<T>...> : std::true_type
341341
{
342342
};
343-
} // detail
343+
} // namespace detail
344344
#endif // JINJA2CPP_NO_DOXYGEN
345345

346346
/*!
@@ -431,6 +431,6 @@ auto MakeCallable(Fn&& f)
431431
{
432432
return UserCallable{ [=, fn = std::forward<Fn>(f)](const UserCallableParams&) { return fn(); }, {} };
433433
}
434-
} // jinja2
434+
} // namespace jinja2
435435

436-
#endif // USER_CALLABLE_H
436+
#endif // JINJA2CPP_USER_CALLABLE_H

Diff for: include/jinja2cpp/value.h

+4-4
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
1-
#ifndef JINJA2_VALUE_H
2-
#define JINJA2_VALUE_H
1+
#ifndef JINJA2CPP_VALUE_H
2+
#define JINJA2CPP_VALUE_H
33

44
#include "generic_list.h"
55
#include "value_ptr.hpp"
@@ -652,6 +652,6 @@ inline Value::Value(ValuesMap&& map) noexcept
652652
{
653653
}
654654

655-
} // jinja2
655+
} // namespace jinja2
656656

657-
#endif // JINJA2_VALUE_H
657+
#endif // JINJA2CPP_VALUE_H

Diff for: include/jinja2cpp/value_ptr.hpp

+5
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,6 @@
1+
#ifndef JINJA2CPP_VALUE_PTR_HPP
2+
#define JINJA2CPP_VALUE_PTR_HPP
3+
14
//
25
// Copyright 2017-2018 by Martin Moene
36
//
@@ -1288,3 +1291,5 @@ struct hash< nonstd::value_ptr<T, D, C> >
12881291
#endif
12891292

12901293
#endif // NONSTD_VALUE_PTR_LITE_HPP
1294+
1295+
#endif

Diff for: src/ast_visitor.h

+4-4
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
1-
#ifndef AST_VISITOR_H
2-
#define AST_VISITOR_H
1+
#ifndef JINJA2CPP_SRC_AST_VISITOR_H
2+
#define JINJA2CPP_SRC_AST_VISITOR_H
33

44
namespace jinja2
55
{
@@ -76,7 +76,7 @@ struct VisitorBase
7676
{
7777
using type = typename VisitorBaseImpl<void, Types ...>::base_type;
7878
};
79-
}
79+
} // namespace detail
8080

8181
template<typename ... Types>
8282
using VisitorBase = typename detail::VisitorBase<Types...>::type;
@@ -109,7 +109,7 @@ class StatementVisitor : public VisitorBase<
109109
stmt->ApplyVisitor(this);
110110
}
111111
};
112-
}
112+
} // namespace jinja2
113113

114114

115115
#endif

Diff for: src/error_handling.h

+4-4
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
1-
#ifndef ERROR_HANDLING_H
2-
#define ERROR_HANDLING_H
1+
#ifndef JINJA2CPP_SRC_ERROR_HANDLING_H
2+
#define JINJA2CPP_SRC_ERROR_HANDLING_H
33

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

62-
} // jinja2
63-
#endif // ERROR_HANDLING_H
62+
} // namespace jinja2
63+
#endif // JINJA2CPP_SRC_ERROR_HANDLING_H

Diff for: src/expression_evaluator.h

+5-5
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
1-
#ifndef EXPRESSION_EVALUATOR_H
2-
#define EXPRESSION_EVALUATOR_H
1+
#ifndef JINJA2CPP_SRC_EXPRESSION_EVALUATOR_H
2+
#define JINJA2CPP_SRC_EXPRESSION_EVALUATOR_H
33

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

382-
#endif // EXPRESSION_EVALUATOR_H
382+
#endif // JINJA2CPP_SRC_EXPRESSION_EVALUATOR_H

Diff for: src/expression_parser.h

+4-4
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
1-
#ifndef EXPRESSION_PARSER_H
2-
#define EXPRESSION_PARSER_H
1+
#ifndef JINJA2CPP_SRC_EXPRESSION_PARSER_H
2+
#define JINJA2CPP_SRC_EXPRESSION_PARSER_H
33

44
#include "lexer.h"
55
#include "error_handling.h"
@@ -44,6 +44,6 @@ class ExpressionParser
4444
ComposedRenderer* m_topLevelRenderer = nullptr;
4545
};
4646

47-
} // jinja2
47+
} // namespace jinja2
4848

49-
#endif // EXPRESSION_PARSER_H
49+
#endif // JINJA2CPP_SRC_EXPRESSION_PARSER_H

Diff for: src/filters.h

+5-5
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
1-
#ifndef FILTERS_H
2-
#define FILTERS_H
1+
#ifndef JINJA2CPP_SRC_FILTERS_H
2+
#define JINJA2CPP_SRC_FILTERS_H
33

44
#include "expression_evaluator.h"
55
#include "function_base.h"
@@ -273,7 +273,7 @@ class UserDefinedFilter : public FilterBase
273273
FilterParams m_callParams;
274274
};
275275

276-
} // filters
277-
} // jinja2
276+
} // namespace filters
277+
} // namespace jinja2
278278

279-
#endif // FILTERS_H
279+
#endif // JINJA2CPP_SRC_FILTERS_H

Diff for: src/function_base.h

+4-4
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
1-
#ifndef FUNCTION_BASE_H
2-
#define FUNCTION_BASE_H
1+
#ifndef JINJA2CPP_SRC_FUNCTION_BASE_H
2+
#define JINJA2CPP_SRC_FUNCTION_BASE_H
33

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

34-
} // jinja2
34+
} // namespace jinja2
3535

36-
#endif // FUNCTION_BASE_H
36+
#endif // JINJA2CPP_SRC_FUNCTION_BASE_H

Diff for: src/generic_adapters.h

+4-4
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
1-
#ifndef GENERIC_ADAPTERS_H
2-
#define GENERIC_ADAPTERS_H
1+
#ifndef JINJA2CPP_SRC_GENERIC_ADAPTERS_H
2+
#define JINJA2CPP_SRC_GENERIC_ADAPTERS_H
33

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

186-
} // jinja2
186+
} // namespace jinja2
187187

188-
#endif // GENERIC_ADAPTERS_H
188+
#endif // JINJA2CPP_SRC_GENERIC_ADAPTERS_H

Diff for: src/helpers.h

+4-4
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
1-
#ifndef HELPERS_H
2-
#define HELPERS_H
1+
#ifndef JINJA2CPP_SRC_HELPERS_H
2+
#define JINJA2CPP_SRC_HELPERS_H
33

44
#include <nonstd/string_view.hpp>
55
#include <jinja2cpp/string_helpers.h>
@@ -114,6 +114,6 @@ Sequence CompileEscapes(Sequence s)
114114
return s;
115115
}
116116

117-
} // jinja2
117+
} // namespace jinja2
118118

119-
#endif // HELPERS_H
119+
#endif // JINJA2CPP_SRC_HELPERS_H

0 commit comments

Comments
 (0)