java_string_field_lite.cc
Go to the documentation of this file.
1 // Protocol Buffers - Google's data interchange format
2 // Copyright 2008 Google Inc. All rights reserved.
3 // https://developers.google.com/protocol-buffers/
4 //
5 // Redistribution and use in source and binary forms, with or without
6 // modification, are permitted provided that the following conditions are
7 // met:
8 //
9 // * Redistributions of source code must retain the above copyright
10 // notice, this list of conditions and the following disclaimer.
11 // * Redistributions in binary form must reproduce the above
12 // copyright notice, this list of conditions and the following disclaimer
13 // in the documentation and/or other materials provided with the
14 // distribution.
15 // * Neither the name of Google Inc. nor the names of its
16 // contributors may be used to endorse or promote products derived from
17 // this software without specific prior written permission.
18 //
19 // THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
20 // "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
21 // LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
22 // A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
23 // OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
24 // SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
25 // LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
26 // DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
27 // THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
28 // (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
29 // OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
30 
31 // Author: kenton@google.com (Kenton Varda)
32 // Author: jonp@google.com (Jon Perlow)
33 // Based on original Protocol Buffers design by
34 // Sanjay Ghemawat, Jeff Dean, and others.
35 
36 #include <map>
37 #include <string>
38 
49 
50 
51 namespace google {
52 namespace protobuf {
53 namespace compiler {
54 namespace java {
55 
56 using internal::WireFormat;
57 using internal::WireFormatLite;
58 
59 namespace {
60 
61 void SetPrimitiveVariables(const FieldDescriptor* descriptor,
62  int messageBitIndex, int builderBitIndex,
63  const FieldGeneratorInfo* info,
64  ClassNameResolver* name_resolver,
65  std::map<std::string, std::string>* variables) {
66  SetCommonFieldVariables(descriptor, info, variables);
67 
68  (*variables)["empty_list"] =
69  "com.google.protobuf.GeneratedMessageLite.emptyProtobufList()";
70 
71  (*variables)["default"] = ImmutableDefaultValue(descriptor, name_resolver);
72  (*variables)["default_init"] =
73  "= " + ImmutableDefaultValue(descriptor, name_resolver);
74  (*variables)["capitalized_type"] = "java.lang.String";
75  (*variables)["tag"] =
77  (*variables)["tag_size"] = StrCat(
79  (*variables)["null_check"] =
80  " if (value == null) {\n"
81  " throw new NullPointerException();\n"
82  " }\n";
83 
84  // TODO(birdo): Add @deprecated javadoc when generating javadoc is supported
85  // by the proto compiler
86  (*variables)["deprecation"] =
87  descriptor->options().deprecated() ? "@java.lang.Deprecated " : "";
88  (*variables)["required"] = descriptor->is_required() ? "true" : "false";
89 
90  if (SupportFieldPresence(descriptor->file())) {
91  // For singular messages and builders, one bit is used for the hasField bit.
92  (*variables)["get_has_field_bit_message"] = GenerateGetBit(messageBitIndex);
93 
94  // Note that these have a trailing ";".
95  (*variables)["set_has_field_bit_message"] =
96  GenerateSetBit(messageBitIndex) + ";";
97  (*variables)["clear_has_field_bit_message"] =
98  GenerateClearBit(messageBitIndex) + ";";
99 
100  (*variables)["is_field_present_message"] = GenerateGetBit(messageBitIndex);
101  } else {
102  (*variables)["set_has_field_bit_message"] = "";
103  (*variables)["clear_has_field_bit_message"] = "";
104 
105  (*variables)["is_field_present_message"] =
106  "!" + (*variables)["name"] + "_.isEmpty()";
107  }
108 
109  // For repeated builders, the underlying list tracks mutability state.
110  (*variables)["is_mutable"] = (*variables)["name"] + "_.isModifiable()";
111 
112  (*variables)["get_has_field_bit_from_local"] =
113  GenerateGetBitFromLocal(builderBitIndex);
114  (*variables)["set_has_field_bit_to_local"] =
115  GenerateSetBitToLocal(messageBitIndex);
116 }
117 
118 } // namespace
119 
120 // ===================================================================
121 
123  const FieldDescriptor* descriptor, int messageBitIndex, Context* context)
125  messageBitIndex_(messageBitIndex),
126  name_resolver_(context->GetNameResolver()) {
127  SetPrimitiveVariables(descriptor, messageBitIndex, 0,
130 }
131 
133 
135  return SupportFieldPresence(descriptor_->file()) ? 1 : 0;
136 }
137 
138 // A note about how strings are handled. In the SPEED and CODE_SIZE runtimes,
139 // strings are not stored as java.lang.String in the Message because of two
140 // issues:
141 //
142 // 1. It wouldn't roundtrip byte arrays that were not vaid UTF-8 encoded
143 // strings, but rather fields that were raw bytes incorrectly marked
144 // as strings in the proto file. This is common because in the proto1
145 // syntax, string was the way to indicate bytes and C++ engineers can
146 // easily make this mistake without affecting the C++ API. By converting to
147 // strings immediately, some java code might corrupt these byte arrays as
148 // it passes through a java server even if the field was never accessed by
149 // application code.
150 //
151 // 2. There's a performance hit to converting between bytes and strings and
152 // it many cases, the field is never even read by the application code. This
153 // avoids unnecessary conversions in the common use cases.
154 //
155 // In the LITE_RUNTIME, we store strings as java.lang.String because we assume
156 // that the users of this runtime are not subject to proto1 constraints and are
157 // running code on devices that are user facing. That is, the developers are
158 // properly incentivized to only fetch the data they need to read and wish to
159 // reduce the number of allocations incurred when running on a user's device.
160 
161 // TODO(dweis): Consider dropping all of the *Bytes() methods. They really
162 // shouldn't be necessary or used on devices.
164  io::Printer* printer) const {
167  printer->Print(variables_,
168  "$deprecation$boolean has$capitalized_name$();\n");
169  }
171  printer->Print(variables_,
172  "$deprecation$java.lang.String get$capitalized_name$();\n");
174  printer->Print(variables_,
175  "$deprecation$com.google.protobuf.ByteString\n"
176  " get$capitalized_name$Bytes();\n");
177 }
178 
180  io::Printer* printer) const {
181  printer->Print(variables_, "private java.lang.String $name$_;\n");
183 
186  printer->Print(
187  variables_,
188  "@java.lang.Override\n"
189  "$deprecation$public boolean ${$has$capitalized_name$$}$() {\n"
190  " return $get_has_field_bit_message$;\n"
191  "}\n");
192  printer->Annotate("{", "}", descriptor_);
193  }
194 
196  printer->Print(
197  variables_,
198  "@java.lang.Override\n"
199  "$deprecation$public java.lang.String ${$get$capitalized_name$$}$() {\n"
200  " return $name$_;\n"
201  "}\n");
202  printer->Annotate("{", "}", descriptor_);
204  printer->Print(
205  variables_,
206  "@java.lang.Override\n"
207  "$deprecation$public com.google.protobuf.ByteString\n"
208  " ${$get$capitalized_name$Bytes$}$() {\n"
209  " return com.google.protobuf.ByteString.copyFromUtf8($name$_);\n"
210  "}\n");
211  printer->Annotate("{", "}", descriptor_);
212 
214  printer->Print(variables_,
215  "private void set$capitalized_name$(\n"
216  " java.lang.String value) {\n"
217  "$null_check$"
218  " $set_has_field_bit_message$\n"
219  " $name$_ = value;\n"
220  "}\n");
222  printer->Print(variables_,
223  "private void clear$capitalized_name$() {\n"
224  " $clear_has_field_bit_message$\n"
225  // The default value is not a simple literal so we want to
226  // avoid executing it multiple times. Instead, get the default
227  // out of the default instance.
228  " $name$_ = getDefaultInstance().get$capitalized_name$();\n"
229  "}\n");
230 
232  printer->Print(variables_,
233  "private void set$capitalized_name$Bytes(\n"
234  " com.google.protobuf.ByteString value) {\n"
235  "$null_check$");
236  if (CheckUtf8(descriptor_)) {
237  printer->Print(variables_, " checkByteStringIsUtf8(value);\n");
238  }
239  printer->Print(variables_,
240  " $set_has_field_bit_message$\n"
241  " $name$_ = value.toStringUtf8();\n"
242  "}\n");
243 }
244 
246  io::Printer* printer) const {
249  printer->Print(
250  variables_,
251  "@java.lang.Override\n"
252  "$deprecation$public boolean ${$has$capitalized_name$$}$() {\n"
253  " return instance.has$capitalized_name$();\n"
254  "}\n");
255  printer->Annotate("{", "}", descriptor_);
256  }
257 
259  printer->Print(
260  variables_,
261  "@java.lang.Override\n"
262  "$deprecation$public java.lang.String ${$get$capitalized_name$$}$() {\n"
263  " return instance.get$capitalized_name$();\n"
264  "}\n");
265  printer->Annotate("{", "}", descriptor_);
266 
268  printer->Print(variables_,
269  "@java.lang.Override\n"
270  "$deprecation$public com.google.protobuf.ByteString\n"
271  " ${$get$capitalized_name$Bytes$}$() {\n"
272  " return instance.get$capitalized_name$Bytes();\n"
273  "}\n");
274  printer->Annotate("{", "}", descriptor_);
275 
277  printer->Print(variables_,
278  "$deprecation$public Builder ${$set$capitalized_name$$}$(\n"
279  " java.lang.String value) {\n"
280  " copyOnWrite();\n"
281  " instance.set$capitalized_name$(value);\n"
282  " return this;\n"
283  "}\n");
284  printer->Annotate("{", "}", descriptor_);
286  printer->Print(
287  variables_,
288  "$deprecation$public Builder ${$clear$capitalized_name$$}$() {\n"
289  " copyOnWrite();\n"
290  " instance.clear$capitalized_name$();\n"
291  " return this;\n"
292  "}\n");
293  printer->Annotate("{", "}", descriptor_);
294 
296  printer->Print(
297  variables_,
298  "$deprecation$public Builder ${$set$capitalized_name$Bytes$}$(\n"
299  " com.google.protobuf.ByteString value) {\n"
300  " copyOnWrite();\n"
301  " instance.set$capitalized_name$Bytes(value);\n"
302  " return this;\n"
303  "}\n");
304  printer->Annotate("{", "}", descriptor_);
305 }
306 
308  io::Printer* printer, std::vector<uint16>* output) const {
311  output);
314  }
315  printer->Print(variables_, "\"$name$_\",\n");
316 }
317 
319  io::Printer* printer) const {
320  printer->Print(variables_, "$name$_ = $default$;\n");
321 }
322 
324  return "java.lang.String";
325 }
326 
327 // ===================================================================
328 
330  const FieldDescriptor* descriptor, int messageBitIndex, Context* context)
331  : ImmutableStringFieldLiteGenerator(descriptor, messageBitIndex, context) {
332  const OneofGeneratorInfo* info =
333  context->GetOneofGeneratorInfo(descriptor->containing_oneof());
335 }
336 
339 
341  io::Printer* printer) const {
343 
346  printer->Print(
347  variables_,
348  "@java.lang.Override\n"
349  "$deprecation$public boolean ${$has$capitalized_name$$}$() {\n"
350  " return $has_oneof_case_message$;\n"
351  "}\n");
352  printer->Annotate("{", "}", descriptor_);
353  }
354 
356  printer->Print(
357  variables_,
358  "@java.lang.Override\n"
359  "$deprecation$public java.lang.String ${$get$capitalized_name$$}$() {\n"
360  " java.lang.String ref $default_init$;\n"
361  " if ($has_oneof_case_message$) {\n"
362  " ref = (java.lang.String) $oneof_name$_;\n"
363  " }\n"
364  " return ref;\n"
365  "}\n");
366  printer->Annotate("{", "}", descriptor_);
368 
369  printer->Print(variables_,
370  "@java.lang.Override\n"
371  "$deprecation$public com.google.protobuf.ByteString\n"
372  " ${$get$capitalized_name$Bytes$}$() {\n"
373  " java.lang.String ref $default_init$;\n"
374  " if ($has_oneof_case_message$) {\n"
375  " ref = (java.lang.String) $oneof_name$_;\n"
376  " }\n"
377  " return com.google.protobuf.ByteString.copyFromUtf8(ref);\n"
378  "}\n");
379  printer->Annotate("{", "}", descriptor_);
380 
382  printer->Print(variables_,
383  "private void ${$set$capitalized_name$$}$(\n"
384  " java.lang.String value) {\n"
385  "$null_check$"
386  " $set_oneof_case_message$;\n"
387  " $oneof_name$_ = value;\n"
388  "}\n");
389  printer->Annotate("{", "}", descriptor_);
391  printer->Print(variables_,
392  "private void ${$clear$capitalized_name$$}$() {\n"
393  " if ($has_oneof_case_message$) {\n"
394  " $clear_oneof_case_message$;\n"
395  " $oneof_name$_ = null;\n"
396  " }\n"
397  "}\n");
398  printer->Annotate("{", "}", descriptor_);
399 
401  printer->Print(variables_,
402  "private void ${$set$capitalized_name$Bytes$}$(\n"
403  " com.google.protobuf.ByteString value) {\n"
404  "$null_check$");
405  printer->Annotate("{", "}", descriptor_);
406  if (CheckUtf8(descriptor_)) {
407  printer->Print(variables_, " checkByteStringIsUtf8(value);\n");
408  }
409  printer->Print(variables_,
410  " $set_oneof_case_message$;\n"
411  " $oneof_name$_ = value.toStringUtf8();\n"
412  "}\n");
413 }
414 
416  io::Printer* printer, std::vector<uint16>* output) const {
419  output);
421 }
422 
424  io::Printer* printer) const {
427  printer->Print(
428  variables_,
429  "@java.lang.Override\n"
430  "$deprecation$public boolean ${$has$capitalized_name$$}$() {\n"
431  " return instance.has$capitalized_name$();\n"
432  "}\n");
433  printer->Annotate("{", "}", descriptor_);
434  }
435 
437  printer->Print(
438  variables_,
439  "@java.lang.Override\n"
440  "$deprecation$public java.lang.String ${$get$capitalized_name$$}$() {\n"
441  " return instance.get$capitalized_name$();\n"
442  "}\n");
443  printer->Annotate("{", "}", descriptor_);
444 
446  printer->Print(variables_,
447  "@java.lang.Override\n"
448  "$deprecation$public com.google.protobuf.ByteString\n"
449  " ${$get$capitalized_name$Bytes$}$() {\n"
450  " return instance.get$capitalized_name$Bytes();\n"
451  "}\n");
452  printer->Annotate("{", "}", descriptor_);
453 
455  printer->Print(variables_,
456  "$deprecation$public Builder ${$set$capitalized_name$$}$(\n"
457  " java.lang.String value) {\n"
458  " copyOnWrite();\n"
459  " instance.set$capitalized_name$(value);\n"
460  " return this;\n"
461  "}\n");
462  printer->Annotate("{", "}", descriptor_);
464  printer->Print(
465  variables_,
466  "$deprecation$public Builder ${$clear$capitalized_name$$}$() {\n"
467  " copyOnWrite();\n"
468  " instance.clear$capitalized_name$();\n"
469  " return this;\n"
470  "}\n");
471  printer->Annotate("{", "}", descriptor_);
472 
474  printer->Print(
475  variables_,
476  "$deprecation$public Builder ${$set$capitalized_name$Bytes$}$(\n"
477  " com.google.protobuf.ByteString value) {\n"
478  " copyOnWrite();\n"
479  " instance.set$capitalized_name$Bytes(value);\n"
480  " return this;\n"
481  "}\n");
482  printer->Annotate("{", "}", descriptor_);
483 }
484 
485 // ===================================================================
486 
489  int messageBitIndex,
490  Context* context)
491  : descriptor_(descriptor), name_resolver_(context->GetNameResolver()) {
492  SetPrimitiveVariables(descriptor, messageBitIndex, 0,
495 }
496 
499 
501  return 0;
502 }
503 
505  io::Printer* printer) const {
507  printer->Print(variables_,
508  "$deprecation$java.util.List<java.lang.String>\n"
509  " get$capitalized_name$List();\n");
511  printer->Print(variables_,
512  "$deprecation$int get$capitalized_name$Count();\n");
514  printer->Print(
515  variables_,
516  "$deprecation$java.lang.String get$capitalized_name$(int index);\n");
518  printer->Print(variables_,
519  "$deprecation$com.google.protobuf.ByteString\n"
520  " get$capitalized_name$Bytes(int index);\n");
521 }
522 
524  io::Printer* printer) const {
525  printer->Print(
526  variables_,
527  "private com.google.protobuf.Internal.ProtobufList<java.lang.String> "
528  "$name$_;\n");
531  printer->Print(variables_,
532  "@java.lang.Override\n"
533  "$deprecation$public java.util.List<java.lang.String> "
534  "${$get$capitalized_name$List$}$() {\n"
535  " return $name$_;\n" // note: unmodifiable list
536  "}\n");
537  printer->Annotate("{", "}", descriptor_);
539  printer->Print(
540  variables_,
541  "@java.lang.Override\n"
542  "$deprecation$public int ${$get$capitalized_name$Count$}$() {\n"
543  " return $name$_.size();\n"
544  "}\n");
545  printer->Annotate("{", "}", descriptor_);
547  printer->Print(variables_,
548  "@java.lang.Override\n"
549  "$deprecation$public java.lang.String "
550  "${$get$capitalized_name$$}$(int index) {\n"
551  " return $name$_.get(index);\n"
552  "}\n");
553  printer->Annotate("{", "}", descriptor_);
555  printer->Print(variables_,
556  "@java.lang.Override\n"
557  "$deprecation$public com.google.protobuf.ByteString\n"
558  " ${$get$capitalized_name$Bytes$}$(int index) {\n"
559  " return com.google.protobuf.ByteString.copyFromUtf8(\n"
560  " $name$_.get(index));\n"
561  "}\n");
562  printer->Annotate("{", "}", descriptor_);
563 
564  printer->Print(
565  variables_,
566  "private void ensure$capitalized_name$IsMutable() {\n"
567  " if (!$is_mutable$) {\n"
568  " $name$_ =\n"
569  " com.google.protobuf.GeneratedMessageLite.mutableCopy($name$_);\n"
570  " }\n"
571  "}\n");
572 
574  printer->Print(variables_,
575  "private void set$capitalized_name$(\n"
576  " int index, java.lang.String value) {\n"
577  "$null_check$"
578  " ensure$capitalized_name$IsMutable();\n"
579  " $name$_.set(index, value);\n"
580  "}\n");
582  printer->Print(variables_,
583  "private void add$capitalized_name$(\n"
584  " java.lang.String value) {\n"
585  "$null_check$"
586  " ensure$capitalized_name$IsMutable();\n"
587  " $name$_.add(value);\n"
588  "}\n");
590  printer->Print(variables_,
591  "private void addAll$capitalized_name$(\n"
592  " java.lang.Iterable<java.lang.String> values) {\n"
593  " ensure$capitalized_name$IsMutable();\n"
594  " com.google.protobuf.AbstractMessageLite.addAll(\n"
595  " values, $name$_);\n"
596  "}\n");
598  printer->Print(variables_,
599  "private void clear$capitalized_name$() {\n"
600  " $name$_ = $empty_list$;\n"
601  "}\n");
602 
604  printer->Print(variables_,
605  "private void add$capitalized_name$Bytes(\n"
606  " com.google.protobuf.ByteString value) {\n"
607  "$null_check$");
608  if (CheckUtf8(descriptor_)) {
609  printer->Print(variables_, " checkByteStringIsUtf8(value);\n");
610  }
611  printer->Print(variables_,
612  " ensure$capitalized_name$IsMutable();\n"
613  " $name$_.add(value.toStringUtf8());\n"
614  "}\n");
615 }
616 
618  io::Printer* printer) const {
620  printer->Print(variables_,
621  "@java.lang.Override\n"
622  "$deprecation$public java.util.List<java.lang.String>\n"
623  " ${$get$capitalized_name$List$}$() {\n"
624  " return java.util.Collections.unmodifiableList(\n"
625  " instance.get$capitalized_name$List());\n"
626  "}\n");
627  printer->Annotate("{", "}", descriptor_);
629  printer->Print(
630  variables_,
631  "@java.lang.Override\n"
632  "$deprecation$public int ${$get$capitalized_name$Count$}$() {\n"
633  " return instance.get$capitalized_name$Count();\n"
634  "}\n");
635  printer->Annotate("{", "}", descriptor_);
637  printer->Print(variables_,
638  "@java.lang.Override\n"
639  "$deprecation$public java.lang.String "
640  "${$get$capitalized_name$$}$(int index) {\n"
641  " return instance.get$capitalized_name$(index);\n"
642  "}\n");
643  printer->Annotate("{", "}", descriptor_);
645  printer->Print(variables_,
646  "@java.lang.Override\n"
647  "$deprecation$public com.google.protobuf.ByteString\n"
648  " ${$get$capitalized_name$Bytes$}$(int index) {\n"
649  " return instance.get$capitalized_name$Bytes(index);\n"
650  "}\n");
651  printer->Annotate("{", "}", descriptor_);
653  printer->Print(variables_,
654  "$deprecation$public Builder ${$set$capitalized_name$$}$(\n"
655  " int index, java.lang.String value) {\n"
656  " copyOnWrite();\n"
657  " instance.set$capitalized_name$(index, value);\n"
658  " return this;\n"
659  "}\n");
660  printer->Annotate("{", "}", descriptor_);
662  printer->Print(variables_,
663  "$deprecation$public Builder ${$add$capitalized_name$$}$(\n"
664  " java.lang.String value) {\n"
665  " copyOnWrite();\n"
666  " instance.add$capitalized_name$(value);\n"
667  " return this;\n"
668  "}\n");
669  printer->Annotate("{", "}", descriptor_);
671  printer->Print(variables_,
672  "$deprecation$public Builder ${$addAll$capitalized_name$$}$(\n"
673  " java.lang.Iterable<java.lang.String> values) {\n"
674  " copyOnWrite();\n"
675  " instance.addAll$capitalized_name$(values);\n"
676  " return this;\n"
677  "}\n");
678  printer->Annotate("{", "}", descriptor_);
680  printer->Print(
681  variables_,
682  "$deprecation$public Builder ${$clear$capitalized_name$$}$() {\n"
683  " copyOnWrite();\n"
684  " instance.clear$capitalized_name$();\n"
685  " return this;\n"
686  "}\n");
687  printer->Annotate("{", "}", descriptor_);
688 
690  printer->Print(
691  variables_,
692  "$deprecation$public Builder ${$add$capitalized_name$Bytes$}$(\n"
693  " com.google.protobuf.ByteString value) {\n"
694  " copyOnWrite();\n"
695  " instance.add$capitalized_name$Bytes(value);\n"
696  " return this;\n"
697  "}\n");
698  printer->Annotate("{", "}", descriptor_);
699 }
700 
702  io::Printer* printer, std::vector<uint16>* output) const {
705  output);
706  printer->Print(variables_, "\"$name$_\",\n");
707 }
708 
710  io::Printer* printer) const {
711  printer->Print(variables_, "$name$_ = $empty_list$;\n");
712 }
713 
715  return "java.lang.String";
716 }
717 
718 } // namespace java
719 } // namespace compiler
720 } // namespace protobuf
721 } // namespace google
google::protobuf::compiler::java::ImmutableStringFieldLiteGenerator::GenerateFieldInfo
void GenerateFieldInfo(io::Printer *printer, std::vector< uint16 > *output) const
Definition: java_string_field_lite.cc:307
google::protobuf::io::Printer::Print
void Print(const std::map< std::string, std::string > &variables, const char *text)
Definition: printer.cc:112
google::protobuf::compiler::java::GenerateClearBit
std::string GenerateClearBit(int bitIndex)
Definition: java_helpers.cc:672
google::protobuf::compiler::java::RepeatedImmutableStringFieldLiteGenerator::GenerateInitializationCode
void GenerateInitializationCode(io::Printer *printer) const
Definition: java_string_field_lite.cc:709
java_name_resolver.h
google::protobuf::FieldDescriptor
Definition: src/google/protobuf/descriptor.h:515
java_doc_comment.h
google::protobuf.internal::WireFormat::TagSize
static size_t TagSize(int field_number, FieldDescriptor::Type type)
Definition: wire_format.h:293
java_helpers.h
google::protobuf::StrCat
string StrCat(const AlphaNum &a, const AlphaNum &b)
Definition: strutil.cc:1480
google::protobuf::compiler::java::ImmutableStringFieldLiteGenerator::~ImmutableStringFieldLiteGenerator
~ImmutableStringFieldLiteGenerator()
Definition: java_string_field_lite.cc:132
google::protobuf::compiler::java::GenerateSetBit
std::string GenerateSetBit(int bitIndex)
Definition: java_helpers.cc:668
google::protobuf::compiler::java::Context
Definition: java_context.h:65
google::protobuf.internal::WireFormat::MakeTag
static uint32 MakeTag(const FieldDescriptor *field)
Definition: wire_format.h:289
google::protobuf::compiler::java::WriteFieldDocComment
void WriteFieldDocComment(io::Printer *printer, const FieldDescriptor *field)
Definition: java_doc_comment.cc:175
java_string_field_lite.h
google::protobuf::compiler::java::ImmutableDefaultValue
std::string ImmutableDefaultValue(const FieldDescriptor *field, ClassNameResolver *name_resolver)
Definition: java_helpers.h:234
string
GLsizei const GLchar *const * string
Definition: glcorearb.h:3083
google::protobuf::compiler::java::SetCommonOneofVariables
void SetCommonOneofVariables(const FieldDescriptor *descriptor, const OneofGeneratorInfo *info, std::map< std::string, std::string > *variables)
Definition: java_field.cc:263
descriptor
Descriptor * descriptor
Definition: php/ext/google/protobuf/protobuf.h:936
google::protobuf::compiler::java::RepeatedImmutableStringFieldLiteGenerator::name_resolver_
ClassNameResolver * name_resolver_
Definition: java_string_field_lite.h:125
google::protobuf::compiler::java::GetExperimentalJavaFieldType
int GetExperimentalJavaFieldType(const FieldDescriptor *field)
Definition: java_helpers.cc:961
google::protobuf::compiler::java::CheckUtf8
bool CheckUtf8(const FieldDescriptor *descriptor)
Definition: java_helpers.h:391
FieldDescriptor
Definition: ruby/ext/google/protobuf_c/protobuf.h:129
google::protobuf::int32
int32_t int32
Definition: protobuf/src/google/protobuf/stubs/port.h:150
google::protobuf::compiler::java::RepeatedImmutableStringFieldLiteGenerator::GenerateFieldInfo
void GenerateFieldInfo(io::Printer *printer, std::vector< uint16 > *output) const
Definition: java_string_field_lite.cc:701
google::protobuf::compiler::java::ImmutableStringFieldLiteGenerator::GetBoxedType
std::string GetBoxedType() const
Definition: java_string_field_lite.cc:323
google::protobuf::compiler::java::ImmutableStringOneofFieldLiteGenerator::ImmutableStringOneofFieldLiteGenerator
ImmutableStringOneofFieldLiteGenerator(const FieldDescriptor *descriptor, int messageBitIndex, Context *context)
Definition: java_string_field_lite.cc:329
strutil.h
google::protobuf::compiler::java::RepeatedImmutableStringFieldLiteGenerator::GetNumBitsForMessage
int GetNumBitsForMessage() const
Definition: java_string_field_lite.cc:500
google::protobuf::compiler::java::OneofGeneratorInfo
Definition: java_field.h:164
google::protobuf::FieldDescriptor::file
const FileDescriptor * file() const
google::protobuf::compiler::java::ImmutableStringOneofFieldLiteGenerator::GenerateMembers
void GenerateMembers(io::Printer *printer) const
Definition: java_string_field_lite.cc:340
google::protobuf::compiler::java::ImmutableStringFieldLiteGenerator::name_resolver_
ClassNameResolver * name_resolver_
Definition: java_string_field_lite.h:82
google::protobuf::compiler::java::Context::GetFieldGeneratorInfo
const FieldGeneratorInfo * GetFieldGeneratorInfo(const FieldDescriptor *field) const
Definition: java_context.cc:170
google::protobuf::compiler::java::ImmutableStringFieldLiteGenerator::GenerateBuilderMembers
void GenerateBuilderMembers(io::Printer *printer) const
Definition: java_string_field_lite.cc:245
google::protobuf::compiler::java::RepeatedImmutableStringFieldLiteGenerator::RepeatedImmutableStringFieldLiteGenerator
RepeatedImmutableStringFieldLiteGenerator(const FieldDescriptor *descriptor, int messageBitIndex, Context *context)
Definition: java_string_field_lite.cc:488
google::protobuf::compiler::java::ImmutableStringOneofFieldLiteGenerator::GenerateBuilderMembers
void GenerateBuilderMembers(io::Printer *printer) const
Definition: java_string_field_lite.cc:423
printer.h
google::protobuf::compiler::java::PrintExtraFieldInfo
void PrintExtraFieldInfo(const std::map< std::string, std::string > &variables, io::Printer *printer)
Definition: java_field.cc:278
google::protobuf::compiler::java::GenerateSetBitToLocal
std::string GenerateSetBitToLocal(int bitIndex)
Definition: java_helpers.cc:685
google::protobuf::FieldDescriptor::number
int number() const
google::protobuf::compiler::java::RepeatedImmutableStringFieldLiteGenerator::GetBoxedType
std::string GetBoxedType() const
Definition: java_string_field_lite.cc:714
google::protobuf::compiler::java::RepeatedImmutableStringFieldLiteGenerator::GenerateMembers
void GenerateMembers(io::Printer *printer) const
Definition: java_string_field_lite.cc:523
google::protobuf::io::Printer::Annotate
void Annotate(const char *varname, const SomeDescriptor *descriptor)
Definition: printer.h:199
google::protobuf::io::Printer
Definition: printer.h:181
google::protobuf::compiler::java::GetType
FieldDescriptor::Type GetType(const FieldDescriptor *field)
Definition: java_helpers.cc:317
google::protobuf::compiler::java::ImmutableStringFieldLiteGenerator::GenerateInterfaceMembers
void GenerateInterfaceMembers(io::Printer *printer) const
Definition: java_string_field_lite.cc:163
google::protobuf::compiler::java::SupportFieldPresence
bool SupportFieldPresence(const FileDescriptor *descriptor)
Definition: java_helpers.h:355
google::protobuf::compiler::java::ImmutableStringFieldLiteGenerator
Definition: java_string_field_lite.h:59
java
google::protobuf::compiler::java::ImmutableStringFieldLiteGenerator::messageBitIndex_
const int messageBitIndex_
Definition: java_string_field_lite.h:81
google::protobuf::compiler::java::ImmutableStringFieldLiteGenerator::GetNumBitsForMessage
int GetNumBitsForMessage() const
Definition: java_string_field_lite.cc:134
google::protobuf::compiler::java::RepeatedImmutableStringFieldLiteGenerator::descriptor_
const FieldDescriptor * descriptor_
Definition: java_string_field_lite.h:123
common.h
google::protobuf::compiler::java::ImmutableStringFieldLiteGenerator::variables_
std::map< std::string, std::string > variables_
Definition: java_string_field_lite.h:80
google::protobuf::compiler::java::RepeatedImmutableStringFieldLiteGenerator::variables_
std::map< std::string, std::string > variables_
Definition: java_string_field_lite.h:124
google::protobuf::compiler::java::ImmutableStringOneofFieldLiteGenerator::GenerateFieldInfo
void GenerateFieldInfo(io::Printer *printer, std::vector< uint16 > *output) const
Definition: java_string_field_lite.cc:415
google::protobuf::OneofDescriptor::index
int index() const
Definition: src/google/protobuf/descriptor.h:2103
google::protobuf::compiler::java::ImmutableStringFieldLiteGenerator::GenerateInitializationCode
void GenerateInitializationCode(io::Printer *printer) const
Definition: java_string_field_lite.cc:318
wire_format.h
logging.h
google::protobuf::compiler::java::RepeatedImmutableStringFieldLiteGenerator::GenerateInterfaceMembers
void GenerateInterfaceMembers(io::Printer *printer) const
Definition: java_string_field_lite.cc:504
google::protobuf::compiler::java::RepeatedImmutableStringFieldLiteGenerator::~RepeatedImmutableStringFieldLiteGenerator
~RepeatedImmutableStringFieldLiteGenerator()
Definition: java_string_field_lite.cc:498
google::protobuf::compiler::java::SetCommonFieldVariables
void SetCommonFieldVariables(const FieldDescriptor *descriptor, const FieldGeneratorInfo *info, std::map< std::string, std::string > *variables)
Definition: java_field.cc:245
java_context.h
google::protobuf::FieldDescriptor::containing_oneof
const OneofDescriptor * containing_oneof() const
google::protobuf::compiler::java::GenerateGetBit
std::string GenerateGetBit(int bitIndex)
Definition: java_helpers.cc:664
google::protobuf::compiler::java::ImmutableStringOneofFieldLiteGenerator::~ImmutableStringOneofFieldLiteGenerator
~ImmutableStringOneofFieldLiteGenerator()
Definition: java_string_field_lite.cc:338
descriptor_
const Descriptor * descriptor_
Definition: field_comparator_test.cc:56
google::protobuf::compiler::java::Context::GetOneofGeneratorInfo
const OneofGeneratorInfo * GetOneofGeneratorInfo(const OneofDescriptor *oneof) const
Definition: java_context.cc:181
google::protobuf::compiler::java::RepeatedImmutableStringFieldLiteGenerator::GenerateBuilderMembers
void GenerateBuilderMembers(io::Printer *printer) const
Definition: java_string_field_lite.cc:617
output
const upb_json_parsermethod const upb_symtab upb_sink * output
Definition: ruby/ext/google/protobuf_c/upb.h:10503
google::protobuf::compiler::java::ImmutableStringFieldLiteGenerator::descriptor_
const FieldDescriptor * descriptor_
Definition: java_string_field_lite.h:79
google::protobuf::compiler::java::ImmutableStringFieldLiteGenerator::GenerateMembers
void GenerateMembers(io::Printer *printer) const
Definition: java_string_field_lite.cc:179
google::protobuf::compiler::java::WriteIntToUtf16CharSequence
void WriteIntToUtf16CharSequence(int value, std::vector< uint16 > *output)
Definition: java_helpers.h:402
compiler
Definition: plugin.pb.cc:22
google
Definition: data_proto2_to_proto3_util.h:11
google::protobuf::compiler::java::ImmutableStringFieldLiteGenerator::ImmutableStringFieldLiteGenerator
ImmutableStringFieldLiteGenerator(const FieldDescriptor *descriptor, int messageBitIndex, Context *context)
Definition: java_string_field_lite.cc:122
google::protobuf::compiler::java::GenerateGetBitFromLocal
std::string GenerateGetBitFromLocal(int bitIndex)
Definition: java_helpers.cc:681


libaditof
Author(s):
autogenerated on Wed May 21 2025 02:06:55