Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    primarykey
    data
    text
    <p><strong>Update:</strong> The project has moved to Github and renamed into CTemplate: <a href="https://github.com/OlafvdSpek/ctemplate" rel="nofollow noreferrer">https://github.com/OlafvdSpek/ctemplate</a></p> <p>From the new project page: </p> <blockquote> <p>was originally called Google Templates, due to its origin as the template system used for Google search result pages. Now it has a more general name matching its community-owned nature.</p> </blockquote> <hr> <p>Have you tried Google's CTemplate library ? It seems to be exactly what you are looking for: <a href="http://code.google.com/p/google-ctemplate/" rel="nofollow noreferrer">http://code.google.com/p/google-ctemplate/</a> </p> <p>Your example would be implemented like this:</p> <p>In example.tpl:</p> <blockquote> <p>My name is {{name}}</p> </blockquote> <p>In example.cc:</p> <pre><code>#include &lt;stdlib.h&gt; #include &lt;string&gt; #include &lt;iostream&gt; #include &lt;google/template.h&gt; int main(int argc, char** argv) { google::TemplateDictionary dict("example"); dict.SetValue("name", "John Smith"); google::Template* tpl = google::Template::GetTemplate("example.tpl", google::DO_NOT_STRIP); std::string output; tpl-&gt;Expand(&amp;output, &amp;dict); std::cout &lt;&lt; output; return 0; } </code></pre> <p>Then:</p> <pre><code>$ gcc example.cc -lctemplate -pthread $ ./a.out </code></pre> <blockquote> <p>My name is John Smith</p> </blockquote> <p>Note that there is also a way to write templates as const strings if you don't want to bother writting your templates in separate files.</p>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. VO
      singulars
      1. This table or related slice is empty.
    2. VO
      singulars
      1. This table or related slice is empty.
    3. VO
      singulars
      1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload