You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
 
TimQu e3fbb77362 JaniParser::parseFormula: Boolean connections of AtomicExpressionFormulas are now parsed as a single AtomicExpressionFormula (i.e. 'a>1 & b>2' becomes a single atomic proposition instead of having two propositions 'a>1' and 'b>2'). This reduces the number of labels that need to be considered and improves partial state space exploration for formulas such as 'P=? [F a>1 & b>2]'. 7 years ago
..
LICENSE.txt adding cpptemplate library 9 years ago
README.rst update cpptemplate to slightly fixed version 9 years ago
cpptempl.cpp update cpptemplate to slightly fixed version 9 years ago
cpptempl.h fixed a couple of warnings 9 years ago
cpptempl_test.cpp adding cpptemplate library 9 years ago
unit_testing.h adding cpptemplate library 9 years ago

README.rst

cpptempl

=================
This is a template engine for C++.

Copyright
==================
Author: Ryan Ginstrom
MIT License

Syntax
=================

Variables::

{$variable_name}

Loops::

{% for person in people %}Name: {$person.name}{% endfor %}

If::

{% if person.name == "Bob" %}Full name: Robert{% endif %}


Usage
=======================

Define a template::

string text = "{% if item %}{$item}{% endif %}\n"
"{% if thing %}{$thing}{% endif %}" ;

Set up data::

cpptempl::data_map data ;
data["item"] = "aaa" ;
data["thing"] = "bbb" ;

Parse the template and data::

string result = cpptempl::parse(text, data) ;

Lists, nested maps
========================

Example::

cpptempl::data_map person_data ;
person_data["name"] = "Bob" ;
person_data["occupation"] = "Plumber" ;

cpptempl::data_map content ;
content["person"] = person_data ;
content["friends"].push_back("Alice") ;
content["friends"].push_back("Bob") ;