1
// Protocol Buffers - Google's data interchange format
2
// Copyright 2008 Google Inc.
3
// http://code.google.com/p/protobuf/
5
// Licensed under the Apache License, Version 2.0 (the "License");
6
// you may not use this file except in compliance with the License.
7
// You may obtain a copy of the License at
9
// http://www.apache.org/licenses/LICENSE-2.0
11
// Unless required by applicable law or agreed to in writing, software
12
// distributed under the License is distributed on an "AS IS" BASIS,
13
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14
// See the License for the specific language governing permissions and
15
// limitations under the License.
17
// Author: kenton@google.com (Kenton Varda)
18
// Based on original Protocol Buffers design by
19
// Sanjay Ghemawat, Jeff Dean, and others.
21
#ifndef GOOGLE_PROTOBUF_COMPILER_CPP_EXTENSION_H__
22
#define GOOGLE_PROTOBUF_COMPILER_CPP_EXTENSION_H__
25
#include <google/protobuf/stubs/common.h>
29
class FieldDescriptor; // descriptor.h
31
class Printer; // printer.h
39
// Generates code for an extension, which may be within the scope of some
40
// message or may be at file scope. This is much simpler than FieldGenerator
41
// since extensions are just simple identifiers with interesting types.
42
class ExtensionGenerator {
44
// See generator.cc for the meaning of dllexport_decl.
45
explicit ExtensionGenerator(const FieldDescriptor* descriptor,
46
const string& dllexport_decl);
47
~ExtensionGenerator();
50
void GenerateDeclaration(io::Printer* printer);
53
void GenerateDefinition(io::Printer* printer);
56
const FieldDescriptor* descriptor_;
58
string dllexport_decl_;
60
GOOGLE_DISALLOW_EVIL_CONSTRUCTORS(ExtensionGenerator);
64
} // namespace compiler
65
} // namespace protobuf
68
#endif // GOOGLE_PROTOBUF_COMPILER_CPP_MESSAGE_H__