~ubuntu-branches/ubuntu/oneiric/protobuf/oneiric

« back to all changes in this revision

Viewing changes to src/google/protobuf/compiler/cpp/cpp_extension.h

  • Committer: Bazaar Package Importer
  • Author(s): Iustin Pop
  • Date: 2008-08-03 11:01:44 UTC
  • Revision ID: james.westby@ubuntu.com-20080803110144-uyiw41bf1m2oe17t
Tags: upstream-2.0.0~b
ImportĀ upstreamĀ versionĀ 2.0.0~b

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
// Protocol Buffers - Google's data interchange format
 
2
// Copyright 2008 Google Inc.
 
3
// http://code.google.com/p/protobuf/
 
4
//
 
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
 
8
//
 
9
//      http://www.apache.org/licenses/LICENSE-2.0
 
10
//
 
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.
 
16
 
 
17
// Author: kenton@google.com (Kenton Varda)
 
18
//  Based on original Protocol Buffers design by
 
19
//  Sanjay Ghemawat, Jeff Dean, and others.
 
20
 
 
21
#ifndef GOOGLE_PROTOBUF_COMPILER_CPP_EXTENSION_H__
 
22
#define GOOGLE_PROTOBUF_COMPILER_CPP_EXTENSION_H__
 
23
 
 
24
#include <string>
 
25
#include <google/protobuf/stubs/common.h>
 
26
 
 
27
namespace google {
 
28
namespace protobuf {
 
29
  class FieldDescriptor;       // descriptor.h
 
30
  namespace io {
 
31
    class Printer;             // printer.h
 
32
  }
 
33
}
 
34
 
 
35
namespace protobuf {
 
36
namespace compiler {
 
37
namespace cpp {
 
38
 
 
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 {
 
43
 public:
 
44
  // See generator.cc for the meaning of dllexport_decl.
 
45
  explicit ExtensionGenerator(const FieldDescriptor* descriptor,
 
46
                              const string& dllexport_decl);
 
47
  ~ExtensionGenerator();
 
48
 
 
49
  // Header stuff.
 
50
  void GenerateDeclaration(io::Printer* printer);
 
51
 
 
52
  // Source file stuff.
 
53
  void GenerateDefinition(io::Printer* printer);
 
54
 
 
55
 private:
 
56
  const FieldDescriptor* descriptor_;
 
57
  string type_traits_;
 
58
  string dllexport_decl_;
 
59
 
 
60
  GOOGLE_DISALLOW_EVIL_CONSTRUCTORS(ExtensionGenerator);
 
61
};
 
62
 
 
63
}  // namespace cpp
 
64
}  // namespace compiler
 
65
}  // namespace protobuf
 
66
 
 
67
}  // namespace google
 
68
#endif  // GOOGLE_PROTOBUF_COMPILER_CPP_MESSAGE_H__