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