OpenSDN source code
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
t_oop_generator.h
Go to the documentation of this file.
1 /*
2  * Licensed to the Apache Software Foundation (ASF) under one
3  * or more contributor license agreements. See the NOTICE file
4  * distributed with this work for additional information
5  * regarding copyright ownership. The ASF licenses this file
6  * to you under the Apache License, Version 2.0 (the
7  * "License"); you may not use this file except in compliance
8  * with the License. You may obtain a copy of the License at
9  *
10  * http://www.apache.org/licenses/LICENSE-2.0
11  *
12  * Unless required by applicable law or agreed to in writing,
13  * software distributed under the License is distributed on an
14  * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
15  * KIND, either express or implied. See the License for the
16  * specific language governing permissions and limitations
17  * under the License.
18  */
19 
20 #ifndef T_OOP_GENERATOR_H
21 #define T_OOP_GENERATOR_H
22 
23 #include <string>
24 #include <iostream>
25 
26 #include "globals.h"
27 #include "t_generator.h"
28 #include "version.h"
29 
30 #include <algorithm>
31 
37 class t_oop_generator : public t_generator {
38  public:
40  t_generator(program) {}
41 
46  void scope_up(std::ostream& out) {
47  indent(out) << "{" << std::endl;
48  indent_up();
49  }
50 
51  void scope_down(std::ostream& out) {
52  indent_down();
53  indent(out) << "}" << std::endl;
54  }
55 
56  std::string upcase_string(std::string original) {
57  std::transform(original.begin(), original.end(), original.begin(), (int(*)(int)) toupper);
58  return original;
59  }
60 
67  virtual std::string autogen_comment() {
68  return
69 #ifdef SANDESH
70  std::string("/**\n") +
71  " * Autogenerated by Sandesh Compiler (" + SANDESH_VERSION + ")\n" +
72  " *\n" +
73  " * DO NOT EDIT UNLESS YOU ARE SURE THAT YOU KNOW WHAT YOU ARE DOING\n" +
74  " * @generated\n" +
75  " * Copyright (c) 2013 Juniper Networks, Inc. All rights reserved.\n" +
76  " */\n";
77 #else
78  std::string("/**\n") +
79  " * Autogenerated by Thrift Compiler (" + THRIFT_VERSION + ")\n" +
80  " *\n" +
81  " * DO NOT EDIT UNLESS YOU ARE SURE THAT YOU KNOW WHAT YOU ARE DOING\n" +
82  " * @generated\n" +
83  " */\n";
84 #endif
85  }
86 };
87 
88 #endif
std::string indent()
Definition: t_generator.h:181
virtual std::string autogen_comment()
t_oop_generator(t_program *program)
void indent_down()
Definition: t_generator.h:174
void scope_up(std::ostream &out)
std::string upcase_string(std::string original)
void scope_down(std::ostream &out)
void indent_up()
Definition: t_generator.h:170
#define SANDESH_VERSION
Definition: version.h:1