r1317@opsdev009 (orig r70384): mcslee | 2007-11-16 16:32:36 -0800
[amiethrift.git] / compiler / cpp / src / generate / t_oop_generator.h
blob8cba67fbd4b338812652d09a6e6326702fad0c7c
1 // Copyright (c) 2006- Facebook
2 // Distributed under the Thrift Software License
3 //
4 // See accompanying file LICENSE or visit the Thrift site at:
5 // http://developers.facebook.com/thrift/
7 #ifndef T_OOP_GENERATOR_H
8 #define T_OOP_GENERATOR_H
10 #include "globals.h"
11 #include "t_generator.h"
13 /**
14 * Class with utility methods shared across common object oriented languages.
15 * Specifically, most of this stuff is for C++/Java.
17 * @author Mark Slee <mcslee@facebook.com>
19 class t_oop_generator : public t_generator {
20 public:
21 t_oop_generator(t_program* program) :
22 t_generator(program) {}
24 /**
25 * Scoping, using curly braces!
28 void scope_up(std::ostream& out) {
29 indent(out) << "{" << std::endl;
30 indent_up();
33 void scope_down(std::ostream& out) {
34 indent_down();
35 indent(out) << "}" << std::endl;
38 /**
39 * Generates a comment about this code being autogenerated, using C++ style
40 * comments, which are also fair game in Java / PHP, yay!
42 * @return C-style comment mentioning that this file is autogenerated.
44 virtual std::string autogen_comment() {
45 return
46 std::string("/**\n") +
47 " * Autogenerated by Thrift\n" +
48 " *\n" +
49 " * DO NOT EDIT UNLESS YOU ARE SURE THAT YOU KNOW WHAT YOU ARE DOING\n" +
50 " */\n";
54 #endif