Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(73)

Side by Side Diff: third_party/protobuf/src/google/protobuf/compiler/cpp/cpp_enum.h

Issue 2495533002: third_party/protobuf: Update to HEAD (83d681ee2c) (Closed)
Patch Set: Make chrome settings proto generated file a component Created 4 years ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
1 // Protocol Buffers - Google's data interchange format 1 // Protocol Buffers - Google's data interchange format
2 // Copyright 2008 Google Inc. All rights reserved. 2 // Copyright 2008 Google Inc. All rights reserved.
3 // https://developers.google.com/protocol-buffers/ 3 // https://developers.google.com/protocol-buffers/
4 // 4 //
5 // Redistribution and use in source and binary forms, with or without 5 // Redistribution and use in source and binary forms, with or without
6 // modification, are permitted provided that the following conditions are 6 // modification, are permitted provided that the following conditions are
7 // met: 7 // met:
8 // 8 //
9 // * Redistributions of source code must retain the above copyright 9 // * Redistributions of source code must retain the above copyright
10 // notice, this list of conditions and the following disclaimer. 10 // notice, this list of conditions and the following disclaimer.
(...skipping 48 matching lines...) Expand 10 before | Expand all | Expand 10 after
59 ~EnumGenerator(); 59 ~EnumGenerator();
60 60
61 // Header stuff. 61 // Header stuff.
62 62
63 // Fills the name to use when declaring the enum. This is for use when 63 // Fills the name to use when declaring the enum. This is for use when
64 // generating other .proto.h files. This code should be placed within the 64 // generating other .proto.h files. This code should be placed within the
65 // enum's package namespace, but NOT within any class, even for nested 65 // enum's package namespace, but NOT within any class, even for nested
66 // enums. A given key in enum_names will map from an enum class name to the 66 // enums. A given key in enum_names will map from an enum class name to the
67 // EnumDescriptor that was responsible for its inclusion in the map. This can 67 // EnumDescriptor that was responsible for its inclusion in the map. This can
68 // be used to associate the descriptor with the code generated for it. 68 // be used to associate the descriptor with the code generated for it.
69 void FillForwardDeclaration(map<string, const EnumDescriptor*>* enum_names); 69 void FillForwardDeclaration(
70 std::map<string, const EnumDescriptor*>* enum_names);
70 71
71 // Generate header code defining the enum. This code should be placed 72 // Generate header code defining the enum. This code should be placed
72 // within the enum's package namespace, but NOT within any class, even for 73 // within the enum's package namespace, but NOT within any class, even for
73 // nested enums. 74 // nested enums.
74 void GenerateDefinition(io::Printer* printer); 75 void GenerateDefinition(io::Printer* printer);
75 76
76 // Generate specialization of GetEnumDescriptor<MyEnum>(). 77 // Generate specialization of GetEnumDescriptor<MyEnum>().
77 // Precondition: in ::google::protobuf namespace. 78 // Precondition: in ::google::protobuf namespace.
78 void GenerateGetEnumDescriptorSpecializations(io::Printer* printer); 79 void GenerateGetEnumDescriptorSpecializations(io::Printer* printer);
79 80
80 // For enums nested within a message, generate code to import all the enum's 81 // For enums nested within a message, generate code to import all the enum's
81 // symbols (e.g. the enum type name, all its values, etc.) into the class's 82 // symbols (e.g. the enum type name, all its values, etc.) into the class's
82 // namespace. This should be placed inside the class definition in the 83 // namespace. This should be placed inside the class definition in the
83 // header. 84 // header.
84 void GenerateSymbolImports(io::Printer* printer); 85 void GenerateSymbolImports(io::Printer* printer);
85 86
86 // Source file stuff. 87 // Source file stuff.
87 88
88 // Generate code that initializes the global variable storing the enum's 89 // Generate code that initializes the global variable storing the enum's
89 // descriptor. 90 // descriptor.
90 void GenerateDescriptorInitializer(io::Printer* printer, int index); 91 void GenerateDescriptorInitializer(io::Printer* printer);
91 92
92 // Generate non-inline methods related to the enum, such as IsValidValue(). 93 // Generate non-inline methods related to the enum, such as IsValidValue().
93 // Goes in the .cc file. 94 // Goes in the .cc file.
94 void GenerateMethods(io::Printer* printer); 95 void GenerateMethods(io::Printer* printer);
95 96
96 private: 97 private:
97 const EnumDescriptor* descriptor_; 98 const EnumDescriptor* descriptor_;
98 const string classname_; 99 const string classname_;
99 const Options& options_; 100 const Options& options_;
100 // whether to generate the *_ARRAYSIZE constant. 101 // whether to generate the *_ARRAYSIZE constant.
101 const bool generate_array_size_; 102 const bool generate_array_size_;
102 103
104 int index_in_metadata_;
105
106 friend class FileGenerator;
103 GOOGLE_DISALLOW_EVIL_CONSTRUCTORS(EnumGenerator); 107 GOOGLE_DISALLOW_EVIL_CONSTRUCTORS(EnumGenerator);
104 }; 108 };
105 109
106 } // namespace cpp 110 } // namespace cpp
107 } // namespace compiler 111 } // namespace compiler
108 } // namespace protobuf 112 } // namespace protobuf
109 113
110 } // namespace google 114 } // namespace google
111 #endif // GOOGLE_PROTOBUF_COMPILER_CPP_ENUM_H__ 115 #endif // GOOGLE_PROTOBUF_COMPILER_CPP_ENUM_H__
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698