OpenSDN source code
Main Page
Related Pages
Namespaces
Classes
Files
File List
File Members
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
:
39
t_oop_generator
(
t_program
* program) :
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
t_program
Definition:
t_program.h:64
t_generator::indent
std::string indent()
Definition:
t_generator.h:181
t_generator.h
t_oop_generator::autogen_comment
virtual std::string autogen_comment()
Definition:
t_oop_generator.h:67
t_oop_generator::t_oop_generator
t_oop_generator(t_program *program)
Definition:
t_oop_generator.h:39
t_generator::indent_down
void indent_down()
Definition:
t_generator.h:174
t_oop_generator::scope_up
void scope_up(std::ostream &out)
Definition:
t_oop_generator.h:46
globals.h
t_generator
Definition:
t_generator.h:37
t_oop_generator::upcase_string
std::string upcase_string(std::string original)
Definition:
t_oop_generator.h:56
t_oop_generator::scope_down
void scope_down(std::ostream &out)
Definition:
t_oop_generator.h:51
version.h
t_generator::indent_up
void indent_up()
Definition:
t_generator.h:170
SANDESH_VERSION
#define SANDESH_VERSION
Definition:
version.h:1
t_oop_generator
Definition:
t_oop_generator.h:37
contrail
src
contrail-common
sandesh
compiler
generate
t_oop_generator.h
Generated by
1.8.5