The Machine Perception Toolbox

[Introduction]- [News]- [Download]- [Screenshots]- [Manual (pdf)]- [Forums]- [API Reference]- [Repository ]

 

Main Page | Namespace List | Class Hierarchy | Alphabetical List | Class List | Directories | File List | Namespace Members | Class Members | File Members | Related Pages

codegen.cpp

Go to the documentation of this file.
00001 // (C) Copyright Vladimir Prus, 2003
00002 // Permission to copy, use, modify, sell and distribute this software
00003 // is granted provided this copyright notice appears in all copies.
00004 // This software is provided "as is" without express or implied
00005 // warranty, and with no claim as to its suitability for any purpose.
00006 
00007 // Please see 'usage.verbatim' file for usage notes.
00008 
00009 #include <iostream>
00010 #include <string>
00011 #include <cstring>
00012 using std::cout;
00013 using std::string;
00014 using std::strlen;
00015 
00016 extern const char class_template[];
00017 extern const char usage[];
00018 
00019 int main(int ac, char* av[])
00020 {
00021     if (av[1]) {        
00022 
00023         string class_name = av[1];
00024         string s = class_template;
00025         
00026         string::size_type n;
00027         while((n = s.find("%class_name%")) != string::npos) {
00028             s.replace(n, strlen("%class_name%"), class_name);
00029         }
00030         std::cout << "Output is:\n";
00031         std::cout << s << "\n";        
00032         return 0;
00033     } else {
00034         std::cout << usage << "\n";
00035         return 1;
00036     }
00037 }

Generated on Mon Nov 8 17:07:31 2004 for MPT by  doxygen 1.3.9.1