From bfeeac6e4889d1e9a1083b3c7efc59652981b168 Mon Sep 17 00:00:00 2001 From: Trygve Laugstøl Date: Mon, 1 Aug 2016 08:20:23 +0200 Subject: o Moving the generation logic to Python, embedding a Python interpreter with the help of pybind11. o Adding install configuration to CMake to make it easier to reuse the project later on. o Splitting out the examples into its own project to make it easier to test the whole installation setup and python/template loading. o Trying to reorganize the code a bit, not very much better yet. --- core/include-priv/trygvis/string_utils.h | 23 +++++++++++++++++++++++ 1 file changed, 23 insertions(+) create mode 100644 core/include-priv/trygvis/string_utils.h (limited to 'core/include-priv/trygvis/string_utils.h') diff --git a/core/include-priv/trygvis/string_utils.h b/core/include-priv/trygvis/string_utils.h new file mode 100644 index 0000000..9902a3f --- /dev/null +++ b/core/include-priv/trygvis/string_utils.h @@ -0,0 +1,23 @@ +#pragma once + +#include + +namespace trygvis { +namespace string_utils { + +/** + * Check if a starts with b. + */ +static bool startsWith(const std::string &a, const std::string &b) { + return b.length() <= a.length() && a.compare(0, b.length(), b) == 0; +} + +/** + * Check if a ends with b. + */ +static bool endsWith(const std::string &a, const std::string &b) { + return b.length() <= a.length() && a.compare(a.length() - b.length(), b.length(), b) == 0; +} + +} // namespace string_utils +} // namespace trygvis -- cgit v1.2.3