OLD | NEW |
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 39 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
50 scope_ = name_resolver_->GetImmutableClassName( | 50 scope_ = name_resolver_->GetImmutableClassName( |
51 descriptor_->extension_scope()); | 51 descriptor_->extension_scope()); |
52 } else { | 52 } else { |
53 scope_ = name_resolver_->GetImmutableClassName(descriptor_->file()); | 53 scope_ = name_resolver_->GetImmutableClassName(descriptor_->file()); |
54 } | 54 } |
55 } | 55 } |
56 | 56 |
57 ImmutableExtensionLiteGenerator::~ImmutableExtensionLiteGenerator() {} | 57 ImmutableExtensionLiteGenerator::~ImmutableExtensionLiteGenerator() {} |
58 | 58 |
59 void ImmutableExtensionLiteGenerator::Generate(io::Printer* printer) { | 59 void ImmutableExtensionLiteGenerator::Generate(io::Printer* printer) { |
60 std::map<string, string> vars; | 60 map<string, string> vars; |
61 const bool kUseImmutableNames = true; | 61 const bool kUseImmutableNames = true; |
62 InitTemplateVars(descriptor_, scope_, kUseImmutableNames, name_resolver_, | 62 InitTemplateVars(descriptor_, scope_, kUseImmutableNames, name_resolver_, |
63 &vars); | 63 &vars); |
64 printer->Print(vars, | 64 printer->Print(vars, |
65 "public static final int $constant_name$ = $number$;\n"); | 65 "public static final int $constant_name$ = $number$;\n"); |
66 | 66 |
67 WriteFieldDocComment(printer, descriptor_); | 67 WriteFieldDocComment(printer, descriptor_); |
68 if (descriptor_->is_repeated()) { | 68 if (descriptor_->is_repeated()) { |
69 printer->Print( | 69 printer->Print( |
70 vars, | 70 vars, |
(...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
109 "registry.add($scope$.$name$);\n", | 109 "registry.add($scope$.$name$);\n", |
110 "scope", scope_, | 110 "scope", scope_, |
111 "name", UnderscoresToCamelCase(descriptor_)); | 111 "name", UnderscoresToCamelCase(descriptor_)); |
112 return 7; | 112 return 7; |
113 } | 113 } |
114 | 114 |
115 } // namespace java | 115 } // namespace java |
116 } // namespace compiler | 116 } // namespace compiler |
117 } // namespace protobuf | 117 } // namespace protobuf |
118 } // namespace google | 118 } // namespace google |
OLD | NEW |