cemplateSimple C++ template engine |
git clone git://git.dimitrijedobrota.com/cemplate.git |
Log | Files | Refs | README | LICENSE | HACKING | CONTRIBUTING | CODE_OF_CONDUCT | BUILDING |
example.cpp (1086B)
0 #include <iostream> 1 2 #include "cemplate/cemplate.hpp" 3 4 int main() 5 { 6 using namespace std::string_literals; // NOLINT 7 using namespace cemplate; // NOLINT 8 9 Program program(std::cout); 10 11 // clang-format off 12 program.pragma("once") 13 .line_empty() 14 .include("format") 15 .include("iostream") 16 .include("string") 17 .line_empty() 18 .namespace_open("cemplate") 19 20 .comment("some test function") 21 .function_open("test", "int") 22 .ret("3") 23 .function_close("test") 24 25 .comment("another test function") 26 .function_open("test", "void", {{{"int"s, "val1"s}}}) 27 .function_close("test") 28 29 .multilineComment({"", "yet, another test function", "this time with multiple params"}) 30 .function_open("test", "void", {{"int"s, "val1"s}, {"std::string"s, "val2"s}}) 31 .function_close("test") 32 33 .function_decl("decl", "void") 34 .line_empty() 35 36 .declaration("static const test_class", "test", {"val11", "val12", {"val21", "val22"}, "val13"}) 37 38 .namespace_close("cemplate"); 39 // clang-format on 40 41 return 0; 42 }