• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 // (C) Copyright Vladimir Prus, 2003
2 // Distributed under the Boost Software License, Version 1.0. (See
3 // accompanying file LICENSE_1_0.txt or copy at
4 // http://www.boost.org/LICENSE_1_0.txt)
5 
6 // Please see 'usage.verbatim' file for usage notes.
7 
8 #include <iostream>
9 #include <string>
10 #include <cstring>
11 using std::cout;
12 using std::string;
13 using std::strlen;
14 
15 extern const char class_template[];
16 extern const char usage[];
17 
main(int ac,char * av[])18 int main(int ac, char* av[])
19 {
20     if (av[1]) {
21 
22         string class_name = av[1];
23         string s = class_template;
24 
25         string::size_type n;
26         while((n = s.find("%class_name%")) != string::npos) {
27             s.replace(n, strlen("%class_name%"), class_name);
28         }
29         std::cout << "Output is:\n";
30         std::cout << s << "\n";
31         return 0;
32     } else {
33         std::cout << usage << "\n";
34         return 1;
35     }
36 }
37