By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
429,515 Members | 1,363 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 429,515 IT Pros & Developers. It's quick & easy.

Template Engine

P: 4
Hello! I need a C++ template engine like Smarty. There is some html file with keywords and symbols, you need the program to read this file, replace these words with necessary actions (for example, you need to extract data from the database) and output the finished html file without any unnecessary symbols. Please HELP!
Apr 22 '17 #1
Share this Question
Share on Google+
7 Replies


weaknessforcats
Expert Mod 5K+
P: 9,197
Do you know how C++ templates work?
Apr 22 '17 #2

P: 4
No, if you mean something different from what I'm looking for
Apr 22 '17 #3

weaknessforcats
Expert Mod 5K+
P: 9,197
A C++ template is code with no types.

Expand|Select|Wrap|Line Numbers
  1. <template>
  2. T func(T* x)
  3. {
  4.     return x;
  5. }
In your code you say:

Expand|Select|Wrap|Line Numbers
  1. int Z = 10;
  2. int a = func<int>(&Z);
The preprocessor hands this to the compiler:

Expand|Select|Wrap|Line Numbers
  1. int funcABCDintxxxx(int* x)
  2. {
  3.     return x;
  4. }
  5.  
  6. int Z = 10;
  7.     funcABCDintxxxx(&Z);
  8.  
The funcABCDintxxxx is the result of the mangler which is C++ system library code used to obtain a unique name from some not unique input.

So you will have one func for every type you used. The alternative is you coming up with unique names for identical code.

Is this what you are looking for?
Apr 22 '17 #4

P: 4
I suppose no! But could you give a code of this C++ template library.
Generally I need the program to read the html file with some key symbols and words, process these keywords and output a full html file without any keywords or key symbols.

If you want I can show you a screen of initial state of html file and a screen of output state of html file?
Apr 22 '17 #5

weaknessforcats
Expert Mod 5K+
P: 9,197
Because the templates are in text and your code is in text everyone can see the templates. They are public domain.

Just query the Internet for C++ Template Library
Apr 23 '17 #6

P: 4
Actually I need something like Django (Python framework) but C++ variant, which doesn't have any own server and db, just html corrector, IDK. Sometimes its called template language
Apr 23 '17 #7

weaknessforcats
Expert Mod 5K+
P: 9,197
At least you know that C++ is not your answer.
Apr 23 '17 #8

Post your reply

Sign in to post your reply or Sign up for a free account.