cemplate

Simple C++ template engine
git clone git://git.dimitrijedobrota.com/cemplate.git
Log | Files | Refs | README | LICENSE | HACKING | CONTRIBUTING | CODE_OF_CONDUCT | BUILDING

commit 606b4e718aa427565d66d684f9e49e6e5f54754c
parent b260b09c86df05ddd41655a108306c69cb2042f2
author Dimitrije Dobrota < mail@dimitrijedobrota.com >
date Wed, 26 Feb 2025 18:34:05 +0100

Fix a few inconsistencies

Diffstat:
M CMakeLists.txt | + -
M include/cemplate/cemplate.hpp | ++++++++++++++++++++ ---------------
M source/cemplate.cpp | + -

3 files changed, 22 insertions(+), 17 deletions(-)


diff --git a/ CMakeLists.txt b/ CMakeLists.txt

@@ -4,7 +4,7 @@ include(cmake/prelude.cmake)


project(
cemplate
VERSION 0.1.8
VERSION 0.1.9
DESCRIPTION "Simple C++ template engine"
HOMEPAGE_URL "https://git.dimitrijedobrota.com/cemplate.git"
LANGUAGES CXX

diff --git a/ include/cemplate/cemplate.hpp b/ include/cemplate/cemplate.hpp

@@ -35,6 +35,21 @@ std::string join(

return res;
}

class String
{
public:
explicit String(std::string value)
: m_value(std::move(value))
{
}

operator std::string() const; // NOLINT
friend std::ostream& operator<<(std::ostream& ost, const String& rhs);

private:
std::string m_value;
};

class InitlistElem;

class Initlist

@@ -72,6 +87,11 @@ public:

{
}

InitlistElem(String value) // NOLINT
: m_value(std::move(value))
{
}

InitlistElem(std::initializer_list<InitlistElem> list) // NOLINT
: m_value(std::in_place_type<Initlist>, list)
{

@@ -356,21 +376,6 @@ private:

std::string m_value;
};

class String
{
public:
explicit String(std::string value)
: m_value(std::move(value))
{
}

operator std::string() const; // NOLINT
friend std::ostream& operator<<(std::ostream& ost, const String& rhs);

private:
std::string m_value;
};

template<typename T, int key>
std::ostream& operator<<(std::ostream& ost, const T& rhs)
{

diff --git a/ source/cemplate.cpp b/ source/cemplate.cpp

@@ -116,7 +116,7 @@ std::string Initlist::format(uint64_t lvl) const


Initlist::operator std::string() const
{
return std::format("{{\n{}{}}};\n", format(indent_lvl + 1), indent());
return std::format("{{\n{}{}}}", format(indent_lvl + 1), indent());
}

Function::operator std::string() const