From 8f2fac5d4d1e12bf5a105ef345c2e892568e3582 Mon Sep 17 00:00:00 2001 From: pantor Date: Fri, 10 Apr 2020 15:58:05 +0200 Subject: [PATCH] update version, code style --- README.md | 2 +- doc/Doxyfile | 2 +- include/inja/function_storage.hpp | 13 ++++++++++--- include/inja/lexer.hpp | 5 ++++- single_include/inja/inja.hpp | 12 +++++++++--- 5 files changed, 25 insertions(+), 9 deletions(-) diff --git a/README.md b/README.md index 63babef..e8c61ca 100644 --- a/README.md +++ b/README.md @@ -52,7 +52,7 @@ If you are using the [Meson Build System](http://mesonbuild.com), then you can w If you are using [Conan](https://conan.io) to manage your dependencies, have a look at [this repository](https://github.com/DEGoodmanWilson/conan-inja). Please file issues [here](https://github.com/DEGoodmanWilson/conan-inja/issues) if you experience problems with the packages. -You can also integrate inja in your project using [Hunter](https://github.com/ruslo/hunter), a package manager for C++. +You can also integrate inja in your project using [Hunter](https://github.com/cpp-pm/hunter), a package manager for C++. If you are using [vcpkg](https://github.com/Microsoft/vcpkg) on your project for external dependencies, then you can use the [inja package](https://github.com/Microsoft/vcpkg/tree/master/ports/inja). Please see the vcpkg project for any issues regarding the packaging. diff --git a/doc/Doxyfile b/doc/Doxyfile index 9da5c41..eecdfdd 100644 --- a/doc/Doxyfile +++ b/doc/Doxyfile @@ -38,7 +38,7 @@ PROJECT_NAME = "Inja" # could be handy for archiving the generated documentation or if some version # control system is used. -PROJECT_NUMBER = 2.1.0 +PROJECT_NUMBER = 2.2.0 # Using the PROJECT_BRIEF tag one can provide an optional one line description # for a project that appears at the top of each page and should give viewer a diff --git a/include/inja/function_storage.hpp b/include/inja/function_storage.hpp index 1b9247b..8e2ce48 100644 --- a/include/inja/function_storage.hpp +++ b/include/inja/function_storage.hpp @@ -55,7 +55,9 @@ class FunctionStorage { FunctionData& get_or_new(nonstd::string_view name, unsigned int num_args) { auto &vec = m_map[static_cast(name)]; for (auto &i: vec) { - if (i.num_args == num_args) return i; + if (i.num_args == num_args) { + return i; + } } vec.emplace_back(); vec.back().num_args = num_args; @@ -64,9 +66,14 @@ class FunctionStorage { const FunctionData* get(nonstd::string_view name, unsigned int num_args) const { auto it = m_map.find(static_cast(name)); - if (it == m_map.end()) return nullptr; + if (it == m_map.end()) { + return nullptr; + } + for (auto &&i: it->second) { - if (i.num_args == num_args) return &i; + if (i.num_args == num_args) { + return &i; + } } return nullptr; } diff --git a/include/inja/lexer.hpp b/include/inja/lexer.hpp index cbe891a..fe24e7c 100644 --- a/include/inja/lexer.hpp +++ b/include/inja/lexer.hpp @@ -182,7 +182,10 @@ class Lexer { } m_pos = m_tok_start + 1; - if (std::isalpha(ch)) return scan_id(); + if (std::isalpha(ch)) { + return scan_id(); + } + switch (ch) { case ',': return make_token(Token::Kind::Comma); diff --git a/single_include/inja/inja.hpp b/single_include/inja/inja.hpp index 349a78b..526f14f 100644 --- a/single_include/inja/inja.hpp +++ b/single_include/inja/inja.hpp @@ -1856,7 +1856,9 @@ class FunctionStorage { FunctionData& get_or_new(nonstd::string_view name, unsigned int num_args) { auto &vec = m_map[static_cast(name)]; for (auto &i: vec) { - if (i.num_args == num_args) return i; + if (i.num_args == num_args) { + return i; + } } vec.emplace_back(); vec.back().num_args = num_args; @@ -1865,7 +1867,9 @@ class FunctionStorage { const FunctionData* get(nonstd::string_view name, unsigned int num_args) const { auto it = m_map.find(static_cast(name)); - if (it == m_map.end()) return nullptr; + if (it == m_map.end()) { + return nullptr; + } for (auto &&i: it->second) { if (i.num_args == num_args) return &i; } @@ -2208,7 +2212,9 @@ class Lexer { } m_pos = m_tok_start + 1; - if (std::isalpha(ch)) return scan_id(); + if (std::isalpha(ch)) { + return scan_id(); + } switch (ch) { case ',': return make_token(Token::Kind::Comma);