1 // Copyright 2020 Google LLC
2 //
3 // Licensed under the Apache License, Version 2.0 (the "License");
4 // you may not use this file except in compliance with the License.
5 // You may obtain a copy of the License at
6 //
7 //      https://www.apache.org/licenses/LICENSE-2.0
8 //
9 // Unless required by applicable law or agreed to in writing, software
10 // distributed under the License is distributed on an "AS IS" BASIS,
11 // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12 // See the License for the specific language governing permissions and
13 // limitations under the License.
14 #ifndef GOOGLE_CLOUD_CPP_GENERATOR_INTERNAL_METADATA_DECORATOR_GENERATOR_H
15 #define GOOGLE_CLOUD_CPP_GENERATOR_INTERNAL_METADATA_DECORATOR_GENERATOR_H
16 
17 #include "google/cloud/status.h"
18 #include "generator/internal/printer.h"
19 #include "generator/internal/service_code_generator.h"
20 #include <google/protobuf/compiler/code_generator.h>
21 #include <google/protobuf/descriptor.h>
22 #include <map>
23 #include <memory>
24 #include <string>
25 
26 namespace google {
27 namespace cloud {
28 namespace generator_internal {
29 
30 /**
31  * Generates the header file and cc file for the Metadata decorator for a
32  * particular service.
33  */
34 class MetadataDecoratorGenerator : public ServiceCodeGenerator {
35  public:
36   MetadataDecoratorGenerator(
37       google::protobuf::ServiceDescriptor const* service_descriptor,
38       VarsDictionary service_vars,
39       std::map<std::string, VarsDictionary> service_method_vars,
40       google::protobuf::compiler::GeneratorContext* context);
41 
42   ~MetadataDecoratorGenerator() override = default;
43 
44   MetadataDecoratorGenerator(MetadataDecoratorGenerator const&) = delete;
45   MetadataDecoratorGenerator& operator=(MetadataDecoratorGenerator const&) =
46       delete;
47   MetadataDecoratorGenerator(MetadataDecoratorGenerator&&) = default;
48   MetadataDecoratorGenerator& operator=(MetadataDecoratorGenerator&&) = default;
49 
50  private:
51   Status GenerateHeader() override;
52   Status GenerateCc() override;
53 };
54 
55 }  // namespace generator_internal
56 }  // namespace cloud
57 }  // namespace google
58 
59 #endif  // GOOGLE_CLOUD_CPP_GENERATOR_INTERNAL_METADATA_DECORATOR_GENERATOR_H
60