| OLD | NEW |
| 1 // Copyright 2016 The Chromium Authors. All rights reserved. | 1 // Copyright 2016 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 #include "proto_zero_generator.h" | 5 #include "proto_zero_generator.h" |
| 6 | 6 |
| 7 #include <map> | 7 #include <map> |
| 8 #include <memory> | 8 #include <memory> |
| 9 #include <set> | 9 #include <set> |
| 10 #include <string> | 10 #include <string> |
| (...skipping 191 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 202 } | 202 } |
| 203 | 203 |
| 204 // Print top header, namespaces and forward declarations. | 204 // Print top header, namespaces and forward declarations. |
| 205 void GeneratePrologue() { | 205 void GeneratePrologue() { |
| 206 std::string greeting = | 206 std::string greeting = |
| 207 "// Autogenerated. DO NOT EDIT.\n" | 207 "// Autogenerated. DO NOT EDIT.\n" |
| 208 "// Protobuf compiler (protoc) has generated these stubs with\n" | 208 "// Protobuf compiler (protoc) has generated these stubs with\n" |
| 209 "// //components/tracing/tools/proto_zero_plugin.\n"; | 209 "// //components/tracing/tools/proto_zero_plugin.\n"; |
| 210 std::string guard = package_ + "_" + source_->name() + "_H_"; | 210 std::string guard = package_ + "_" + source_->name() + "_H_"; |
| 211 UpperString(&guard); | 211 UpperString(&guard); |
| 212 StripString(&guard, ".-", '_'); | 212 StripString(&guard, ".-/\\", '_'); |
| 213 | 213 |
| 214 stub_h_->Print( | 214 stub_h_->Print( |
| 215 "$greeting$\n" | 215 "$greeting$\n" |
| 216 "#ifndef $guard$\n" | 216 "#ifndef $guard$\n" |
| 217 "#define $guard$\n\n" | 217 "#define $guard$\n\n" |
| 218 "#include <stddef.h>\n" | 218 "#include <stddef.h>\n" |
| 219 "#include <stdint.h>\n\n" | 219 "#include <stdint.h>\n\n" |
| 220 "#include \"components/tracing/core/proto_zero_message.h\"\n", | 220 "#include \"components/tracing/core/proto_zero_message.h\"\n", |
| 221 "greeting", greeting, | 221 "greeting", greeting, |
| 222 "guard", guard); | 222 "guard", guard); |
| (...skipping 332 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 555 GeneratorJob job(file, &stub_h_printer, &stub_cc_printer); | 555 GeneratorJob job(file, &stub_h_printer, &stub_cc_printer); |
| 556 if (!job.GenerateStubs()) { | 556 if (!job.GenerateStubs()) { |
| 557 *error = job.GetFirstError(); | 557 *error = job.GetFirstError(); |
| 558 return false; | 558 return false; |
| 559 } | 559 } |
| 560 return true; | 560 return true; |
| 561 } | 561 } |
| 562 | 562 |
| 563 } // namespace proto | 563 } // namespace proto |
| 564 } // namespace tracing | 564 } // namespace tracing |
| OLD | NEW |