1 // Copyright (c) 2006- Facebook
2 // Distributed under the Thrift Software License
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
11 #include "t_generator.h"
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
{
21 t_oop_generator(t_program
* program
) :
22 t_generator(program
) {}
25 * Scoping, using curly braces!
28 void scope_up(std::ostream
& out
) {
29 indent(out
) << "{" << std::endl
;
33 void scope_down(std::ostream
& out
) {
35 indent(out
) << "}" << std::endl
;
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() {
46 std::string("/**\n") +
47 " * Autogenerated by Thrift\n" +
49 " * DO NOT EDIT UNLESS YOU ARE SURE THAT YOU KNOW WHAT YOU ARE DOING\n" +