Down Integrate to GitHub (#6414)
* Down integrate to GitHub
* Fix broken tests
diff --git a/Makefile.am b/Makefile.am
index c03b45c..9d1b607 100644
--- a/Makefile.am
+++ b/Makefile.am
@@ -339,6 +339,7 @@
java/core/src/main/java/com/google/protobuf/TextFormatEscaper.java \
java/core/src/main/java/com/google/protobuf/TextFormatParseInfoTree.java \
java/core/src/main/java/com/google/protobuf/TextFormatParseLocation.java \
+ java/core/src/main/java/com/google/protobuf/TypeRegistry.java \
java/core/src/main/java/com/google/protobuf/UninitializedMessageException.java \
java/core/src/main/java/com/google/protobuf/UnknownFieldSchema.java \
java/core/src/main/java/com/google/protobuf/UnknownFieldSet.java \
@@ -435,6 +436,7 @@
java/core/src/test/java/com/google/protobuf/TextFormatParseInfoTreeTest.java \
java/core/src/test/java/com/google/protobuf/TextFormatParseLocationTest.java \
java/core/src/test/java/com/google/protobuf/TextFormatTest.java \
+ java/core/src/test/java/com/google/protobuf/TypeRegistryTest.java \
java/core/src/test/java/com/google/protobuf/UnknownEnumValueTest.java \
java/core/src/test/java/com/google/protobuf/UnknownFieldSetTest.java \
java/core/src/test/java/com/google/protobuf/UnmodifiableLazyStringListTest.java \
diff --git a/csharp/src/Google.Protobuf.Test/testprotos.pb b/csharp/src/Google.Protobuf.Test/testprotos.pb
index 71256ae..e7a2fc6 100644
--- a/csharp/src/Google.Protobuf.Test/testprotos.pb
+++ b/csharp/src/Google.Protobuf.Test/testprotos.pb
Binary files differ
diff --git a/csharp/src/Google.Protobuf/WellKnownTypes/Duration.cs b/csharp/src/Google.Protobuf/WellKnownTypes/Duration.cs
index 7a6f501..f0078c4 100644
--- a/csharp/src/Google.Protobuf/WellKnownTypes/Duration.cs
+++ b/csharp/src/Google.Protobuf/WellKnownTypes/Duration.cs
@@ -62,7 +62,7 @@
/// if (duration.seconds < 0 && duration.nanos > 0) {
/// duration.seconds += 1;
/// duration.nanos -= 1000000000;
- /// } else if (durations.seconds > 0 && duration.nanos < 0) {
+ /// } else if (duration.seconds > 0 && duration.nanos < 0) {
/// duration.seconds -= 1;
/// duration.nanos += 1000000000;
/// }
diff --git a/java/core/src/main/java/com/google/protobuf/FieldSet.java b/java/core/src/main/java/com/google/protobuf/FieldSet.java
index ddfd0e5..2042dc9 100644
--- a/java/core/src/main/java/com/google/protobuf/FieldSet.java
+++ b/java/core/src/main/java/com/google/protobuf/FieldSet.java
@@ -48,8 +48,7 @@
*
* @author kenton@google.com Kenton Varda
*/
-final class FieldSet<
- FieldDescriptorType extends FieldSet.FieldDescriptorLite<FieldDescriptorType>> {
+final class FieldSet<T extends FieldSet.FieldDescriptorLite<T>> {
/**
* Interface for a FieldDescriptor or lite extension descriptor. This prevents FieldSet from
* depending on {@link Descriptors.FieldDescriptor}.
@@ -72,18 +71,26 @@
MessageLite.Builder internalMergeFrom(MessageLite.Builder to, MessageLite from);
}
- private final SmallSortedMap<FieldDescriptorType, Object> fields;
+ private static final int DEFAULT_FIELD_MAP_ARRAY_SIZE = 16;
+
+ private final SmallSortedMap<T, Object> fields;
private boolean isImmutable;
- private boolean hasLazyField = false;
+ private boolean hasLazyField;
/** Construct a new FieldSet. */
private FieldSet() {
- this.fields = SmallSortedMap.newFieldMap(16);
+ this.fields = SmallSortedMap.newFieldMap(DEFAULT_FIELD_MAP_ARRAY_SIZE);
}
/** Construct an empty FieldSet. This is only used to initialize DEFAULT_INSTANCE. */
+ @SuppressWarnings("unused")
private FieldSet(final boolean dummy) {
- this.fields = SmallSortedMap.newFieldMap(0);
+ this(SmallSortedMap.<T>newFieldMap(0));
+ makeImmutable();
+ }
+
+ private FieldSet(SmallSortedMap<T, Object> fields) {
+ this.fields = fields;
makeImmutable();
}
@@ -98,6 +105,11 @@
return DEFAULT_INSTANCE;
}
+ /** Construct a new Builder. */
+ public static <T extends FieldDescriptorLite<T>> Builder<T> newBuilder() {
+ return new Builder<T>();
+ }
+
@SuppressWarnings("rawtypes")
private static final FieldSet DEFAULT_INSTANCE = new FieldSet(true);
@@ -152,18 +164,16 @@
* @return the newly cloned FieldSet
*/
@Override
- public FieldSet<FieldDescriptorType> clone() {
+ public FieldSet<T> clone() {
// We can't just call fields.clone because List objects in the map
// should not be shared.
- FieldSet<FieldDescriptorType> clone = FieldSet.newFieldSet();
+ FieldSet<T> clone = FieldSet.newFieldSet();
for (int i = 0; i < fields.getNumArrayEntries(); i++) {
- Map.Entry<FieldDescriptorType, Object> entry = fields.getArrayEntryAt(i);
- FieldDescriptorType descriptor = entry.getKey();
- clone.setField(descriptor, entry.getValue());
+ Map.Entry<T, Object> entry = fields.getArrayEntryAt(i);
+ clone.setField(entry.getKey(), entry.getValue());
}
- for (Map.Entry<FieldDescriptorType, Object> entry : fields.getOverflowEntries()) {
- FieldDescriptorType descriptor = entry.getKey();
- clone.setField(descriptor, entry.getValue());
+ for (Map.Entry<T, Object> entry : fields.getOverflowEntries()) {
+ clone.setField(entry.getKey(), entry.getValue());
}
clone.hasLazyField = hasLazyField;
return clone;
@@ -179,15 +189,9 @@
}
/** Get a simple map containing all the fields. */
- public Map<FieldDescriptorType, Object> getAllFields() {
+ public Map<T, Object> getAllFields() {
if (hasLazyField) {
- SmallSortedMap<FieldDescriptorType, Object> result = SmallSortedMap.newFieldMap(16);
- for (int i = 0; i < fields.getNumArrayEntries(); i++) {
- cloneFieldEntry(result, fields.getArrayEntryAt(i));
- }
- for (Map.Entry<FieldDescriptorType, Object> entry : fields.getOverflowEntries()) {
- cloneFieldEntry(result, entry);
- }
+ SmallSortedMap<T, Object> result = cloneAllFieldsMap(fields, /* copyList */ false);
if (fields.isImmutable()) {
result.makeImmutable();
}
@@ -196,12 +200,26 @@
return fields.isImmutable() ? fields : Collections.unmodifiableMap(fields);
}
- private void cloneFieldEntry(
- Map<FieldDescriptorType, Object> map, Map.Entry<FieldDescriptorType, Object> entry) {
- FieldDescriptorType key = entry.getKey();
+ private static <T extends FieldDescriptorLite<T>> SmallSortedMap<T, Object> cloneAllFieldsMap(
+ SmallSortedMap<T, Object> fields, boolean copyList) {
+ SmallSortedMap<T, Object> result = SmallSortedMap.newFieldMap(DEFAULT_FIELD_MAP_ARRAY_SIZE);
+ for (int i = 0; i < fields.getNumArrayEntries(); i++) {
+ cloneFieldEntry(result, fields.getArrayEntryAt(i), copyList);
+ }
+ for (Map.Entry<T, Object> entry : fields.getOverflowEntries()) {
+ cloneFieldEntry(result, entry, copyList);
+ }
+ return result;
+ }
+
+ private static <T extends FieldDescriptorLite<T>> void cloneFieldEntry(
+ Map<T, Object> map, Map.Entry<T, Object> entry, boolean copyList) {
+ T key = entry.getKey();
Object value = entry.getValue();
if (value instanceof LazyField) {
map.put(key, ((LazyField) value).getValue());
+ } else if (copyList && value instanceof List) {
+ map.put(key, new ArrayList<>((List<?>) value));
} else {
map.put(key, value);
}
@@ -211,9 +229,9 @@
* Get an iterator to the field map. This iterator should not be leaked out of the protobuf
* library as it is not protected from mutation when fields is not immutable.
*/
- public Iterator<Map.Entry<FieldDescriptorType, Object>> iterator() {
+ public Iterator<Map.Entry<T, Object>> iterator() {
if (hasLazyField) {
- return new LazyIterator<FieldDescriptorType>(fields.entrySet().iterator());
+ return new LazyIterator<T>(fields.entrySet().iterator());
}
return fields.entrySet().iterator();
}
@@ -223,15 +241,15 @@
* should not be leaked out of the protobuf library as it is not protected from mutation when
* fields is not immutable.
*/
- Iterator<Map.Entry<FieldDescriptorType, Object>> descendingIterator() {
+ Iterator<Map.Entry<T, Object>> descendingIterator() {
if (hasLazyField) {
- return new LazyIterator<FieldDescriptorType>(fields.descendingEntrySet().iterator());
+ return new LazyIterator<T>(fields.descendingEntrySet().iterator());
}
return fields.descendingEntrySet().iterator();
}
/** Useful for implementing {@link Message#hasField(Descriptors.FieldDescriptor)}. */
- public boolean hasField(final FieldDescriptorType descriptor) {
+ public boolean hasField(final T descriptor) {
if (descriptor.isRepeated()) {
throw new IllegalArgumentException("hasField() can only be called on non-repeated fields.");
}
@@ -244,7 +262,7 @@
* returns {@code null} if the field is not set; in this case it is up to the caller to fetch the
* field's default value.
*/
- public Object getField(final FieldDescriptorType descriptor) {
+ public Object getField(final T descriptor) {
Object o = fields.get(descriptor);
if (o instanceof LazyField) {
return ((LazyField) o).getValue();
@@ -256,7 +274,7 @@
* Useful for implementing {@link Message.Builder#setField(Descriptors.FieldDescriptor,Object)}.
*/
@SuppressWarnings({"unchecked", "rawtypes"})
- public void setField(final FieldDescriptorType descriptor, Object value) {
+ public void setField(final T descriptor, Object value) {
if (descriptor.isRepeated()) {
if (!(value instanceof List)) {
throw new IllegalArgumentException(
@@ -282,7 +300,7 @@
}
/** Useful for implementing {@link Message.Builder#clearField(Descriptors.FieldDescriptor)}. */
- public void clearField(final FieldDescriptorType descriptor) {
+ public void clearField(final T descriptor) {
fields.remove(descriptor);
if (fields.isEmpty()) {
hasLazyField = false;
@@ -290,7 +308,7 @@
}
/** Useful for implementing {@link Message#getRepeatedFieldCount(Descriptors.FieldDescriptor)}. */
- public int getRepeatedFieldCount(final FieldDescriptorType descriptor) {
+ public int getRepeatedFieldCount(final T descriptor) {
if (!descriptor.isRepeated()) {
throw new IllegalArgumentException(
"getRepeatedField() can only be called on repeated fields.");
@@ -305,7 +323,7 @@
}
/** Useful for implementing {@link Message#getRepeatedField(Descriptors.FieldDescriptor,int)}. */
- public Object getRepeatedField(final FieldDescriptorType descriptor, final int index) {
+ public Object getRepeatedField(final T descriptor, final int index) {
if (!descriptor.isRepeated()) {
throw new IllegalArgumentException(
"getRepeatedField() can only be called on repeated fields.");
@@ -325,8 +343,7 @@
* Message.Builder#setRepeatedField(Descriptors.FieldDescriptor,int,Object)}.
*/
@SuppressWarnings("unchecked")
- public void setRepeatedField(
- final FieldDescriptorType descriptor, final int index, final Object value) {
+ public void setRepeatedField(final T descriptor, final int index, final Object value) {
if (!descriptor.isRepeated()) {
throw new IllegalArgumentException(
"getRepeatedField() can only be called on repeated fields.");
@@ -346,7 +363,7 @@
* Message.Builder#addRepeatedField(Descriptors.FieldDescriptor,Object)}.
*/
@SuppressWarnings("unchecked")
- public void addRepeatedField(final FieldDescriptorType descriptor, final Object value) {
+ public void addRepeatedField(final T descriptor, final Object value) {
if (!descriptor.isRepeated()) {
throw new IllegalArgumentException(
"addRepeatedField() can only be called on repeated fields.");
@@ -373,43 +390,8 @@
*
* @throws IllegalArgumentException The value is not of the right type.
*/
- private static void verifyType(final WireFormat.FieldType type, final Object value) {
- checkNotNull(value);
-
- boolean isValid = false;
- switch (type.getJavaType()) {
- case INT:
- isValid = value instanceof Integer;
- break;
- case LONG:
- isValid = value instanceof Long;
- break;
- case FLOAT:
- isValid = value instanceof Float;
- break;
- case DOUBLE:
- isValid = value instanceof Double;
- break;
- case BOOLEAN:
- isValid = value instanceof Boolean;
- break;
- case STRING:
- isValid = value instanceof String;
- break;
- case BYTE_STRING:
- isValid = value instanceof ByteString || value instanceof byte[];
- break;
- case ENUM:
- // TODO(kenton): Caller must do type checking here, I guess.
- isValid = (value instanceof Integer || value instanceof Internal.EnumLite);
- break;
- case MESSAGE:
- // TODO(kenton): Caller must do type checking here, I guess.
- isValid = (value instanceof MessageLite) || (value instanceof LazyField);
- break;
- }
-
- if (!isValid) {
+ private void verifyType(final WireFormat.FieldType type, final Object value) {
+ if (!isValidType(type, value)) {
// TODO(kenton): When chaining calls to setField(), it can be hard to
// tell from the stack trace which exact call failed, since the whole
// chain is considered one line of code. It would be nice to print
@@ -422,6 +404,33 @@
}
}
+ private static boolean isValidType(final WireFormat.FieldType type, final Object value) {
+ checkNotNull(value);
+ switch (type.getJavaType()) {
+ case INT:
+ return value instanceof Integer;
+ case LONG:
+ return value instanceof Long;
+ case FLOAT:
+ return value instanceof Float;
+ case DOUBLE:
+ return value instanceof Double;
+ case BOOLEAN:
+ return value instanceof Boolean;
+ case STRING:
+ return value instanceof String;
+ case BYTE_STRING:
+ return value instanceof ByteString || value instanceof byte[];
+ case ENUM:
+ // TODO(kenton): Caller must do type checking here, I guess.
+ return (value instanceof Integer || value instanceof Internal.EnumLite);
+ case MESSAGE:
+ // TODO(kenton): Caller must do type checking here, I guess.
+ return (value instanceof MessageLite) || (value instanceof LazyField);
+ }
+ return false;
+ }
+
// =================================================================
// Parsing and serialization
@@ -436,7 +445,7 @@
return false;
}
}
- for (final Map.Entry<FieldDescriptorType, Object> entry : fields.getOverflowEntries()) {
+ for (final Map.Entry<T, Object> entry : fields.getOverflowEntries()) {
if (!isInitialized(entry)) {
return false;
}
@@ -445,8 +454,9 @@
}
@SuppressWarnings("unchecked")
- private boolean isInitialized(final Map.Entry<FieldDescriptorType, Object> entry) {
- final FieldDescriptorType descriptor = entry.getKey();
+ private static <T extends FieldDescriptorLite<T>> boolean isInitialized(
+ final Map.Entry<T, Object> entry) {
+ final T descriptor = entry.getKey();
if (descriptor.getLiteJavaType() == WireFormat.JavaType.MESSAGE) {
if (descriptor.isRepeated()) {
for (final MessageLite element : (List<MessageLite>) entry.getValue()) {
@@ -485,16 +495,16 @@
}
/** Like {@link Message.Builder#mergeFrom(Message)}, but merges from another {@link FieldSet}. */
- public void mergeFrom(final FieldSet<FieldDescriptorType> other) {
+ public void mergeFrom(final FieldSet<T> other) {
for (int i = 0; i < other.fields.getNumArrayEntries(); i++) {
mergeFromField(other.fields.getArrayEntryAt(i));
}
- for (final Map.Entry<FieldDescriptorType, Object> entry : other.fields.getOverflowEntries()) {
+ for (final Map.Entry<T, Object> entry : other.fields.getOverflowEntries()) {
mergeFromField(entry);
}
}
- private Object cloneIfMutable(Object value) {
+ private static Object cloneIfMutable(Object value) {
if (value instanceof byte[]) {
byte[] bytes = (byte[]) value;
byte[] copy = new byte[bytes.length];
@@ -506,8 +516,8 @@
}
@SuppressWarnings({"unchecked", "rawtypes"})
- private void mergeFromField(final Map.Entry<FieldDescriptorType, Object> entry) {
- final FieldDescriptorType descriptor = entry.getKey();
+ private void mergeFromField(final Map.Entry<T, Object> entry) {
+ final T descriptor = entry.getKey();
Object otherValue = entry.getValue();
if (otherValue instanceof LazyField) {
otherValue = ((LazyField) otherValue).getValue();
@@ -532,7 +542,6 @@
descriptor
.internalMergeFrom(((MessageLite) value).toBuilder(), (MessageLite) otherValue)
.build();
-
fields.put(descriptor, value);
}
} else {
@@ -567,10 +576,10 @@
/** See {@link Message#writeTo(CodedOutputStream)}. */
public void writeTo(final CodedOutputStream output) throws IOException {
for (int i = 0; i < fields.getNumArrayEntries(); i++) {
- final Map.Entry<FieldDescriptorType, Object> entry = fields.getArrayEntryAt(i);
+ final Map.Entry<T, Object> entry = fields.getArrayEntryAt(i);
writeField(entry.getKey(), entry.getValue(), output);
}
- for (final Map.Entry<FieldDescriptorType, Object> entry : fields.getOverflowEntries()) {
+ for (final Map.Entry<T, Object> entry : fields.getOverflowEntries()) {
writeField(entry.getKey(), entry.getValue(), output);
}
}
@@ -580,15 +589,14 @@
for (int i = 0; i < fields.getNumArrayEntries(); i++) {
writeMessageSetTo(fields.getArrayEntryAt(i), output);
}
- for (final Map.Entry<FieldDescriptorType, Object> entry : fields.getOverflowEntries()) {
+ for (final Map.Entry<T, Object> entry : fields.getOverflowEntries()) {
writeMessageSetTo(entry, output);
}
}
- private void writeMessageSetTo(
- final Map.Entry<FieldDescriptorType, Object> entry, final CodedOutputStream output)
+ private void writeMessageSetTo(final Map.Entry<T, Object> entry, final CodedOutputStream output)
throws IOException {
- final FieldDescriptorType descriptor = entry.getKey();
+ final T descriptor = entry.getKey();
if (descriptor.getLiteJavaType() == WireFormat.JavaType.MESSAGE
&& !descriptor.isRepeated()
&& !descriptor.isPacked()) {
@@ -750,10 +758,10 @@
public int getSerializedSize() {
int size = 0;
for (int i = 0; i < fields.getNumArrayEntries(); i++) {
- final Map.Entry<FieldDescriptorType, Object> entry = fields.getArrayEntryAt(i);
+ final Map.Entry<T, Object> entry = fields.getArrayEntryAt(i);
size += computeFieldSize(entry.getKey(), entry.getValue());
}
- for (final Map.Entry<FieldDescriptorType, Object> entry : fields.getOverflowEntries()) {
+ for (final Map.Entry<T, Object> entry : fields.getOverflowEntries()) {
size += computeFieldSize(entry.getKey(), entry.getValue());
}
return size;
@@ -765,14 +773,14 @@
for (int i = 0; i < fields.getNumArrayEntries(); i++) {
size += getMessageSetSerializedSize(fields.getArrayEntryAt(i));
}
- for (final Map.Entry<FieldDescriptorType, Object> entry : fields.getOverflowEntries()) {
+ for (final Map.Entry<T, Object> entry : fields.getOverflowEntries()) {
size += getMessageSetSerializedSize(entry);
}
return size;
}
- private int getMessageSetSerializedSize(final Map.Entry<FieldDescriptorType, Object> entry) {
- final FieldDescriptorType descriptor = entry.getKey();
+ private int getMessageSetSerializedSize(final Map.Entry<T, Object> entry) {
+ final T descriptor = entry.getKey();
Object value = entry.getValue();
if (descriptor.getLiteJavaType() == WireFormat.JavaType.MESSAGE
&& !descriptor.isRepeated()
@@ -904,4 +912,385 @@
return computeElementSize(type, number, value);
}
}
+
+ /**
+ * A FieldSet Builder that accept a {@link MessageLite.Builder} as a field value. This is useful
+ * for implementing methods in {@link MessageLite.Builder}.
+ */
+ static final class Builder<T extends FieldDescriptorLite<T>> {
+
+ private SmallSortedMap<T, Object> fields;
+ private boolean hasLazyField;
+ private boolean isMutable;
+ private boolean hasNestedBuilders;
+
+ private Builder() {
+ this(SmallSortedMap.<T>newFieldMap(DEFAULT_FIELD_MAP_ARRAY_SIZE));
+ }
+
+ private Builder(SmallSortedMap<T, Object> fields) {
+ this.fields = fields;
+ this.isMutable = true;
+ }
+
+ /** Creates the FieldSet */
+ public FieldSet<T> build() {
+ if (fields.isEmpty()) {
+ return FieldSet.emptySet();
+ }
+ isMutable = false;
+ SmallSortedMap<T, Object> fieldsForBuild = fields;
+ if (hasNestedBuilders) {
+ // Make a copy of the fields map with all Builders replaced by Message.
+ fieldsForBuild = cloneAllFieldsMap(fields, /* copyList */ false);
+ replaceBuilders(fieldsForBuild);
+ }
+ FieldSet<T> fieldSet = new FieldSet<>(fieldsForBuild);
+ fieldSet.hasLazyField = hasLazyField;
+ return fieldSet;
+ }
+
+ private static <T extends FieldDescriptorLite<T>> void replaceBuilders(
+ SmallSortedMap<T, Object> fieldMap) {
+ for (int i = 0; i < fieldMap.getNumArrayEntries(); i++) {
+ replaceBuilders(fieldMap.getArrayEntryAt(i));
+ }
+ for (Map.Entry<T, Object> entry : fieldMap.getOverflowEntries()) {
+ replaceBuilders(entry);
+ }
+ }
+
+ private static <T extends FieldDescriptorLite<T>> void replaceBuilders(
+ Map.Entry<T, Object> entry) {
+ entry.setValue(replaceBuilders(entry.getKey(), entry.getValue()));
+ }
+
+ private static <T extends FieldDescriptorLite<T>> Object replaceBuilders(
+ T descriptor, Object value) {
+ if (value == null) {
+ return value;
+ }
+ if (descriptor.getLiteJavaType() == WireFormat.JavaType.MESSAGE) {
+ if (descriptor.isRepeated()) {
+ if (!(value instanceof List)) {
+ throw new IllegalStateException(
+ "Repeated field should contains a List but actually contains type: "
+ + value.getClass());
+ }
+ @SuppressWarnings("unchecked") // We just check that value is an instance of List above.
+ List<Object> list = (List<Object>) value;
+ for (int i = 0; i < list.size(); i++) {
+ Object oldElement = list.get(i);
+ Object newElement = replaceBuilder(oldElement);
+ if (newElement != oldElement) {
+ // If the list contains a Message.Builder, then make a copy of that list and then
+ // modify the Message.Builder into a Message and return the new list. This way, the
+ // existing Message.Builder will still be able to modify the inner fields of the
+ // original FieldSet.Builder.
+ if (list == value) {
+ list = new ArrayList<>(list);
+ }
+ list.set(i, newElement);
+ }
+ }
+ return list;
+ } else {
+ return replaceBuilder(value);
+ }
+ }
+ return value;
+ }
+
+ private static Object replaceBuilder(Object value) {
+ return (value instanceof MessageLite.Builder) ? ((MessageLite.Builder) value).build() : value;
+ }
+
+ /** Returns a new Builder using the fields from {@code fieldSet}. */
+ public static <T extends FieldDescriptorLite<T>> Builder<T> fromFieldSet(FieldSet<T> fieldSet) {
+ Builder<T> builder = new Builder<T>(cloneAllFieldsMap(fieldSet.fields, /* copyList */ true));
+ builder.hasLazyField = fieldSet.hasLazyField;
+ return builder;
+ }
+
+ // =================================================================
+
+ /** Get a simple map containing all the fields. */
+ public Map<T, Object> getAllFields() {
+ if (hasLazyField) {
+ SmallSortedMap<T, Object> result = cloneAllFieldsMap(fields, /* copyList */ false);
+ if (fields.isImmutable()) {
+ result.makeImmutable();
+ } else {
+ replaceBuilders(result);
+ }
+ return result;
+ }
+ return fields.isImmutable() ? fields : Collections.unmodifiableMap(fields);
+ }
+
+ /** Useful for implementing {@link Message#hasField(Descriptors.FieldDescriptor)}. */
+ public boolean hasField(final T descriptor) {
+ if (descriptor.isRepeated()) {
+ throw new IllegalArgumentException("hasField() can only be called on non-repeated fields.");
+ }
+
+ return fields.get(descriptor) != null;
+ }
+
+ /**
+ * Useful for implementing {@link Message#getField(Descriptors.FieldDescriptor)}. This method
+ * returns {@code null} if the field is not set; in this case it is up to the caller to fetch
+ * the field's default value.
+ */
+ public Object getField(final T descriptor) {
+ Object value = getFieldAllowBuilders(descriptor);
+ return replaceBuilders(descriptor, value);
+ }
+
+ /** Same as {@link #getField(F)}, but allow a {@link MessageLite.Builder} to be returned. */
+ Object getFieldAllowBuilders(final T descriptor) {
+ Object o = fields.get(descriptor);
+ if (o instanceof LazyField) {
+ return ((LazyField) o).getValue();
+ }
+ return o;
+ }
+
+ private void ensureIsMutable() {
+ if (!isMutable) {
+ fields = cloneAllFieldsMap(fields, /* copyList */ true);
+ isMutable = true;
+ }
+ }
+
+ /**
+ * Useful for implementing {@link Message.Builder#setField(Descriptors.FieldDescriptor,
+ * Object)}.
+ */
+ @SuppressWarnings({"unchecked", "rawtypes"})
+ public void setField(final T descriptor, Object value) {
+ ensureIsMutable();
+ if (descriptor.isRepeated()) {
+ if (!(value instanceof List)) {
+ throw new IllegalArgumentException(
+ "Wrong object type used with protocol message reflection.");
+ }
+
+ // Wrap the contents in a new list so that the caller cannot change
+ // the list's contents after setting it.
+ final List newList = new ArrayList();
+ newList.addAll((List) value);
+ for (final Object element : newList) {
+ verifyType(descriptor.getLiteType(), element);
+ hasNestedBuilders = hasNestedBuilders || element instanceof MessageLite.Builder;
+ }
+ value = newList;
+ } else {
+ verifyType(descriptor.getLiteType(), value);
+ }
+
+ if (value instanceof LazyField) {
+ hasLazyField = true;
+ }
+ hasNestedBuilders = hasNestedBuilders || value instanceof MessageLite.Builder;
+
+ fields.put(descriptor, value);
+ }
+
+ /** Useful for implementing {@link Message.Builder#clearField(Descriptors.FieldDescriptor)}. */
+ public void clearField(final T descriptor) {
+ ensureIsMutable();
+ fields.remove(descriptor);
+ if (fields.isEmpty()) {
+ hasLazyField = false;
+ }
+ }
+
+ /**
+ * Useful for implementing {@link Message#getRepeatedFieldCount(Descriptors.FieldDescriptor)}.
+ */
+ public int getRepeatedFieldCount(final T descriptor) {
+ if (!descriptor.isRepeated()) {
+ throw new IllegalArgumentException(
+ "getRepeatedField() can only be called on repeated fields.");
+ }
+
+ final Object value = getField(descriptor);
+ if (value == null) {
+ return 0;
+ } else {
+ return ((List<?>) value).size();
+ }
+ }
+
+ /**
+ * Useful for implementing {@link Message#getRepeatedField(Descriptors.FieldDescriptor, int)}.
+ */
+ public Object getRepeatedField(final T descriptor, final int index) {
+ if (hasNestedBuilders) {
+ ensureIsMutable();
+ }
+ Object value = getRepeatedFieldAllowBuilders(descriptor, index);
+ return replaceBuilder(value);
+ }
+
+ /**
+ * Same as {@link #getRepeatedField(F, int)}, but allow a {@link MessageLite.Builder} to be
+ * returned.
+ */
+ Object getRepeatedFieldAllowBuilders(final T descriptor, final int index) {
+ if (!descriptor.isRepeated()) {
+ throw new IllegalArgumentException(
+ "getRepeatedField() can only be called on repeated fields.");
+ }
+
+ final Object value = getFieldAllowBuilders(descriptor);
+
+ if (value == null) {
+ throw new IndexOutOfBoundsException();
+ } else {
+ return ((List<?>) value).get(index);
+ }
+ }
+
+ /**
+ * Useful for implementing {@link Message.Builder#setRepeatedField(Descriptors.FieldDescriptor,
+ * int, Object)}.
+ */
+ @SuppressWarnings("unchecked")
+ public void setRepeatedField(final T descriptor, final int index, final Object value) {
+ ensureIsMutable();
+ if (!descriptor.isRepeated()) {
+ throw new IllegalArgumentException(
+ "getRepeatedField() can only be called on repeated fields.");
+ }
+
+ hasNestedBuilders = hasNestedBuilders || value instanceof MessageLite.Builder;
+
+ final Object list = getField(descriptor);
+ if (list == null) {
+ throw new IndexOutOfBoundsException();
+ }
+
+ verifyType(descriptor.getLiteType(), value);
+ ((List<Object>) list).set(index, value);
+ }
+
+ /**
+ * Useful for implementing {@link Message.Builder#addRepeatedField(Descriptors.FieldDescriptor,
+ * Object)}.
+ */
+ @SuppressWarnings("unchecked")
+ public void addRepeatedField(final T descriptor, final Object value) {
+ ensureIsMutable();
+ if (!descriptor.isRepeated()) {
+ throw new IllegalArgumentException(
+ "addRepeatedField() can only be called on repeated fields.");
+ }
+
+ hasNestedBuilders = hasNestedBuilders || value instanceof MessageLite.Builder;
+
+ verifyType(descriptor.getLiteType(), value);
+
+ final Object existingValue = getField(descriptor);
+ List<Object> list;
+ if (existingValue == null) {
+ list = new ArrayList<>();
+ fields.put(descriptor, list);
+ } else {
+ list = (List<Object>) existingValue;
+ }
+
+ list.add(value);
+ }
+
+ /**
+ * Verifies that the given object is of the correct type to be a valid value for the given
+ * field. (For repeated fields, this checks if the object is the right type to be one element of
+ * the field.)
+ *
+ * @throws IllegalArgumentException The value is not of the right type.
+ */
+ private static void verifyType(final WireFormat.FieldType type, final Object value) {
+ if (!FieldSet.isValidType(type, value)) {
+ // Builder can accept Message.Builder values even though FieldSet will reject.
+ if (type.getJavaType() == WireFormat.JavaType.MESSAGE
+ && value instanceof MessageLite.Builder) {
+ return;
+ }
+ throw new IllegalArgumentException(
+ "Wrong object type used with protocol message reflection.");
+ }
+ }
+
+ /**
+ * See {@link Message#isInitialized()}. Note: Since {@code FieldSet} itself does not have any
+ * way of knowing about required fields that aren't actually present in the set, it is up to the
+ * caller to check that all required fields are present.
+ */
+ public boolean isInitialized() {
+ for (int i = 0; i < fields.getNumArrayEntries(); i++) {
+ if (!FieldSet.isInitialized(fields.getArrayEntryAt(i))) {
+ return false;
+ }
+ }
+ for (final Map.Entry<T, Object> entry : fields.getOverflowEntries()) {
+ if (!FieldSet.isInitialized(entry)) {
+ return false;
+ }
+ }
+ return true;
+ }
+
+ /**
+ * Like {@link Message.Builder#mergeFrom(Message)}, but merges from another {@link FieldSet}.
+ */
+ public void mergeFrom(final FieldSet<T> other) {
+ ensureIsMutable();
+ for (int i = 0; i < other.fields.getNumArrayEntries(); i++) {
+ mergeFromField(other.fields.getArrayEntryAt(i));
+ }
+ for (final Map.Entry<T, Object> entry : other.fields.getOverflowEntries()) {
+ mergeFromField(entry);
+ }
+ }
+
+ @SuppressWarnings({"unchecked", "rawtypes"})
+ private void mergeFromField(final Map.Entry<T, Object> entry) {
+ final T descriptor = entry.getKey();
+ Object otherValue = entry.getValue();
+ if (otherValue instanceof LazyField) {
+ otherValue = ((LazyField) otherValue).getValue();
+ }
+
+ if (descriptor.isRepeated()) {
+ Object value = getField(descriptor);
+ if (value == null) {
+ value = new ArrayList();
+ }
+ for (Object element : (List) otherValue) {
+ ((List) value).add(FieldSet.cloneIfMutable(element));
+ }
+ fields.put(descriptor, value);
+ } else if (descriptor.getLiteJavaType() == WireFormat.JavaType.MESSAGE) {
+ Object value = getField(descriptor);
+ if (value == null) {
+ fields.put(descriptor, FieldSet.cloneIfMutable(otherValue));
+ } else {
+ // Merge the messages.
+ if (value instanceof MessageLite.Builder) {
+ descriptor.internalMergeFrom((MessageLite.Builder) value, (MessageLite) otherValue);
+ } else {
+ value =
+ descriptor
+ .internalMergeFrom(((MessageLite) value).toBuilder(), (MessageLite) otherValue)
+ .build();
+ fields.put(descriptor, value);
+ }
+ }
+ } else {
+ fields.put(descriptor, cloneIfMutable(otherValue));
+ }
+ }
+ }
}
diff --git a/java/core/src/main/java/com/google/protobuf/GeneratedMessageV3.java b/java/core/src/main/java/com/google/protobuf/GeneratedMessageV3.java
index bea008c..ae5e56c 100644
--- a/java/core/src/main/java/com/google/protobuf/GeneratedMessageV3.java
+++ b/java/core/src/main/java/com/google/protobuf/GeneratedMessageV3.java
@@ -1363,7 +1363,7 @@
extends Builder<BuilderType>
implements ExtendableMessageOrBuilder<MessageType> {
- private FieldSet<FieldDescriptor> extensions = FieldSet.emptySet();
+ private FieldSet.Builder<FieldDescriptor> extensions;
protected ExtendableBuilder() {}
@@ -1374,18 +1374,18 @@
// For immutable message conversion.
void internalSetExtensionSet(FieldSet<FieldDescriptor> extensions) {
- this.extensions = extensions;
+ this.extensions = FieldSet.Builder.fromFieldSet(extensions);
}
@Override
public BuilderType clear() {
- extensions = FieldSet.emptySet();
+ extensions = null;
return super.clear();
}
private void ensureExtensionsIsMutable() {
- if (extensions.isImmutable()) {
- extensions = extensions.clone();
+ if (extensions == null) {
+ extensions = FieldSet.newBuilder();
}
}
@@ -1408,7 +1408,7 @@
Extension<MessageType, Type> extension = checkNotLite(extensionLite);
verifyExtensionContainingType(extension);
- return extensions.hasField(extension.getDescriptor());
+ return extensions == null ? false : extensions.hasField(extension.getDescriptor());
}
/** Get the number of elements in a repeated extension. */
@@ -1419,7 +1419,7 @@
verifyExtensionContainingType(extension);
final FieldDescriptor descriptor = extension.getDescriptor();
- return extensions.getRepeatedFieldCount(descriptor);
+ return extensions == null ? 0 : extensions.getRepeatedFieldCount(descriptor);
}
/** Get the value of an extension. */
@@ -1429,7 +1429,7 @@
verifyExtensionContainingType(extension);
FieldDescriptor descriptor = extension.getDescriptor();
- final Object value = extensions.getField(descriptor);
+ final Object value = extensions == null ? null : extensions.getField(descriptor);
if (value == null) {
if (descriptor.isRepeated()) {
return (Type) Collections.emptyList();
@@ -1453,8 +1453,11 @@
verifyExtensionContainingType(extension);
FieldDescriptor descriptor = extension.getDescriptor();
- return (Type) extension.singularFromReflectionType(
- extensions.getRepeatedField(descriptor, index));
+ if (extensions == null) {
+ throw new IndexOutOfBoundsException();
+ }
+ return (Type)
+ extension.singularFromReflectionType(extensions.getRepeatedField(descriptor, index));
}
/** Set the value of an extension. */
@@ -1605,7 +1608,7 @@
/** Called by subclasses to check if all extensions are initialized. */
protected boolean extensionsAreInitialized() {
- return extensions.isInitialized();
+ return extensions == null ? true : extensions.isInitialized();
}
/**
@@ -1613,8 +1616,9 @@
* building the message.
*/
private FieldSet<FieldDescriptor> buildExtensions() {
- extensions.makeImmutable();
- return extensions;
+ return extensions == null
+ ? (FieldSet<FieldDescriptor>) FieldSet.emptySet()
+ : extensions.build();
}
@Override
@@ -1628,7 +1632,9 @@
@Override
public Map<FieldDescriptor, Object> getAllFields() {
final Map<FieldDescriptor, Object> result = super.getAllFieldsMutable();
- result.putAll(extensions.getAllFields());
+ if (extensions != null) {
+ result.putAll(extensions.getAllFields());
+ }
return Collections.unmodifiableMap(result);
}
@@ -1636,7 +1642,7 @@
public Object getField(final FieldDescriptor field) {
if (field.isExtension()) {
verifyContainingType(field);
- final Object value = extensions.getField(field);
+ final Object value = extensions == null ? null : extensions.getField(field);
if (value == null) {
if (field.getJavaType() == FieldDescriptor.JavaType.MESSAGE) {
// Lacking an ExtensionRegistry, we have no way to determine the
@@ -1654,10 +1660,43 @@
}
@Override
+ public Message.Builder getFieldBuilder(final FieldDescriptor field) {
+ if (field.isExtension()) {
+ verifyContainingType(field);
+ if (field.getJavaType() != FieldDescriptor.JavaType.MESSAGE) {
+ throw new UnsupportedOperationException(
+ "getFieldBuilder() called on a non-Message type.");
+ }
+ ensureExtensionsIsMutable();
+ final Object value = extensions.getFieldAllowBuilders(field);
+ if (value == null) {
+ Message.Builder builder = DynamicMessage.newBuilder(field.getMessageType());
+ extensions.setField(field, builder);
+ onChanged();
+ return builder;
+ } else {
+ if (value instanceof Message.Builder) {
+ return (Message.Builder) value;
+ } else if (value instanceof Message) {
+ Message.Builder builder = ((Message) value).toBuilder();
+ extensions.setField(field, builder);
+ onChanged();
+ return builder;
+ } else {
+ throw new UnsupportedOperationException(
+ "getRepeatedFieldBuilder() called on a non-Message type.");
+ }
+ }
+ } else {
+ return super.getFieldBuilder(field);
+ }
+ }
+
+ @Override
public int getRepeatedFieldCount(final FieldDescriptor field) {
if (field.isExtension()) {
verifyContainingType(field);
- return extensions.getRepeatedFieldCount(field);
+ return extensions == null ? 0 : extensions.getRepeatedFieldCount(field);
} else {
return super.getRepeatedFieldCount(field);
}
@@ -1668,6 +1707,9 @@
final int index) {
if (field.isExtension()) {
verifyContainingType(field);
+ if (extensions == null) {
+ throw new IndexOutOfBoundsException();
+ }
return extensions.getRepeatedField(field, index);
} else {
return super.getRepeatedField(field, index);
@@ -1675,10 +1717,36 @@
}
@Override
+ public Message.Builder getRepeatedFieldBuilder(final FieldDescriptor field, final int index) {
+ if (field.isExtension()) {
+ verifyContainingType(field);
+ ensureExtensionsIsMutable();
+ if (field.getJavaType() != FieldDescriptor.JavaType.MESSAGE) {
+ throw new UnsupportedOperationException(
+ "getRepeatedFieldBuilder() called on a non-Message type.");
+ }
+ final Object value = extensions.getRepeatedFieldAllowBuilders(field, index);
+ if (value instanceof Message.Builder) {
+ return (Message.Builder) value;
+ } else if (value instanceof Message) {
+ Message.Builder builder = ((Message) value).toBuilder();
+ extensions.setRepeatedField(field, index, builder);
+ onChanged();
+ return builder;
+ } else {
+ throw new UnsupportedOperationException(
+ "getRepeatedFieldBuilder() called on a non-Message type.");
+ }
+ } else {
+ return super.getRepeatedFieldBuilder(field, index);
+ }
+ }
+
+ @Override
public boolean hasField(final FieldDescriptor field) {
if (field.isExtension()) {
verifyContainingType(field);
- return extensions.hasField(field);
+ return extensions == null ? false : extensions.hasField(field);
} else {
return super.hasField(field);
}
@@ -1749,9 +1817,11 @@
}
protected final void mergeExtensionFields(final ExtendableMessage other) {
- ensureExtensionsIsMutable();
- extensions.mergeFrom(other.extensions);
- onChanged();
+ if (other.extensions != null) {
+ ensureExtensionsIsMutable();
+ extensions.mergeFrom(other.extensions);
+ onChanged();
+ }
}
private void verifyContainingType(final FieldDescriptor field) {
diff --git a/java/core/src/main/java/com/google/protobuf/ProtobufArrayList.java b/java/core/src/main/java/com/google/protobuf/ProtobufArrayList.java
index 175b1dd..33e4bd5 100644
--- a/java/core/src/main/java/com/google/protobuf/ProtobufArrayList.java
+++ b/java/core/src/main/java/com/google/protobuf/ProtobufArrayList.java
@@ -32,9 +32,10 @@
import com.google.protobuf.Internal.ProtobufList;
import java.util.Arrays;
+import java.util.RandomAccess;
/** Implements {@link ProtobufList} for non-primitive and {@link String} types. */
-final class ProtobufArrayList<E> extends AbstractProtobufList<E> {
+final class ProtobufArrayList<E> extends AbstractProtobufList<E> implements RandomAccess {
private static final ProtobufArrayList<Object> EMPTY_LIST =
new ProtobufArrayList<Object>(new Object[0], 0);
diff --git a/java/core/src/main/java/com/google/protobuf/TextFormat.java b/java/core/src/main/java/com/google/protobuf/TextFormat.java
index 0385b24..f3f1011 100644
--- a/java/core/src/main/java/com/google/protobuf/TextFormat.java
+++ b/java/core/src/main/java/com/google/protobuf/TextFormat.java
@@ -113,8 +113,8 @@
}
/**
- * Generates a human readable form of the field, useful for debugging and other purposes, with no
- * newline characters.
+ * Generates a human readable form of the field, useful for debugging and other purposes, with
+ * no newline characters.
*
* @deprecated Use {@code printer().shortDebugString(FieldDescriptor, Object)}
*/
@@ -122,10 +122,10 @@
public static String shortDebugString(final FieldDescriptor field, final Object value) {
return printer().shortDebugString(field, value);
}
-
+ //
/**
- * Generates a human readable form of the unknown fields, useful for debugging and other purposes,
- * with no newline characters.
+ * Generates a human readable form of the unknown fields, useful for debugging and other
+ * purposes, with no newline characters.
*
* @deprecated Use {@code printer().shortDebugString(UnknownFieldSet)}
*/
@@ -166,8 +166,8 @@
}
/**
- * Same as {@code printToString()}, except that non-ASCII characters in string type fields are not
- * escaped in backslash+octals.
+ * Same as {@code printToString()}, except that non-ASCII characters in string type fields are
+ * not escaped in backslash+octals.
*
* @deprecated Use {@code printer().escapingNonAscii(false).printToString(UnknownFieldSet)}
*/
@@ -175,20 +175,21 @@
public static String printToUnicodeString(final UnknownFieldSet fields) {
return printer().escapingNonAscii(false).printToString(fields);
}
-
+ //
/** @deprecated Use {@code printer().printField(FieldDescriptor, Object, Appendable)} */
@Deprecated
public static void printField(
- final FieldDescriptor field, final Object value, final Appendable output) throws IOException {
+ final FieldDescriptor field, final Object value, final Appendable output)
+ throws IOException {
printer().printField(field, value, output);
}
-
+ //
/** @deprecated Use {@code printer().printFieldToString(FieldDescriptor, Object)} */
@Deprecated
public static String printFieldToString(final FieldDescriptor field, final Object value) {
return printer().printFieldToString(field, value);
}
-
+ //
/**
* Outputs a unicode textual representation of the value of given field value.
*
@@ -205,7 +206,8 @@
*/
@Deprecated
public static void printUnicodeFieldValue(
- final FieldDescriptor field, final Object value, final Appendable output) throws IOException {
+ final FieldDescriptor field, final Object value, final Appendable output)
+ throws IOException {
printer().escapingNonAscii(false).printFieldValue(field, value, output);
}
@@ -285,13 +287,16 @@
public static final class Printer {
// Printer instance which escapes non-ASCII characters.
- private static final Printer DEFAULT = new Printer(true);
+ private static final Printer DEFAULT = new Printer(true, TypeRegistry.getEmptyTypeRegistry());
/** Whether to escape non ASCII characters with backslash and octal. */
private final boolean escapeNonAscii;
- private Printer(boolean escapeNonAscii) {
+ private final TypeRegistry typeRegistry;
+
+ private Printer(boolean escapeNonAscii, TypeRegistry typeRegistry) {
this.escapeNonAscii = escapeNonAscii;
+ this.typeRegistry = typeRegistry;
}
/**
@@ -304,7 +309,20 @@
* with the escape mode set to the given parameter.
*/
public Printer escapingNonAscii(boolean escapeNonAscii) {
- return new Printer(escapeNonAscii);
+ return new Printer(escapeNonAscii, typeRegistry);
+ }
+
+ /**
+ * Creates a new {@link Printer} using the given typeRegistry. The new Printer clones all other
+ * configurations from the current {@link Printer}.
+ *
+ * @throws IllegalArgumentException if a registry is already set.
+ */
+ public Printer usingTypeRegistry(TypeRegistry typeRegistry) {
+ if (this.typeRegistry != TypeRegistry.getEmptyTypeRegistry()) {
+ throw new IllegalArgumentException("Only one typeRegistry is allowed.");
+ }
+ return new Printer(escapeNonAscii, typeRegistry);
}
/**
@@ -323,9 +341,66 @@
private void print(final MessageOrBuilder message, final TextGenerator generator)
throws IOException {
+ if (message.getDescriptorForType().getFullName().equals("google.protobuf.Any")
+ && printAny(message, generator)) {
+ return;
+ }
printMessage(message, generator);
}
+ /**
+ * Attempt to print the 'google.protobuf.Any' message in a human-friendly format. Returns false
+ * if the message isn't a valid 'google.protobuf.Any' message (in which case the message should
+ * be rendered just like a regular message to help debugging).
+ */
+ private boolean printAny(final MessageOrBuilder message, final TextGenerator generator)
+ throws IOException {
+ Descriptor messageType = message.getDescriptorForType();
+ FieldDescriptor typeUrlField = messageType.findFieldByNumber(1);
+ FieldDescriptor valueField = messageType.findFieldByNumber(2);
+ if (typeUrlField == null
+ || typeUrlField.getType() != FieldDescriptor.Type.STRING
+ || valueField == null
+ || valueField.getType() != FieldDescriptor.Type.BYTES) {
+ // The message may look like an Any but isn't actually an Any message (might happen if the
+ // user tries to use DynamicMessage to construct an Any from incomplete Descriptor).
+ return false;
+ }
+ String typeUrl = (String) message.getField(typeUrlField);
+ // If type_url is not set, we will not be able to decode the content of the value, so just
+ // print out the Any like a regular message.
+ if (typeUrl.isEmpty()) {
+ return false;
+ }
+ Object value = message.getField(valueField);
+
+ Message.Builder contentBuilder = null;
+ try {
+ Descriptor contentType = typeRegistry.getDescriptorForTypeUrl(typeUrl);
+ if (contentType == null) {
+ return false;
+ }
+ contentBuilder = DynamicMessage.getDefaultInstance(contentType).newBuilderForType();
+ contentBuilder.mergeFrom((ByteString) value);
+ } catch (InvalidProtocolBufferException e) {
+ // The value of Any is malformed. We cannot print it out nicely, so fallback to printing out
+ // the type_url and value as bytes. Note that we fail open here to be consistent with
+ // text_format.cc, and also to allow a way for users to inspect the content of the broken
+ // message.
+ return false;
+ }
+ generator.print("[");
+ generator.print(typeUrl);
+ generator.print("] {");
+ generator.eol();
+ generator.indent();
+ print(contentBuilder, generator);
+ generator.outdent();
+ generator.print("}");
+ generator.eol();
+ return true;
+ }
+
public String printFieldToString(final FieldDescriptor field, final Object value) {
try {
final StringBuilder text = new StringBuilder();
@@ -1382,6 +1457,7 @@
FORBID_SINGULAR_OVERWRITES
}
+ private final TypeRegistry typeRegistry;
private final boolean allowUnknownFields;
private final boolean allowUnknownEnumValues;
private final boolean allowUnknownExtensions;
@@ -1389,11 +1465,13 @@
private TextFormatParseInfoTree.Builder parseInfoTreeBuilder;
private Parser(
+ TypeRegistry typeRegistry,
boolean allowUnknownFields,
boolean allowUnknownEnumValues,
boolean allowUnknownExtensions,
SingularOverwritePolicy singularOverwritePolicy,
TextFormatParseInfoTree.Builder parseInfoTreeBuilder) {
+ this.typeRegistry = typeRegistry;
this.allowUnknownFields = allowUnknownFields;
this.allowUnknownEnumValues = allowUnknownEnumValues;
this.allowUnknownExtensions = allowUnknownExtensions;
@@ -1414,6 +1492,18 @@
private SingularOverwritePolicy singularOverwritePolicy =
SingularOverwritePolicy.ALLOW_SINGULAR_OVERWRITES;
private TextFormatParseInfoTree.Builder parseInfoTreeBuilder = null;
+ private TypeRegistry typeRegistry = TypeRegistry.getEmptyTypeRegistry();
+
+ /**
+ * Sets the TypeRegistry for resolving Any. If this is not set, TextFormat will not be able to
+ * parse Any unless Any is write as bytes.
+ *
+ * @throws IllegalArgumentException if a registry is already set.
+ */
+ public Builder setTypeRegistry(TypeRegistry typeRegistry) {
+ this.typeRegistry = typeRegistry;
+ return this;
+ }
/**
* Set whether this parser will allow unknown fields. By default, an exception is thrown if an
@@ -1452,6 +1542,7 @@
public Parser build() {
return new Parser(
+ typeRegistry,
allowUnknownFields,
allowUnknownEnumValues,
allowUnknownExtensions,
@@ -1834,6 +1925,14 @@
endToken = "}";
}
+ // Try to parse human readable format of Any in the form: [type_url]: { ... }
+ if (field.getMessageType().getFullName().equals("google.protobuf.Any")
+ && tokenizer.tryConsume("[")) {
+ value =
+ consumeAnyFieldValue(
+ tokenizer, extensionRegistry, field, parseTreeBuilder, unknownFields);
+ tokenizer.consume(endToken);
+ } else {
Message defaultInstance = (extension == null) ? null : extension.defaultInstance;
MessageReflection.MergeTarget subField =
target.newMergeTargetForField(field, defaultInstance);
@@ -1846,6 +1945,8 @@
}
value = subField.finish();
+ }
+
} else {
switch (field.getType()) {
case INT32:
@@ -1951,6 +2052,71 @@
}
}
+ private Object consumeAnyFieldValue(
+ final Tokenizer tokenizer,
+ final ExtensionRegistry extensionRegistry,
+ final FieldDescriptor field,
+ final TextFormatParseInfoTree.Builder parseTreeBuilder,
+ List<UnknownField> unknownFields)
+ throws ParseException {
+ // Try to parse human readable format of Any in the form: [type_url]: { ... }
+ StringBuilder typeUrlBuilder = new StringBuilder();
+ // Parse the type_url inside [].
+ while (true) {
+ typeUrlBuilder.append(tokenizer.consumeIdentifier());
+ if (tokenizer.tryConsume("]")) {
+ break;
+ }
+ if (tokenizer.tryConsume("/")) {
+ typeUrlBuilder.append("/");
+ } else if (tokenizer.tryConsume(".")) {
+ typeUrlBuilder.append(".");
+ } else {
+ throw tokenizer.parseExceptionPreviousToken("Expected a valid type URL.");
+ }
+ }
+ tokenizer.tryConsume(":");
+ final String anyEndToken;
+ if (tokenizer.tryConsume("<")) {
+ anyEndToken = ">";
+ } else {
+ tokenizer.consume("{");
+ anyEndToken = "}";
+ }
+ String typeUrl = typeUrlBuilder.toString();
+ Descriptor contentType = null;
+ try {
+ contentType = typeRegistry.getDescriptorForTypeUrl(typeUrl);
+ } catch (InvalidProtocolBufferException e) {
+ throw tokenizer.parseException("Invalid valid type URL. Found: " + typeUrl);
+ }
+ if (contentType == null) {
+ throw tokenizer.parseException(
+ "Unable to parse Any of type: "
+ + typeUrl
+ + ". Please make sure that the TypeRegistry contains the descriptors for the given"
+ + " types.");
+ }
+ Message.Builder contentBuilder =
+ DynamicMessage.getDefaultInstance(contentType).newBuilderForType();
+ MessageReflection.BuilderAdapter contentTarget =
+ new MessageReflection.BuilderAdapter(contentBuilder);
+ while (!tokenizer.tryConsume(anyEndToken)) {
+ mergeField(tokenizer, extensionRegistry, contentTarget, parseTreeBuilder, unknownFields);
+ }
+
+ // Serialize the content and put it back into an Any. Note that we can't depend on Any here
+ // because of a cyclic dependency (java_proto_library for any_java_proto depends on the
+ // protobuf_impl), so we need to construct the Any using proto reflection.
+ Descriptor anyDescriptor = field.getMessageType();
+ Message.Builder anyBuilder =
+ DynamicMessage.getDefaultInstance(anyDescriptor).newBuilderForType();
+ anyBuilder.setField(anyDescriptor.findFieldByName("type_url"), typeUrlBuilder.toString());
+ anyBuilder.setField(
+ anyDescriptor.findFieldByName("value"), contentBuilder.build().toByteString());
+
+ return anyBuilder.build();
+ }
/** Skips the next field including the field's name and value. */
private void skipField(Tokenizer tokenizer) throws ParseException {
diff --git a/java/core/src/main/java/com/google/protobuf/TypeRegistry.java b/java/core/src/main/java/com/google/protobuf/TypeRegistry.java
new file mode 100755
index 0000000..47d798b
--- /dev/null
+++ b/java/core/src/main/java/com/google/protobuf/TypeRegistry.java
@@ -0,0 +1,160 @@
+// Protocol Buffers - Google's data interchange format
+// Copyright 2008 Google Inc. All rights reserved.
+// https://developers.google.com/protocol-buffers/
+//
+// Redistribution and use in source and binary forms, with or without
+// modification, are permitted provided that the following conditions are
+// met:
+//
+// * Redistributions of source code must retain the above copyright
+// notice, this list of conditions and the following disclaimer.
+// * Redistributions in binary form must reproduce the above
+// copyright notice, this list of conditions and the following disclaimer
+// in the documentation and/or other materials provided with the
+// distribution.
+// * Neither the name of Google Inc. nor the names of its
+// contributors may be used to endorse or promote products derived from
+// this software without specific prior written permission.
+//
+// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+
+package com.google.protobuf;
+
+import com.google.protobuf.Descriptors.Descriptor;
+import com.google.protobuf.Descriptors.FileDescriptor;
+import java.util.Collections;
+import java.util.HashMap;
+import java.util.HashSet;
+import java.util.Map;
+import java.util.Set;
+import java.util.logging.Logger;
+
+/**
+ * A TypeRegistry is used to resolve Any messages. You must provide a TypeRegistry containing all
+ * message types used in Any message fields.
+ */
+public class TypeRegistry {
+ private static final Logger logger = Logger.getLogger(TypeRegistry.class.getName());
+
+ private static class EmptyTypeRegistryHolder {
+ private static final TypeRegistry EMPTY =
+ new TypeRegistry(Collections.<String, Descriptor>emptyMap());
+ }
+
+ public static TypeRegistry getEmptyTypeRegistry() {
+ return EmptyTypeRegistryHolder.EMPTY;
+ }
+
+
+ public static Builder newBuilder() {
+ return new Builder();
+ }
+
+ /**
+ * Find a type by its full name. Returns null if it cannot be found in this {@link TypeRegistry}.
+ */
+ public Descriptor find(String name) {
+ return types.get(name);
+ }
+
+ /**
+ * Find a type by its typeUrl. Returns null if it cannot be found in this {@link TypeRegistry}.
+ */
+ /* @Nullable */
+ public final Descriptor getDescriptorForTypeUrl(String typeUrl)
+ throws InvalidProtocolBufferException {
+ return find(getTypeName(typeUrl));
+ }
+
+ private final Map<String, Descriptor> types;
+
+ TypeRegistry(Map<String, Descriptor> types) {
+ this.types = types;
+ }
+
+ private static String getTypeName(String typeUrl) throws InvalidProtocolBufferException {
+ String[] parts = typeUrl.split("/");
+ if (parts.length == 1) {
+ throw new InvalidProtocolBufferException("Invalid type url found: " + typeUrl);
+ }
+ return parts[parts.length - 1];
+ }
+
+ /** A Builder is used to build {@link TypeRegistry}. */
+ public static final class Builder {
+ private Builder() {}
+
+ /**
+ * Adds a message type and all types defined in the same .proto file as well as all transitively
+ * imported .proto files to this {@link Builder}.
+ */
+ public Builder add(Descriptor messageType) {
+ if (types == null) {
+ throw new IllegalStateException("A TypeRegistry.Builder can only be used once.");
+ }
+ addFile(messageType.getFile());
+ return this;
+ }
+
+ /**
+ * Adds message types and all types defined in the same .proto file as well as all transitively
+ * imported .proto files to this {@link Builder}.
+ */
+ public Builder add(Iterable<Descriptor> messageTypes) {
+ if (types == null) {
+ throw new IllegalStateException("A TypeRegistry.Builder can only be used once.");
+ }
+ for (Descriptor type : messageTypes) {
+ addFile(type.getFile());
+ }
+ return this;
+ }
+
+ /** Builds a {@link TypeRegistry}. This method can only be called once for one Builder. */
+ public TypeRegistry build() {
+ TypeRegistry result = new TypeRegistry(types);
+ // Make sure the built {@link TypeRegistry} is immutable.
+ types = null;
+ return result;
+ }
+
+ private void addFile(FileDescriptor file) {
+ // Skip the file if it's already added.
+ if (!files.add(file.getFullName())) {
+ return;
+ }
+ for (FileDescriptor dependency : file.getDependencies()) {
+ addFile(dependency);
+ }
+ for (Descriptor message : file.getMessageTypes()) {
+ addMessage(message);
+ }
+ }
+
+ private void addMessage(Descriptor message) {
+ for (Descriptor nestedType : message.getNestedTypes()) {
+ addMessage(nestedType);
+ }
+
+ if (types.containsKey(message.getFullName())) {
+ logger.warning("Type " + message.getFullName() + " is added multiple times.");
+ return;
+ }
+
+ types.put(message.getFullName(), message);
+ }
+
+ private final Set<String> files = new HashSet<>();
+ private Map<String, Descriptor> types = new HashMap<>();
+ }
+}
diff --git a/java/core/src/test/java/com/google/protobuf/GeneratedMessageTest.java b/java/core/src/test/java/com/google/protobuf/GeneratedMessageTest.java
index 12bba6b..5a43bca 100644
--- a/java/core/src/test/java/com/google/protobuf/GeneratedMessageTest.java
+++ b/java/core/src/test/java/com/google/protobuf/GeneratedMessageTest.java
@@ -115,6 +115,160 @@
GeneratedMessageV3.setAlwaysUseFieldBuildersForTesting(false);
}
+ public void testGetFieldBuilderForExtensionField() {
+ TestAllExtensions.Builder builder = TestAllExtensions.newBuilder();
+ Message.Builder fieldBuilder =
+ builder.getFieldBuilder(UnittestProto.optionalNestedMessageExtension.getDescriptor());
+ int expected = 7432;
+ FieldDescriptor field =
+ NestedMessage.getDescriptor().findFieldByNumber(NestedMessage.BB_FIELD_NUMBER);
+ fieldBuilder.setField(field, expected);
+ assertEquals(
+ expected,
+ builder.build().getExtension(UnittestProto.optionalNestedMessageExtension).getBb());
+
+ // fieldBuilder still updates the builder after builder build() has been called.
+ expected += 100;
+ fieldBuilder.setField(field, expected);
+ assertEquals(
+ expected,
+ builder.build().getExtension(UnittestProto.optionalNestedMessageExtension).getBb());
+ }
+
+ public void testGetFieldBuilderWithExistingMessage() {
+ TestAllExtensions.Builder builder = TestAllExtensions.newBuilder();
+ builder.setExtension(
+ UnittestProto.optionalNestedMessageExtension,
+ NestedMessage.newBuilder().setBb(123).build());
+ Message.Builder fieldBuilder =
+ builder.getFieldBuilder(UnittestProto.optionalNestedMessageExtension.getDescriptor());
+ int expected = 7432;
+ FieldDescriptor field =
+ NestedMessage.getDescriptor().findFieldByNumber(NestedMessage.BB_FIELD_NUMBER);
+ fieldBuilder.setField(field, expected);
+ assertEquals(
+ expected,
+ builder.build().getExtension(UnittestProto.optionalNestedMessageExtension).getBb());
+
+ // fieldBuilder still updates the builder after builder build() has been called.
+ expected += 100;
+ fieldBuilder.setField(field, expected);
+ assertEquals(
+ expected,
+ builder.build().getExtension(UnittestProto.optionalNestedMessageExtension).getBb());
+ }
+
+ public void testGetFieldBuilderWithExistingBuilder() {
+ TestAllExtensions.Builder builder = TestAllExtensions.newBuilder();
+ NestedMessage.Builder nestedMessageBuilder = NestedMessage.newBuilder().setBb(123);
+ builder.setField(
+ UnittestProto.optionalNestedMessageExtension.getDescriptor(), nestedMessageBuilder);
+ Message.Builder fieldBuilder =
+ builder.getFieldBuilder(UnittestProto.optionalNestedMessageExtension.getDescriptor());
+ int expected = 7432;
+ FieldDescriptor field =
+ NestedMessage.getDescriptor().findFieldByNumber(NestedMessage.BB_FIELD_NUMBER);
+ fieldBuilder.setField(field, expected);
+ assertEquals(
+ expected,
+ builder.build().getExtension(UnittestProto.optionalNestedMessageExtension).getBb());
+
+ // Existing nestedMessageBuilder will also update builder.
+ expected += 100;
+ nestedMessageBuilder.setBb(expected);
+ assertEquals(
+ expected,
+ builder.build().getExtension(UnittestProto.optionalNestedMessageExtension).getBb());
+
+ // fieldBuilder still updates the builder.
+ expected += 100;
+ fieldBuilder.setField(field, expected);
+ assertEquals(
+ expected,
+ builder.build().getExtension(UnittestProto.optionalNestedMessageExtension).getBb());
+ }
+
+ public void testGetRepeatedFieldBuilderForExtensionField() {
+ TestAllExtensions.Builder builder = TestAllExtensions.newBuilder();
+ builder.addExtension(
+ UnittestProto.repeatedNestedMessageExtension,
+ NestedMessage.newBuilder().setBb(123).build());
+ Message.Builder fieldBuilder =
+ builder.getRepeatedFieldBuilder(
+ UnittestProto.repeatedNestedMessageExtension.getDescriptor(), 0);
+ int expected = 7432;
+ FieldDescriptor field =
+ NestedMessage.getDescriptor().findFieldByNumber(NestedMessage.BB_FIELD_NUMBER);
+ fieldBuilder.setField(field, expected);
+ assertEquals(
+ expected,
+ builder.build().getExtension(UnittestProto.repeatedNestedMessageExtension, 0).getBb());
+
+ // fieldBuilder still updates the builder after builder build() has been called.
+ expected += 100;
+ fieldBuilder.setField(field, expected);
+ assertEquals(
+ expected,
+ builder.build().getExtension(UnittestProto.repeatedNestedMessageExtension, 0).getBb());
+ }
+
+ public void testGetRepeatedFieldBuilderForExistingBuilder() {
+ TestAllExtensions.Builder builder = TestAllExtensions.newBuilder();
+ NestedMessage.Builder nestedMessageBuilder = NestedMessage.newBuilder().setBb(123);
+ builder.addRepeatedField(
+ UnittestProto.repeatedNestedMessageExtension.getDescriptor(), nestedMessageBuilder);
+ Message.Builder fieldBuilder =
+ builder.getRepeatedFieldBuilder(
+ UnittestProto.repeatedNestedMessageExtension.getDescriptor(), 0);
+ int expected = 7432;
+ FieldDescriptor field =
+ NestedMessage.getDescriptor().findFieldByNumber(NestedMessage.BB_FIELD_NUMBER);
+ fieldBuilder.setField(field, expected);
+ assertEquals(
+ expected,
+ builder.build().getExtension(UnittestProto.repeatedNestedMessageExtension, 0).getBb());
+
+ // Existing nestedMessageBuilder will also update builder.
+ expected += 100;
+ nestedMessageBuilder.setBb(expected);
+ assertEquals(
+ expected,
+ builder.build().getExtension(UnittestProto.repeatedNestedMessageExtension, 0).getBb());
+
+ // fieldBuilder still updates the builder.
+ expected += 100;
+ fieldBuilder.setField(field, expected);
+ assertEquals(
+ expected,
+ builder.build().getExtension(UnittestProto.repeatedNestedMessageExtension, 0).getBb());
+ }
+
+ public void testGetExtensionFieldOutOfBound() {
+ TestAllExtensions.Builder builder = TestAllExtensions.newBuilder();
+ try {
+ builder.getRepeatedField(UnittestProto.repeatedNestedMessageExtension.getDescriptor(), 0);
+ fail("Expected IndexOutOfBoundsException to be thrown");
+ } catch (IndexOutOfBoundsException expected) {
+ }
+ try {
+ builder.getExtension(UnittestProto.repeatedNestedMessageExtension, 0);
+ fail("Expected IndexOutOfBoundsException to be thrown");
+ } catch (IndexOutOfBoundsException expected) {
+ }
+ TestAllExtensions extensionsMessage = builder.build();
+ try {
+ extensionsMessage.getRepeatedField(
+ UnittestProto.repeatedNestedMessageExtension.getDescriptor(), 0);
+ fail("Expected IndexOutOfBoundsException to be thrown");
+ } catch (IndexOutOfBoundsException expected) {
+ }
+ try {
+ extensionsMessage.getExtension(UnittestProto.repeatedNestedMessageExtension, 0);
+ fail("Expected IndexOutOfBoundsException to be thrown");
+ } catch (IndexOutOfBoundsException expected) {
+ }
+ }
+
public void testDefaultInstance() throws Exception {
assertSame(
TestAllTypes.getDefaultInstance(),
diff --git a/java/core/src/test/java/com/google/protobuf/NestedBuildersTest.java b/java/core/src/test/java/com/google/protobuf/NestedBuildersTest.java
index 7bfeaf1..1af3f93 100644
--- a/java/core/src/test/java/com/google/protobuf/NestedBuildersTest.java
+++ b/java/core/src/test/java/com/google/protobuf/NestedBuildersTest.java
@@ -30,6 +30,7 @@
package com.google.protobuf;
+import protobuf_unittest.Engine;
import protobuf_unittest.Vehicle;
import protobuf_unittest.Wheel;
import java.util.ArrayList;
@@ -64,7 +65,7 @@
for (int i = 0; i < 4; i++) {
vehicleBuilder.getWheelBuilder(i).setRadius(5).setWidth(i + 10);
}
- vehicleBuilder.getEngineBuilder().setLiters(20);
+ Engine.Builder engineBuilder = vehicleBuilder.getEngineBuilder().setLiters(20);
vehicle = vehicleBuilder.build();
for (int i = 0; i < 4; i++) {
@@ -74,6 +75,9 @@
}
assertEquals(20, vehicle.getEngine().getLiters());
assertTrue(vehicle.hasEngine());
+
+ engineBuilder.setLiters(50);
+ assertEquals(50, vehicleBuilder.getEngine().getLiters());
}
public void testMessagesAreCached() {
diff --git a/java/core/src/test/java/com/google/protobuf/TextFormatTest.java b/java/core/src/test/java/com/google/protobuf/TextFormatTest.java
index 4421c0c..dd0e8c8 100644
--- a/java/core/src/test/java/com/google/protobuf/TextFormatTest.java
+++ b/java/core/src/test/java/com/google/protobuf/TextFormatTest.java
@@ -33,9 +33,14 @@
import static com.google.protobuf.TestUtil.TEST_REQUIRED_INITIALIZED;
import static com.google.protobuf.TestUtil.TEST_REQUIRED_UNINITIALIZED;
+import com.google.protobuf.DescriptorProtos.DescriptorProto;
+import com.google.protobuf.DescriptorProtos.FieldDescriptorProto;
+import com.google.protobuf.DescriptorProtos.FileDescriptorProto;
import com.google.protobuf.Descriptors.Descriptor;
import com.google.protobuf.Descriptors.FieldDescriptor;
+import com.google.protobuf.Descriptors.FileDescriptor;
import com.google.protobuf.TextFormat.Parser.SingularOverwritePolicy;
+import any_test.AnyTestProto.TestAny;
import map_test.MapTestProto.TestMap;
import protobuf_unittest.UnittestMset.TestMessageSetExtension1;
import protobuf_unittest.UnittestMset.TestMessageSetExtension2;
@@ -48,6 +53,7 @@
import protobuf_unittest.UnittestProto.TestRequired;
import proto2_wireformat_unittest.UnittestMsetWireFormat.TestMessageSet;
import java.io.StringReader;
+import java.util.Arrays;
import java.util.List;
import java.util.logging.Logger;
import junit.framework.TestCase;
@@ -506,6 +512,191 @@
assertEquals(2, builder.getOptionalInt64());
}
+ public void testPrintAny_customBuiltTypeRegistry() throws Exception {
+ TestAny testAny =
+ TestAny.newBuilder()
+ .setValue(
+ Any.newBuilder()
+ .setTypeUrl("type.googleapis.com/" + TestAllTypes.getDescriptor().getFullName())
+ .setValue(
+ TestAllTypes.newBuilder().setOptionalInt32(12345).build().toByteString())
+ .build())
+ .build();
+ String actual =
+ TextFormat.printer()
+ .usingTypeRegistry(TypeRegistry.newBuilder().add(TestAllTypes.getDescriptor()).build())
+ .printToString(testAny);
+ String expected =
+ "value {\n"
+ + " [type.googleapis.com/protobuf_unittest.TestAllTypes] {\n"
+ + " optional_int32: 12345\n"
+ + " }\n"
+ + "}\n";
+ assertEquals(expected, actual);
+ }
+
+ private static Descriptor createDescriptorForAny(FieldDescriptorProto... fields)
+ throws Exception {
+ FileDescriptor fileDescriptor =
+ FileDescriptor.buildFrom(
+ FileDescriptorProto.newBuilder()
+ .setName("any.proto")
+ .setPackage("google.protobuf")
+ .setSyntax("proto3")
+ .addMessageType(
+ DescriptorProto.newBuilder()
+ .setName("Any")
+ .addAllField(Arrays.asList(fields)))
+ .build(),
+ new FileDescriptor[0]);
+ return fileDescriptor.getMessageTypes().get(0);
+ }
+
+ public void testPrintAny_anyWithDynamicMessage() throws Exception {
+ Descriptor descriptor =
+ createDescriptorForAny(
+ FieldDescriptorProto.newBuilder()
+ .setName("type_url")
+ .setNumber(1)
+ .setLabel(FieldDescriptorProto.Label.LABEL_OPTIONAL)
+ .setType(FieldDescriptorProto.Type.TYPE_STRING)
+ .build(),
+ FieldDescriptorProto.newBuilder()
+ .setName("value")
+ .setNumber(2)
+ .setLabel(FieldDescriptorProto.Label.LABEL_OPTIONAL)
+ .setType(FieldDescriptorProto.Type.TYPE_BYTES)
+ .build());
+ DynamicMessage testAny =
+ DynamicMessage.newBuilder(descriptor)
+ .setField(
+ descriptor.findFieldByNumber(1),
+ "type.googleapis.com/" + TestAllTypes.getDescriptor().getFullName())
+ .setField(
+ descriptor.findFieldByNumber(2),
+ TestAllTypes.newBuilder().setOptionalInt32(12345).build().toByteString())
+ .build();
+ String actual =
+ TextFormat.printer()
+ .usingTypeRegistry(TypeRegistry.newBuilder().add(TestAllTypes.getDescriptor()).build())
+ .printToString(testAny);
+ String expected =
+ "[type.googleapis.com/protobuf_unittest.TestAllTypes] {\n"
+ + " optional_int32: 12345\n"
+ + "}\n";
+ assertEquals(expected, actual);
+ }
+
+ public void testPrintAny_anyFromWithNoValueField() throws Exception {
+ Descriptor descriptor =
+ createDescriptorForAny(
+ FieldDescriptorProto.newBuilder()
+ .setName("type_url")
+ .setNumber(1)
+ .setLabel(FieldDescriptorProto.Label.LABEL_OPTIONAL)
+ .setType(FieldDescriptorProto.Type.TYPE_STRING)
+ .build());
+ DynamicMessage testAny =
+ DynamicMessage.newBuilder(descriptor)
+ .setField(
+ descriptor.findFieldByNumber(1),
+ "type.googleapis.com/" + TestAllTypes.getDescriptor().getFullName())
+ .build();
+ String actual =
+ TextFormat.printer()
+ .usingTypeRegistry(TypeRegistry.newBuilder().add(TestAllTypes.getDescriptor()).build())
+ .printToString(testAny);
+ String expected = "type_url: \"type.googleapis.com/protobuf_unittest.TestAllTypes\"\n";
+ assertEquals(expected, actual);
+ }
+
+ public void testPrintAny_anyFromWithNoTypeUrlField() throws Exception {
+ Descriptor descriptor =
+ createDescriptorForAny(
+ FieldDescriptorProto.newBuilder()
+ .setName("value")
+ .setNumber(2)
+ .setLabel(FieldDescriptorProto.Label.LABEL_OPTIONAL)
+ .setType(FieldDescriptorProto.Type.TYPE_BYTES)
+ .build());
+ DynamicMessage testAny =
+ DynamicMessage.newBuilder(descriptor)
+ .setField(
+ descriptor.findFieldByNumber(2),
+ TestAllTypes.newBuilder().setOptionalInt32(12345).build().toByteString())
+ .build();
+ String actual =
+ TextFormat.printer()
+ .usingTypeRegistry(TypeRegistry.newBuilder().add(TestAllTypes.getDescriptor()).build())
+ .printToString(testAny);
+ String expected = "value: \"\\b\\271`\"\n";
+ assertEquals(expected, actual);
+ }
+
+ public void testPrintAny_anyWithInvalidFieldType() throws Exception {
+ Descriptor descriptor =
+ createDescriptorForAny(
+ FieldDescriptorProto.newBuilder()
+ .setName("type_url")
+ .setNumber(1)
+ .setLabel(FieldDescriptorProto.Label.LABEL_OPTIONAL)
+ .setType(FieldDescriptorProto.Type.TYPE_STRING)
+ .build(),
+ FieldDescriptorProto.newBuilder()
+ .setName("value")
+ .setNumber(2)
+ .setLabel(FieldDescriptorProto.Label.LABEL_OPTIONAL)
+ .setType(FieldDescriptorProto.Type.TYPE_STRING)
+ .build());
+ DynamicMessage testAny =
+ DynamicMessage.newBuilder(descriptor)
+ .setField(
+ descriptor.findFieldByNumber(1),
+ "type.googleapis.com/" + TestAllTypes.getDescriptor().getFullName())
+ .setField(descriptor.findFieldByNumber(2), "test")
+ .build();
+ String actual =
+ TextFormat.printer()
+ .usingTypeRegistry(TypeRegistry.newBuilder().add(TestAllTypes.getDescriptor()).build())
+ .printToString(testAny);
+ String expected =
+ "type_url: \"type.googleapis.com/protobuf_unittest.TestAllTypes\"\n" + "value: \"test\"\n";
+ assertEquals(expected, actual);
+ }
+
+
+ public void testMergeAny_customBuiltTypeRegistry() throws Exception {
+ TestAny.Builder builder = TestAny.newBuilder();
+ TextFormat.Parser.newBuilder()
+ .setTypeRegistry(TypeRegistry.newBuilder().add(TestAllTypes.getDescriptor()).build())
+ .build()
+ .merge(
+ "value: {\n"
+ + "[type.googleapis.com/protobuf_unittest.TestAllTypes] {\n"
+ + "optional_int32: 12345\n"
+ + "optional_nested_message {\n"
+ + " bb: 123\n"
+ + "}\n"
+ + "}\n"
+ + "}",
+ builder);
+ assertEquals(
+ TestAny.newBuilder()
+ .setValue(
+ Any.newBuilder()
+ .setTypeUrl("type.googleapis.com/" + TestAllTypes.getDescriptor().getFullName())
+ .setValue(
+ TestAllTypes.newBuilder()
+ .setOptionalInt32(12345)
+ .setOptionalNestedMessage(
+ TestAllTypes.NestedMessage.newBuilder().setBb(123))
+ .build()
+ .toByteString())
+ .build())
+ .build(),
+ builder.build());
+ }
+
private void assertParseError(String error, String text) {
// Test merge().
diff --git a/java/core/src/test/java/com/google/protobuf/TypeRegistryTest.java b/java/core/src/test/java/com/google/protobuf/TypeRegistryTest.java
new file mode 100755
index 0000000..0cd9677
--- /dev/null
+++ b/java/core/src/test/java/com/google/protobuf/TypeRegistryTest.java
@@ -0,0 +1,70 @@
+// Protocol Buffers - Google's data interchange format
+// Copyright 2008 Google Inc. All rights reserved.
+// https://developers.google.com/protocol-buffers/
+//
+// Redistribution and use in source and binary forms, with or without
+// modification, are permitted provided that the following conditions are
+// met:
+//
+// * Redistributions of source code must retain the above copyright
+// notice, this list of conditions and the following disclaimer.
+// * Redistributions in binary form must reproduce the above
+// copyright notice, this list of conditions and the following disclaimer
+// in the documentation and/or other materials provided with the
+// distribution.
+// * Neither the name of Google Inc. nor the names of its
+// contributors may be used to endorse or promote products derived from
+// this software without specific prior written permission.
+//
+// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+
+package com.google.protobuf;
+
+import static org.junit.Assert.assertNull;
+import static org.junit.Assert.assertSame;
+
+import com.google.protobuf.Descriptors.Descriptor;
+import protobuf_unittest.UnittestProto;
+import org.junit.Test;
+import org.junit.runner.RunWith;
+import org.junit.runners.JUnit4;
+
+@RunWith(JUnit4.class)
+public final class TypeRegistryTest {
+
+ @Test
+ public void findDescriptorByFullName() throws Exception {
+ Descriptor descriptor = UnittestProto.TestAllTypes.getDescriptor();
+ assertNull(TypeRegistry.getEmptyTypeRegistry().find(descriptor.getFullName()));
+
+ assertSame(
+ descriptor,
+ TypeRegistry.newBuilder().add(descriptor).build().find(descriptor.getFullName()));
+ }
+
+ @Test
+ public void findDescriptorByTypeUrl() throws Exception {
+ Descriptor descriptor = UnittestProto.TestAllTypes.getDescriptor();
+ assertNull(
+ TypeRegistry.getEmptyTypeRegistry()
+ .getDescriptorForTypeUrl("type.googleapis.com/" + descriptor.getFullName()));
+
+ assertSame(
+ descriptor,
+ TypeRegistry.newBuilder()
+ .add(descriptor)
+ .build()
+ .getDescriptorForTypeUrl("type.googleapis.com/" + descriptor.getFullName()));
+ }
+
+}
diff --git a/java/core/src/test/proto/com/google/protobuf/test_extra_interfaces.proto b/java/core/src/test/proto/com/google/protobuf/test_extra_interfaces.proto
index 0a51fc4..d41b7a1 100644
--- a/java/core/src/test/proto/com/google/protobuf/test_extra_interfaces.proto
+++ b/java/core/src/test/proto/com/google/protobuf/test_extra_interfaces.proto
@@ -36,8 +36,6 @@
message Proto1 {
option experimental_java_message_interface =
"com.google.protobuf.ExtraInterfaces.HasBoolValue";
- option experimental_java_interface_extends =
- "com.google.protobuf.ExtraInterfaces.HasByteValue";
option experimental_java_message_interface =
"com.google.protobuf.ExtraInterfaces.HasStringValue<Proto1>";
option experimental_java_builder_interface =
diff --git a/java/lite/pom.xml b/java/lite/pom.xml
index f6e1c25..5079d96 100644
--- a/java/lite/pom.xml
+++ b/java/lite/pom.xml
@@ -224,6 +224,7 @@
<exclude>TextFormatParseLocationTest.java</exclude>
<exclude>TextFormatTest.java</exclude>
<exclude>TestUtil.java</exclude>
+ <exclude>TypeRegistryTest.java</exclude>
<exclude>UnknownEnumValueTest.java</exclude>
<exclude>UnknownFieldSetLiteTest.java</exclude>
<exclude>UnknownFieldSetTest.java</exclude>
diff --git a/java/util/src/main/java/com/google/protobuf/util/JsonFormat.java b/java/util/src/main/java/com/google/protobuf/util/JsonFormat.java
index bf2e28e..a6efcc2 100644
--- a/java/util/src/main/java/com/google/protobuf/util/JsonFormat.java
+++ b/java/util/src/main/java/com/google/protobuf/util/JsonFormat.java
@@ -108,15 +108,22 @@
*/
public static Printer printer() {
return new Printer(
- TypeRegistry.getEmptyTypeRegistry(), false, Collections.<FieldDescriptor>emptySet(),
- false, false, false, false);
+ com.google.protobuf.TypeRegistry.getEmptyTypeRegistry(),
+ TypeRegistry.getEmptyTypeRegistry(),
+ /* alwaysOutputDefaultValueFields */ false,
+ /* includingDefaultValueFields */ Collections.<FieldDescriptor>emptySet(),
+ /* preservingProtoFieldNames */ false,
+ /* omittingInsignificantWhitespace */ false,
+ /* printingEnumsAsInts */ false,
+ /* sortingMapKeys */ false);
}
/**
* A Printer converts protobuf message to JSON format.
*/
public static class Printer {
- private final TypeRegistry registry;
+ private final com.google.protobuf.TypeRegistry registry;
+ private final TypeRegistry oldRegistry;
// NOTE: There are 3 states for these *defaultValueFields variables:
// 1) Default - alwaysOutput is false & including is empty set. Fields only output if they are
// set to non-default values.
@@ -133,7 +140,8 @@
private final boolean sortingMapKeys;
private Printer(
- TypeRegistry registry,
+ com.google.protobuf.TypeRegistry registry,
+ TypeRegistry oldRegistry,
boolean alwaysOutputDefaultValueFields,
Set<FieldDescriptor> includingDefaultValueFields,
boolean preservingProtoFieldNames,
@@ -141,6 +149,7 @@
boolean printingEnumsAsInts,
boolean sortingMapKeys) {
this.registry = registry;
+ this.oldRegistry = oldRegistry;
this.alwaysOutputDefaultValueFields = alwaysOutputDefaultValueFields;
this.includingDefaultValueFields = includingDefaultValueFields;
this.preservingProtoFieldNames = preservingProtoFieldNames;
@@ -150,17 +159,41 @@
}
/**
- * Creates a new {@link Printer} using the given registry. The new Printer
- * clones all other configurations from the current {@link Printer}.
+ * Creates a new {@link Printer} using the given registry. The new Printer clones all other
+ * configurations from the current {@link Printer}.
*
* @throws IllegalArgumentException if a registry is already set.
*/
- public Printer usingTypeRegistry(TypeRegistry registry) {
- if (this.registry != TypeRegistry.getEmptyTypeRegistry()) {
+ public Printer usingTypeRegistry(TypeRegistry oldRegistry) {
+ if (this.oldRegistry != TypeRegistry.getEmptyTypeRegistry()
+ || this.registry != com.google.protobuf.TypeRegistry.getEmptyTypeRegistry()) {
+ throw new IllegalArgumentException("Only one registry is allowed.");
+ }
+ return new Printer(
+ com.google.protobuf.TypeRegistry.getEmptyTypeRegistry(),
+ oldRegistry,
+ alwaysOutputDefaultValueFields,
+ includingDefaultValueFields,
+ preservingProtoFieldNames,
+ omittingInsignificantWhitespace,
+ printingEnumsAsInts,
+ sortingMapKeys);
+ }
+
+ /**
+ * Creates a new {@link Printer} using the given registry. The new Printer clones all other
+ * configurations from the current {@link Printer}.
+ *
+ * @throws IllegalArgumentException if a registry is already set.
+ */
+ public Printer usingTypeRegistry(com.google.protobuf.TypeRegistry registry) {
+ if (this.oldRegistry != TypeRegistry.getEmptyTypeRegistry()
+ || this.registry != com.google.protobuf.TypeRegistry.getEmptyTypeRegistry()) {
throw new IllegalArgumentException("Only one registry is allowed.");
}
return new Printer(
registry,
+ oldRegistry,
alwaysOutputDefaultValueFields,
includingDefaultValueFields,
preservingProtoFieldNames,
@@ -179,6 +212,7 @@
checkUnsetIncludingDefaultValueFields();
return new Printer(
registry,
+ oldRegistry,
true,
Collections.<FieldDescriptor>emptySet(),
preservingProtoFieldNames,
@@ -197,6 +231,7 @@
checkUnsetPrintingEnumsAsInts();
return new Printer(
registry,
+ oldRegistry,
alwaysOutputDefaultValueFields,
Collections.<FieldDescriptor>emptySet(),
preservingProtoFieldNames,
@@ -226,6 +261,7 @@
checkUnsetIncludingDefaultValueFields();
return new Printer(
registry,
+ oldRegistry,
false,
Collections.unmodifiableSet(new HashSet<>(fieldsToAlwaysOutput)),
preservingProtoFieldNames,
@@ -250,6 +286,7 @@
public Printer preservingProtoFieldNames() {
return new Printer(
registry,
+ oldRegistry,
alwaysOutputDefaultValueFields,
includingDefaultValueFields,
true,
@@ -279,6 +316,7 @@
public Printer omittingInsignificantWhitespace() {
return new Printer(
registry,
+ oldRegistry,
alwaysOutputDefaultValueFields,
includingDefaultValueFields,
preservingProtoFieldNames,
@@ -302,6 +340,7 @@
public Printer sortingMapKeys() {
return new Printer(
registry,
+ oldRegistry,
alwaysOutputDefaultValueFields,
includingDefaultValueFields,
preservingProtoFieldNames,
@@ -322,6 +361,7 @@
// mobile.
new PrinterImpl(
registry,
+ oldRegistry,
alwaysOutputDefaultValueFields,
includingDefaultValueFields,
preservingProtoFieldNames,
@@ -354,37 +394,66 @@
* Creates a {@link Parser} with default configuration.
*/
public static Parser parser() {
- return new Parser(TypeRegistry.getEmptyTypeRegistry(), false, Parser.DEFAULT_RECURSION_LIMIT);
+ return new Parser(
+ com.google.protobuf.TypeRegistry.getEmptyTypeRegistry(),
+ TypeRegistry.getEmptyTypeRegistry(),
+ false,
+ Parser.DEFAULT_RECURSION_LIMIT);
}
/**
* A Parser parses JSON to protobuf message.
*/
public static class Parser {
- private final TypeRegistry registry;
+ private final com.google.protobuf.TypeRegistry registry;
+ private final TypeRegistry oldRegistry;
private final boolean ignoringUnknownFields;
private final int recursionLimit;
// The default parsing recursion limit is aligned with the proto binary parser.
private static final int DEFAULT_RECURSION_LIMIT = 100;
- private Parser(TypeRegistry registry, boolean ignoreUnknownFields, int recursionLimit) {
+ private Parser(
+ com.google.protobuf.TypeRegistry registry,
+ TypeRegistry oldRegistry,
+ boolean ignoreUnknownFields,
+ int recursionLimit) {
this.registry = registry;
+ this.oldRegistry = oldRegistry;
this.ignoringUnknownFields = ignoreUnknownFields;
this.recursionLimit = recursionLimit;
}
/**
- * Creates a new {@link Parser} using the given registry. The new Parser
- * clones all other configurations from this Parser.
+ * Creates a new {@link Parser} using the given registry. The new Parser clones all other
+ * configurations from this Parser.
*
* @throws IllegalArgumentException if a registry is already set.
*/
- public Parser usingTypeRegistry(TypeRegistry registry) {
- if (this.registry != TypeRegistry.getEmptyTypeRegistry()) {
+ public Parser usingTypeRegistry(TypeRegistry oldRegistry) {
+ if (this.oldRegistry != TypeRegistry.getEmptyTypeRegistry()
+ || this.registry != com.google.protobuf.TypeRegistry.getEmptyTypeRegistry()) {
throw new IllegalArgumentException("Only one registry is allowed.");
}
- return new Parser(registry, ignoringUnknownFields, recursionLimit);
+ return new Parser(
+ com.google.protobuf.TypeRegistry.getEmptyTypeRegistry(),
+ oldRegistry,
+ ignoringUnknownFields,
+ recursionLimit);
+ }
+
+ /**
+ * Creates a new {@link Parser} using the given registry. The new Parser clones all other
+ * configurations from this Parser.
+ *
+ * @throws IllegalArgumentException if a registry is already set.
+ */
+ public Parser usingTypeRegistry(com.google.protobuf.TypeRegistry registry) {
+ if (this.oldRegistry != TypeRegistry.getEmptyTypeRegistry()
+ || this.registry != com.google.protobuf.TypeRegistry.getEmptyTypeRegistry()) {
+ throw new IllegalArgumentException("Only one registry is allowed.");
+ }
+ return new Parser(registry, oldRegistry, ignoringUnknownFields, recursionLimit);
}
/**
@@ -392,7 +461,7 @@
* encountered. The new Parser clones all other configurations from this Parser.
*/
public Parser ignoringUnknownFields() {
- return new Parser(this.registry, true, recursionLimit);
+ return new Parser(this.registry, oldRegistry, true, recursionLimit);
}
/**
@@ -404,7 +473,8 @@
public void merge(String json, Message.Builder builder) throws InvalidProtocolBufferException {
// TODO(xiaofeng): Investigate the allocation overhead and optimize for
// mobile.
- new ParserImpl(registry, ignoringUnknownFields, recursionLimit).merge(json, builder);
+ new ParserImpl(registry, oldRegistry, ignoringUnknownFields, recursionLimit)
+ .merge(json, builder);
}
/**
@@ -417,12 +487,13 @@
public void merge(Reader json, Message.Builder builder) throws IOException {
// TODO(xiaofeng): Investigate the allocation overhead and optimize for
// mobile.
- new ParserImpl(registry, ignoringUnknownFields, recursionLimit).merge(json, builder);
+ new ParserImpl(registry, oldRegistry, ignoringUnknownFields, recursionLimit)
+ .merge(json, builder);
}
// For testing only.
Parser usingRecursionLimit(int recursionLimit) {
- return new Parser(registry, ignoringUnknownFields, recursionLimit);
+ return new Parser(registry, oldRegistry, ignoringUnknownFields, recursionLimit);
}
}
@@ -478,7 +549,7 @@
@CanIgnoreReturnValue
public Builder add(Descriptor messageType) {
if (types == null) {
- throw new IllegalStateException("A TypeRegistry.Builer can only be used once.");
+ throw new IllegalStateException("A TypeRegistry.Builder can only be used once.");
}
addFile(messageType.getFile());
return this;
@@ -641,7 +712,8 @@
* A Printer converts protobuf messages to JSON format.
*/
private static final class PrinterImpl {
- private final TypeRegistry registry;
+ private final com.google.protobuf.TypeRegistry registry;
+ private final TypeRegistry oldRegistry;
private final boolean alwaysOutputDefaultValueFields;
private final Set<FieldDescriptor> includingDefaultValueFields;
private final boolean preservingProtoFieldNames;
@@ -658,7 +730,8 @@
}
PrinterImpl(
- TypeRegistry registry,
+ com.google.protobuf.TypeRegistry registry,
+ TypeRegistry oldRegistry,
boolean alwaysOutputDefaultValueFields,
Set<FieldDescriptor> includingDefaultValueFields,
boolean preservingProtoFieldNames,
@@ -667,6 +740,7 @@
boolean printingEnumsAsInts,
boolean sortingMapKeys) {
this.registry = registry;
+ this.oldRegistry = oldRegistry;
this.alwaysOutputDefaultValueFields = alwaysOutputDefaultValueFields;
this.includingDefaultValueFields = includingDefaultValueFields;
this.preservingProtoFieldNames = preservingProtoFieldNames;
@@ -807,7 +881,10 @@
String typeUrl = (String) message.getField(typeUrlField);
Descriptor type = registry.getDescriptorForTypeUrl(typeUrl);
if (type == null) {
- throw new InvalidProtocolBufferException("Cannot find type for url: " + typeUrl);
+ type = oldRegistry.getDescriptorForTypeUrl(typeUrl);
+ if (type == null) {
+ throw new InvalidProtocolBufferException("Cannot find type for url: " + typeUrl);
+ }
}
ByteString content = (ByteString) message.getField(valueField);
Message contentMessage =
@@ -1218,14 +1295,20 @@
}
private static class ParserImpl {
- private final TypeRegistry registry;
+ private final com.google.protobuf.TypeRegistry registry;
+ private final TypeRegistry oldRegistry;
private final JsonParser jsonParser;
private final boolean ignoringUnknownFields;
private final int recursionLimit;
private int currentDepth;
- ParserImpl(TypeRegistry registry, boolean ignoreUnknownFields, int recursionLimit) {
+ ParserImpl(
+ com.google.protobuf.TypeRegistry registry,
+ TypeRegistry oldRegistry,
+ boolean ignoreUnknownFields,
+ int recursionLimit) {
this.registry = registry;
+ this.oldRegistry = oldRegistry;
this.ignoringUnknownFields = ignoreUnknownFields;
this.jsonParser = new JsonParser();
this.recursionLimit = recursionLimit;
@@ -1448,7 +1531,10 @@
String typeUrl = typeUrlElement.getAsString();
Descriptor contentType = registry.getDescriptorForTypeUrl(typeUrl);
if (contentType == null) {
- throw new InvalidProtocolBufferException("Cannot resolve type: " + typeUrl);
+ contentType = oldRegistry.getDescriptorForTypeUrl(typeUrl);
+ if (contentType == null) {
+ throw new InvalidProtocolBufferException("Cannot resolve type: " + typeUrl);
+ }
}
builder.setField(typeUrlField, typeUrl);
Message.Builder contentBuilder =
diff --git a/java/util/src/test/java/com/google/protobuf/util/JsonFormatTest.java b/java/util/src/test/java/com/google/protobuf/util/JsonFormatTest.java
index 04080ea..2c46ecd 100644
--- a/java/util/src/test/java/com/google/protobuf/util/JsonFormatTest.java
+++ b/java/util/src/test/java/com/google/protobuf/util/JsonFormatTest.java
@@ -152,6 +152,16 @@
assertEquals(message.toString(), parsedMessage.toString());
}
+ private void assertRoundTripEquals(Message message, com.google.protobuf.TypeRegistry registry)
+ throws Exception {
+ JsonFormat.Printer printer = JsonFormat.printer().usingTypeRegistry(registry);
+ JsonFormat.Parser parser = JsonFormat.parser().usingTypeRegistry(registry);
+ Message.Builder builder = message.newBuilderForType();
+ parser.merge(printer.print(message), builder);
+ Message parsedMessage = builder.build();
+ assertEquals(message.toString(), parsedMessage.toString());
+ }
+
private String toJsonString(Message message) throws IOException {
return JsonFormat.printer().print(message);
}
@@ -850,6 +860,45 @@
}
+ public void testAnyFieldsWithCustomAddedTypeRegistry() throws Exception {
+ TestAllTypes content = TestAllTypes.newBuilder().setOptionalInt32(1234).build();
+ TestAny message = TestAny.newBuilder().setAnyValue(Any.pack(content)).build();
+
+ com.google.protobuf.TypeRegistry registry =
+ com.google.protobuf.TypeRegistry.newBuilder().add(content.getDescriptorForType()).build();
+ JsonFormat.Printer printer = JsonFormat.printer().usingTypeRegistry(registry);
+
+ assertEquals(
+ "{\n"
+ + " \"anyValue\": {\n"
+ + " \"@type\": \"type.googleapis.com/json_test.TestAllTypes\",\n"
+ + " \"optionalInt32\": 1234\n"
+ + " }\n"
+ + "}",
+ printer.print(message));
+ assertRoundTripEquals(message, registry);
+
+ TestAny messageWithDefaultAnyValue =
+ TestAny.newBuilder().setAnyValue(Any.getDefaultInstance()).build();
+ assertEquals("{\n" + " \"anyValue\": {}\n" + "}", printer.print(messageWithDefaultAnyValue));
+ assertRoundTripEquals(messageWithDefaultAnyValue, registry);
+
+ // Well-known types have a special formatting when embedded in Any.
+ //
+ // 1. Any in Any.
+ Any anyMessage = Any.pack(Any.pack(content));
+ assertEquals(
+ "{\n"
+ + " \"@type\": \"type.googleapis.com/google.protobuf.Any\",\n"
+ + " \"value\": {\n"
+ + " \"@type\": \"type.googleapis.com/json_test.TestAllTypes\",\n"
+ + " \"optionalInt32\": 1234\n"
+ + " }\n"
+ + "}",
+ printer.print(anyMessage));
+ assertRoundTripEquals(anyMessage, registry);
+ }
+
public void testAnyFields() throws Exception {
TestAllTypes content = TestAllTypes.newBuilder().setOptionalInt32(1234).build();
TestAny message = TestAny.newBuilder().setAnyValue(Any.pack(content)).build();
@@ -1136,7 +1185,7 @@
Any.Builder builder = Any.newBuilder();
mergeFromJson(
"{\n"
- + " \"@type\": \"type.googleapis.com/json_test.TestAllTypes\",\n"
+ + " \"@type\": \"type.googleapis.com/json_test.UnexpectedTypes\",\n"
+ " \"optionalInt32\": 12345\n"
+ "}",
builder);
diff --git a/js/binary/decoder.js b/js/binary/decoder.js
index d47c20e..45cf611 100644
--- a/js/binary/decoder.js
+++ b/js/binary/decoder.js
@@ -247,20 +247,6 @@
this.cursor_ = 0;
/**
- * Temporary storage for the low 32 bits of 64-bit data types that we're
- * decoding.
- * @private {number}
- */
- this.tempLow_ = 0;
-
- /**
- * Temporary storage for the high 32 bits of 64-bit data types that we're
- * decoding.
- * @private {number}
- */
- this.tempHigh_ = 0;
-
- /**
* Set to true if this decoder encountered an error due to corrupt data.
* @private {boolean}
*/
@@ -442,9 +428,9 @@
/**
- * Reads an unsigned varint from the binary stream and stores it as a split
- * 64-bit integer. Since this does not convert the value to a number, no
- * precision is lost.
+ * Reads an unsigned varint from the binary stream and invokes the conversion
+ * function with the value in two signed 32 bit integers to produce the result.
+ * Since this does not convert the value to a number, no precision is lost.
*
* It's possible for an unsigned varint to be incorrectly encoded - more than
* 64 bits' worth of data could be present. If this happens, this method will
@@ -454,46 +440,42 @@
* details on the format, see
* https://developers.google.com/protocol-buffers/docs/encoding
*
- * @private
+ * @param {function(number, number): T} convert Conversion function to produce
+ * the result value, takes parameters (lowBits, highBits).
+ * @return {T}
+ * @template T
*/
-jspb.BinaryDecoder.prototype.readSplitVarint64_ = function() {
- var temp;
+jspb.BinaryDecoder.prototype.readSplitVarint64 = function(convert) {
+ var temp = 128;
var lowBits = 0;
var highBits = 0;
// Read the first four bytes of the varint, stopping at the terminator if we
// see it.
- for (var i = 0; i < 4; i++) {
+ for (var i = 0; i < 4 && temp >= 128; i++) {
temp = this.bytes_[this.cursor_++];
lowBits |= (temp & 0x7F) << (i * 7);
- if (temp < 128) {
- this.tempLow_ = lowBits >>> 0;
- this.tempHigh_ = 0;
- return;
- }
}
- // Read the fifth byte, which straddles the low and high dwords.
- temp = this.bytes_[this.cursor_++];
- lowBits |= (temp & 0x7F) << 28;
- highBits |= (temp & 0x7F) >> 4;
- if (temp < 128) {
- this.tempLow_ = lowBits >>> 0;
- this.tempHigh_ = highBits >>> 0;
- return;
- }
-
- // Read the sixth through tenth byte.
- for (var i = 0; i < 5; i++) {
+ if (temp >= 128) {
+ // Read the fifth byte, which straddles the low and high dwords.
temp = this.bytes_[this.cursor_++];
- highBits |= (temp & 0x7F) << (i * 7 + 3);
- if (temp < 128) {
- this.tempLow_ = lowBits >>> 0;
- this.tempHigh_ = highBits >>> 0;
- return;
+ lowBits |= (temp & 0x7F) << 28;
+ highBits |= (temp & 0x7F) >> 4;
+ }
+
+ if (temp >= 128) {
+ // Read the sixth through tenth byte.
+ for (var i = 0; i < 5 && temp >= 128; i++) {
+ temp = this.bytes_[this.cursor_++];
+ highBits |= (temp & 0x7F) << (i * 7 + 3);
}
}
+ if (temp < 128) {
+ return convert(lowBits >>> 0, highBits >>> 0);
+ }
+
// If we did not see the terminator, the encoding was invalid.
goog.asserts.fail('Failed to read varint, encoding is invalid.');
this.error_ = true;
@@ -501,6 +483,30 @@
/**
+ * Reads a 64-bit fixed-width value from the stream and invokes the conversion
+ * function with the value in two signed 32 bit integers to produce the result.
+ * Since this does not convert the value to a number, no precision is lost.
+ *
+ * @param {function(number, number): T} convert Conversion function to produce
+ * the result value, takes parameters (lowBits, highBits).
+ * @return {T}
+ * @template T
+ */
+jspb.BinaryDecoder.prototype.readSplitFixed64 = function(convert) {
+ var bytes = this.bytes_;
+ var cursor = this.cursor_;
+ this.cursor_ += 8;
+ var lowBits = 0;
+ var highBits = 0;
+ for (var i = cursor + 7; i >= cursor; i--) {
+ lowBits = (lowBits << 8) | bytes[i];
+ highBits = (highBits << 8) | bytes[i + 4];
+ }
+ return convert(lowBits, highBits);
+};
+
+
+/**
* Skips over a varint in the block without decoding it.
*/
jspb.BinaryDecoder.prototype.skipVarint = function() {
@@ -668,8 +674,7 @@
* integer exceeds 2^53.
*/
jspb.BinaryDecoder.prototype.readUnsignedVarint64 = function() {
- this.readSplitVarint64_();
- return jspb.utils.joinUint64(this.tempLow_, this.tempHigh_);
+ return this.readSplitVarint64(jspb.utils.joinUint64);
};
@@ -680,8 +685,7 @@
* @return {string} The decoded unsigned varint as a decimal string.
*/
jspb.BinaryDecoder.prototype.readUnsignedVarint64String = function() {
- this.readSplitVarint64_();
- return jspb.utils.joinUnsignedDecimalString(this.tempLow_, this.tempHigh_);
+ return this.readSplitVarint64(jspb.utils.joinUnsignedDecimalString);
};
@@ -694,8 +698,7 @@
* integer exceeds 2^53.
*/
jspb.BinaryDecoder.prototype.readSignedVarint64 = function() {
- this.readSplitVarint64_();
- return jspb.utils.joinInt64(this.tempLow_, this.tempHigh_);
+ return this.readSplitVarint64(jspb.utils.joinInt64);
};
@@ -706,8 +709,7 @@
* @return {string} The decoded signed varint as a decimal string.
*/
jspb.BinaryDecoder.prototype.readSignedVarint64String = function() {
- this.readSplitVarint64_();
- return jspb.utils.joinSignedDecimalString(this.tempLow_, this.tempHigh_);
+ return this.readSplitVarint64(jspb.utils.joinSignedDecimalString);
};
@@ -725,8 +727,7 @@
* integer exceeds 2^53.
*/
jspb.BinaryDecoder.prototype.readZigzagVarint64 = function() {
- this.readSplitVarint64_();
- return jspb.utils.joinZigzag64(this.tempLow_, this.tempHigh_);
+ return this.readSplitVarint64(jspb.utils.joinZigzag64);
};
@@ -1039,8 +1040,7 @@
* @return {string} The hash value.
*/
jspb.BinaryDecoder.prototype.readVarintHash64 = function() {
- this.readSplitVarint64_();
- return jspb.utils.joinHash64(this.tempLow_, this.tempHigh_);
+ return this.readSplitVarint64(jspb.utils.joinHash64);
};
diff --git a/js/binary/decoder_test.js b/js/binary/decoder_test.js
index 15a71d7..c5be805 100644
--- a/js/binary/decoder_test.js
+++ b/js/binary/decoder_test.js
@@ -45,6 +45,7 @@
goog.require('jspb.BinaryConstants');
goog.require('jspb.BinaryDecoder');
goog.require('jspb.BinaryEncoder');
+goog.require('jspb.utils');
/**
@@ -172,11 +173,9 @@
});
- /**
- * Tests reading 64-bit integers as hash strings.
- */
- it('testHashStrings', function() {
- var encoder = new jspb.BinaryEncoder();
+ describe('varint64', function() {
+ var /** !jspb.BinaryEncoder */ encoder;
+ var /** !jspb.BinaryDecoder */ decoder;
var hashA = String.fromCharCode(0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00);
@@ -186,28 +185,54 @@
0x87, 0x65, 0x43, 0x21);
var hashD = String.fromCharCode(0xFF, 0xFF, 0xFF, 0xFF,
0xFF, 0xFF, 0xFF, 0xFF);
+ beforeEach(function() {
+ encoder = new jspb.BinaryEncoder();
- encoder.writeVarintHash64(hashA);
- encoder.writeVarintHash64(hashB);
- encoder.writeVarintHash64(hashC);
- encoder.writeVarintHash64(hashD);
+ encoder.writeVarintHash64(hashA);
+ encoder.writeVarintHash64(hashB);
+ encoder.writeVarintHash64(hashC);
+ encoder.writeVarintHash64(hashD);
- encoder.writeFixedHash64(hashA);
- encoder.writeFixedHash64(hashB);
- encoder.writeFixedHash64(hashC);
- encoder.writeFixedHash64(hashD);
+ encoder.writeFixedHash64(hashA);
+ encoder.writeFixedHash64(hashB);
+ encoder.writeFixedHash64(hashC);
+ encoder.writeFixedHash64(hashD);
- var decoder = jspb.BinaryDecoder.alloc(encoder.end());
+ decoder = jspb.BinaryDecoder.alloc(encoder.end());
+ });
- assertEquals(hashA, decoder.readVarintHash64());
- assertEquals(hashB, decoder.readVarintHash64());
- assertEquals(hashC, decoder.readVarintHash64());
- assertEquals(hashD, decoder.readVarintHash64());
+ it('reads 64-bit integers as hash strings', function() {
+ assertEquals(hashA, decoder.readVarintHash64());
+ assertEquals(hashB, decoder.readVarintHash64());
+ assertEquals(hashC, decoder.readVarintHash64());
+ assertEquals(hashD, decoder.readVarintHash64());
- assertEquals(hashA, decoder.readFixedHash64());
- assertEquals(hashB, decoder.readFixedHash64());
- assertEquals(hashC, decoder.readFixedHash64());
- assertEquals(hashD, decoder.readFixedHash64());
+ assertEquals(hashA, decoder.readFixedHash64());
+ assertEquals(hashB, decoder.readFixedHash64());
+ assertEquals(hashC, decoder.readFixedHash64());
+ assertEquals(hashD, decoder.readFixedHash64());
+ });
+
+ it('reads split 64 bit integers', function() {
+ function hexJoin(bitsLow, bitsHigh) {
+ return `0x${(bitsHigh >>> 0).toString(16)}:0x${
+ (bitsLow >>> 0).toString(16)}`;
+ }
+ function hexJoinHash(hash64) {
+ jspb.utils.splitHash64(hash64);
+ return hexJoin(jspb.utils.split64Low, jspb.utils.split64High);
+ }
+
+ expect(decoder.readSplitVarint64(hexJoin)).toEqual(hexJoinHash(hashA));
+ expect(decoder.readSplitVarint64(hexJoin)).toEqual(hexJoinHash(hashB));
+ expect(decoder.readSplitVarint64(hexJoin)).toEqual(hexJoinHash(hashC));
+ expect(decoder.readSplitVarint64(hexJoin)).toEqual(hexJoinHash(hashD));
+
+ expect(decoder.readSplitFixed64(hexJoin)).toEqual(hexJoinHash(hashA));
+ expect(decoder.readSplitFixed64(hexJoin)).toEqual(hexJoinHash(hashB));
+ expect(decoder.readSplitFixed64(hexJoin)).toEqual(hexJoinHash(hashC));
+ expect(decoder.readSplitFixed64(hexJoin)).toEqual(hexJoinHash(hashD));
+ });
});
/**
diff --git a/js/binary/reader.js b/js/binary/reader.js
index 91c7b6d..d1ab407 100644
--- a/js/binary/reader.js
+++ b/js/binary/reader.js
@@ -955,6 +955,23 @@
/**
+ * Reads a 64-bit varint field from the stream and invokes `convert` to produce
+ * the return value, or throws an error if the next field in the stream is not
+ * of the correct wire type.
+ *
+ * @param {function(number, number): T} convert Conversion function to produce
+ * the result value, takes parameters (lowBits, highBits).
+ * @return {T}
+ * @template T
+ */
+jspb.BinaryReader.prototype.readSplitVarint64 = function(convert) {
+ goog.asserts.assert(
+ this.nextWireType_ == jspb.BinaryConstants.WireType.VARINT);
+ return this.decoder_.readSplitVarint64(convert);
+};
+
+
+/**
* Reads a 64-bit varint or fixed64 field from the stream and returns it as a
* 8-character Unicode string for use as a hash table key, or throws an error
* if the next field in the stream is not of the correct wire type.
@@ -969,6 +986,23 @@
/**
+ * Reads a 64-bit fixed64 field from the stream and invokes `convert`
+ * to produce the return value, or throws an error if the next field in the
+ * stream is not of the correct wire type.
+ *
+ * @param {function(number, number): T} convert Conversion function to produce
+ * the result value, takes parameters (lowBits, highBits).
+ * @return {T}
+ * @template T
+ */
+jspb.BinaryReader.prototype.readSplitFixed64 = function(convert) {
+ goog.asserts.assert(
+ this.nextWireType_ == jspb.BinaryConstants.WireType.FIXED64);
+ return this.decoder_.readSplitFixed64(convert);
+};
+
+
+/**
* Reads a packed scalar field using the supplied raw reader function.
* @param {function(this:jspb.BinaryDecoder)} decodeMethod
* @return {!Array}
diff --git a/js/binary/reader_test.js b/js/binary/reader_test.js
index eb2af0a..618e9ad 100644
--- a/js/binary/reader_test.js
+++ b/js/binary/reader_test.js
@@ -407,6 +407,26 @@
-6, '08 8B 80 80 80 80 80 80 80 80 00');
});
+ /**
+ * Tests reading 64-bit integers as split values.
+ */
+ it('handles split 64 fields', function() {
+ var writer = new jspb.BinaryWriter();
+ writer.writeInt64String(1, '4294967296');
+ writer.writeSfixed64String(2, '4294967298');
+ var reader = jspb.BinaryReader.alloc(writer.getResultBuffer());
+
+ function rejoin(lowBits, highBits) {
+ return highBits * 2 ** 32 + (lowBits >>> 0);
+ }
+ reader.nextField();
+ expect(reader.getFieldNumber()).toEqual(1);
+ expect(reader.readSplitVarint64(rejoin)).toEqual(0x100000000);
+
+ reader.nextField();
+ expect(reader.getFieldNumber()).toEqual(2);
+ expect(reader.readSplitFixed64(rejoin)).toEqual(0x100000002);
+ });
/**
* Tests 64-bit fields that are handled as strings.
diff --git a/js/binary/utils.js b/js/binary/utils.js
index 173c416..0cf0ef0 100644
--- a/js/binary/utils.js
+++ b/js/binary/utils.js
@@ -428,7 +428,6 @@
return String.fromCharCode(a, b, c, d, e, f, g, h);
};
-
/**
* Individual digits for number->string conversion.
* @const {!Array<string>}
@@ -438,6 +437,11 @@
'8', '9', 'a', 'b', 'c', 'd', 'e', 'f'
];
+/** @const @private {number} '0' */
+jspb.utils.ZERO_CHAR_CODE_ = 48;
+
+/** @const @private {number} 'a' */
+jspb.utils.A_CHAR_CODE_ = 97;
/**
* Losslessly converts a 64-bit unsigned integer in 32:32 split representation
@@ -487,27 +491,20 @@
digitB %= base;
}
- // Convert base-1e7 digits to base-10, omitting leading zeroes.
- var table = jspb.utils.DIGITS;
- var start = false;
- var result = '';
-
- function emit(digit) {
- var temp = base;
- for (var i = 0; i < 7; i++) {
- temp /= 10;
- var decimalDigit = ((digit / temp) % 10) >>> 0;
- if ((decimalDigit == 0) && !start) continue;
- start = true;
- result += table[decimalDigit];
+ // Convert base-1e7 digits to base-10, with optional leading zeroes.
+ function decimalFrom1e7(digit1e7, needLeadingZeros) {
+ var partial = digit1e7 ? String(digit1e7) : '';
+ if (needLeadingZeros) {
+ return '0000000'.slice(partial.length) + partial;
}
+ return partial;
}
- if (digitC || start) emit(digitC);
- if (digitB || start) emit(digitB);
- if (digitA || start) emit(digitA);
-
- return result;
+ return decimalFrom1e7(digitC, /*needLeadingZeros=*/ 0) +
+ decimalFrom1e7(digitB, /*needLeadingZeros=*/ digitC) +
+ // If the final 1e7 digit didn't need leading zeros, we would have
+ // returned via the trivial code path at the top.
+ decimalFrom1e7(digitA, /*needLeadingZeros=*/ 1);
};
@@ -605,7 +602,7 @@
// For each decimal digit, set result to 10*result + digit.
for (var i = 0; i < dec.length; i++) {
- muladd(10, jspb.utils.DIGITS.indexOf(dec[i]));
+ muladd(10, dec.charCodeAt(i) - jspb.utils.ZERO_CHAR_CODE_);
}
// If there's a minus sign, convert into two's complement.
@@ -627,6 +624,28 @@
jspb.utils.splitHash64(jspb.utils.decimalStringToHash64(value));
};
+/**
+ * @param {number} nibble A 4-bit integer.
+ * @return {string}
+ * @private
+ */
+jspb.utils.toHexDigit_ = function(nibble) {
+ return String.fromCharCode(
+ nibble < 10 ? jspb.utils.ZERO_CHAR_CODE_ + nibble :
+ jspb.utils.A_CHAR_CODE_ - 10 + nibble);
+};
+
+/**
+ * @param {number} hexCharCode
+ * @return {number}
+ * @private
+ */
+jspb.utils.fromHexCharCode_ = function(hexCharCode) {
+ if (hexCharCode >= jspb.utils.A_CHAR_CODE_) {
+ return hexCharCode - jspb.utils.A_CHAR_CODE_ + 10;
+ }
+ return hexCharCode - jspb.utils.ZERO_CHAR_CODE_;
+};
/**
* Converts an 8-character hash string into its hexadecimal representation.
@@ -640,8 +659,8 @@
for (var i = 0; i < 8; i++) {
var c = hash.charCodeAt(7 - i);
- temp[i * 2 + 2] = jspb.utils.DIGITS[c >> 4];
- temp[i * 2 + 3] = jspb.utils.DIGITS[c & 0xF];
+ temp[i * 2 + 2] = jspb.utils.toHexDigit_(c >> 4);
+ temp[i * 2 + 3] = jspb.utils.toHexDigit_(c & 0xF);
}
var result = temp.join('');
@@ -662,8 +681,8 @@
var result = '';
for (var i = 0; i < 8; i++) {
- var hi = jspb.utils.DIGITS.indexOf(hex[i * 2 + 2]);
- var lo = jspb.utils.DIGITS.indexOf(hex[i * 2 + 3]);
+ var hi = jspb.utils.fromHexCharCode_(hex.charCodeAt(i * 2 + 2));
+ var lo = jspb.utils.fromHexCharCode_(hex.charCodeAt(i * 2 + 3));
result = String.fromCharCode(hi * 16 + lo) + result;
}
diff --git a/js/binary/utils_test.js b/js/binary/utils_test.js
index 1345064..d4c1ef7 100644
--- a/js/binary/utils_test.js
+++ b/js/binary/utils_test.js
@@ -38,7 +38,6 @@
goog.require('goog.crypt');
goog.require('goog.crypt.base64');
-goog.require('goog.testing.asserts');
goog.require('jspb.BinaryConstants');
goog.require('jspb.BinaryWriter');
goog.require('jspb.utils');
@@ -82,36 +81,36 @@
// Check some magic numbers.
var result =
jspb.utils.joinUnsignedDecimalString(0x89e80001, 0x8ac72304);
- assertEquals('10000000000000000001', result);
+ expect(result).toEqual('10000000000000000001');
result = jspb.utils.joinUnsignedDecimalString(0xacd05f15, 0x1b69b4b);
- assertEquals('123456789123456789', result);
+ expect(result).toEqual('123456789123456789');
result = jspb.utils.joinUnsignedDecimalString(0xeb1f0ad2, 0xab54a98c);
- assertEquals('12345678901234567890', result);
+ expect(result).toEqual('12345678901234567890');
result = jspb.utils.joinUnsignedDecimalString(0xe3b70cb1, 0x891087b8);
- assertEquals('9876543210987654321', result);
+ expect(result).toEqual('9876543210987654321');
// Check limits.
result = jspb.utils.joinUnsignedDecimalString(0x00000000, 0x00000000);
- assertEquals('0', result);
+ expect(result).toEqual('0');
result = jspb.utils.joinUnsignedDecimalString(0xFFFFFFFF, 0xFFFFFFFF);
- assertEquals('18446744073709551615', result);
+ expect(result).toEqual('18446744073709551615');
// Check each bit of the low dword.
for (var i = 0; i < 32; i++) {
var low = (1 << i) >>> 0;
result = jspb.utils.joinUnsignedDecimalString(low, 0);
- assertEquals('' + Math.pow(2, i), result);
+ expect(result).toEqual('' + Math.pow(2, i));
}
// Check the first 20 bits of the high dword.
for (var i = 0; i < 20; i++) {
var high = (1 << i) >>> 0;
result = jspb.utils.joinUnsignedDecimalString(0, high);
- assertEquals('' + Math.pow(2, 32 + i), result);
+ expect(result).toEqual('' + Math.pow(2, 32 + i));
}
// V8's internal double-to-string conversion is inaccurate for values above
@@ -119,40 +118,40 @@
// manually against the correct string representations of 2^N.
result = jspb.utils.joinUnsignedDecimalString(0x00000000, 0x00100000);
- assertEquals('4503599627370496', result);
+ expect(result).toEqual('4503599627370496');
result = jspb.utils.joinUnsignedDecimalString(0x00000000, 0x00200000);
- assertEquals('9007199254740992', result);
+ expect(result).toEqual('9007199254740992');
result = jspb.utils.joinUnsignedDecimalString(0x00000000, 0x00400000);
- assertEquals('18014398509481984', result);
+ expect(result).toEqual('18014398509481984');
result = jspb.utils.joinUnsignedDecimalString(0x00000000, 0x00800000);
- assertEquals('36028797018963968', result);
+ expect(result).toEqual('36028797018963968');
result = jspb.utils.joinUnsignedDecimalString(0x00000000, 0x01000000);
- assertEquals('72057594037927936', result);
+ expect(result).toEqual('72057594037927936');
result = jspb.utils.joinUnsignedDecimalString(0x00000000, 0x02000000);
- assertEquals('144115188075855872', result);
+ expect(result).toEqual('144115188075855872');
result = jspb.utils.joinUnsignedDecimalString(0x00000000, 0x04000000);
- assertEquals('288230376151711744', result);
+ expect(result).toEqual('288230376151711744');
result = jspb.utils.joinUnsignedDecimalString(0x00000000, 0x08000000);
- assertEquals('576460752303423488', result);
+ expect(result).toEqual('576460752303423488');
result = jspb.utils.joinUnsignedDecimalString(0x00000000, 0x10000000);
- assertEquals('1152921504606846976', result);
+ expect(result).toEqual('1152921504606846976');
result = jspb.utils.joinUnsignedDecimalString(0x00000000, 0x20000000);
- assertEquals('2305843009213693952', result);
+ expect(result).toEqual('2305843009213693952');
result = jspb.utils.joinUnsignedDecimalString(0x00000000, 0x40000000);
- assertEquals('4611686018427387904', result);
+ expect(result).toEqual('4611686018427387904');
result = jspb.utils.joinUnsignedDecimalString(0x00000000, 0x80000000);
- assertEquals('9223372036854775808', result);
+ expect(result).toEqual('9223372036854775808');
});
@@ -164,38 +163,38 @@
var convert = jspb.utils.hash64ToDecimalString;
result = convert(toHashString(0x00000000, 0x00000000), false);
- assertEquals('0', result);
+ expect(result).toEqual('0');
result = convert(toHashString(0x00000000, 0x00000000), true);
- assertEquals('0', result);
+ expect(result).toEqual('0');
result = convert(toHashString(0xFFFFFFFF, 0xFFFFFFFF), false);
- assertEquals('18446744073709551615', result);
+ expect(result).toEqual('18446744073709551615');
result = convert(toHashString(0xFFFFFFFF, 0xFFFFFFFF), true);
- assertEquals('-1', result);
+ expect(result).toEqual('-1');
result = convert(toHashString(0x00000000, 0x80000000), false);
- assertEquals('9223372036854775808', result);
+ expect(result).toEqual('9223372036854775808');
result = convert(toHashString(0x00000000, 0x80000000), true);
- assertEquals('-9223372036854775808', result);
+ expect(result).toEqual('-9223372036854775808');
result = convert(toHashString(0xacd05f15, 0x01b69b4b), false);
- assertEquals('123456789123456789', result);
+ expect(result).toEqual('123456789123456789');
result = convert(toHashString(~0xacd05f15 + 1, ~0x01b69b4b), true);
- assertEquals('-123456789123456789', result);
+ expect(result).toEqual('-123456789123456789');
// And converting arrays of hashes should work the same way.
result = jspb.utils.hash64ArrayToDecimalStrings([
toHashString(0xFFFFFFFF, 0xFFFFFFFF),
toHashString(0x00000000, 0x80000000),
toHashString(0xacd05f15, 0x01b69b4b)], false);
- assertEquals(3, result.length);
- assertEquals('18446744073709551615', result[0]);
- assertEquals('9223372036854775808', result[1]);
- assertEquals('123456789123456789', result[2]);
+ expect(result.length).toEqual(3);
+ expect(result[0]).toEqual('18446744073709551615');
+ expect(result[1]).toEqual('9223372036854775808');
+ expect(result[2]).toEqual('123456789123456789');
});
/*
@@ -206,32 +205,32 @@
var convert = jspb.utils.decimalStringToHash64;
result = convert('0');
- assertEquals(goog.crypt.byteArrayToString(
- [0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00]), result);
+ expect(result).toEqual(goog.crypt.byteArrayToString(
+ [0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00]));
result = convert('-1');
- assertEquals(goog.crypt.byteArrayToString(
- [0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF]), result);
+ expect(result).toEqual(goog.crypt.byteArrayToString(
+ [0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF]));
result = convert('18446744073709551615');
- assertEquals(goog.crypt.byteArrayToString(
- [0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF]), result);
+ expect(result).toEqual(goog.crypt.byteArrayToString(
+ [0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF]));
result = convert('9223372036854775808');
- assertEquals(goog.crypt.byteArrayToString(
- [0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x80]), result);
+ expect(result).toEqual(goog.crypt.byteArrayToString(
+ [0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x80]));
result = convert('-9223372036854775808');
- assertEquals(goog.crypt.byteArrayToString(
- [0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x80]), result);
+ expect(result).toEqual(goog.crypt.byteArrayToString(
+ [0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x80]));
result = convert('123456789123456789');
- assertEquals(goog.crypt.byteArrayToString(
- [0x15, 0x5F, 0xD0, 0xAC, 0x4B, 0x9B, 0xB6, 0x01]), result);
+ expect(result).toEqual(goog.crypt.byteArrayToString(
+ [0x15, 0x5F, 0xD0, 0xAC, 0x4B, 0x9B, 0xB6, 0x01]));
result = convert('-123456789123456789');
- assertEquals(goog.crypt.byteArrayToString(
- [0xEB, 0xA0, 0x2F, 0x53, 0xB4, 0x64, 0x49, 0xFE]), result);
+ expect(result).toEqual(goog.crypt.byteArrayToString(
+ [0xEB, 0xA0, 0x2F, 0x53, 0xB4, 0x64, 0x49, 0xFE]));
});
/**
@@ -242,13 +241,13 @@
var convert = jspb.utils.hash64ToHexString;
result = convert(toHashString(0x00000000, 0x00000000));
- assertEquals('0x0000000000000000', result);
+ expect(result).toEqual('0x0000000000000000');
result = convert(toHashString(0xFFFFFFFF, 0xFFFFFFFF));
- assertEquals('0xffffffffffffffff', result);
+ expect(result).toEqual('0xffffffffffffffff');
result = convert(toHashString(0x12345678, 0x9ABCDEF0));
- assertEquals('0x9abcdef012345678', result);
+ expect(result).toEqual('0x9abcdef012345678');
});
@@ -260,22 +259,22 @@
var convert = jspb.utils.hexStringToHash64;
result = convert('0x0000000000000000');
- assertEquals(goog.crypt.byteArrayToString(
- [0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00]), result);
+ expect(result).toEqual(goog.crypt.byteArrayToString(
+ [0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00]));
result = convert('0xffffffffffffffff');
- assertEquals(goog.crypt.byteArrayToString(
- [0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF]), result);
+ expect(result).toEqual(goog.crypt.byteArrayToString(
+ [0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF]));
// Hex string is big-endian, hash string is little-endian.
result = convert('0x123456789ABCDEF0');
- assertEquals(goog.crypt.byteArrayToString(
- [0xF0, 0xDE, 0xBC, 0x9A, 0x78, 0x56, 0x34, 0x12]), result);
+ expect(result).toEqual(goog.crypt.byteArrayToString(
+ [0xF0, 0xDE, 0xBC, 0x9A, 0x78, 0x56, 0x34, 0x12]));
// Capitalization should not matter.
result = convert('0x0000abcdefABCDEF');
- assertEquals(goog.crypt.byteArrayToString(
- [0xEF, 0xCD, 0xAB, 0xEF, 0xCD, 0xAB, 0x00, 0x00]), result);
+ expect(result).toEqual(goog.crypt.byteArrayToString(
+ [0xEF, 0xCD, 0xAB, 0xEF, 0xCD, 0xAB, 0x00, 0x00]));
});
@@ -288,25 +287,25 @@
var convert = jspb.utils.numberToHash64;
result = convert(0x0000000000000);
- assertEquals('0x0000000000000000', jspb.utils.hash64ToHexString(result));
+ expect(jspb.utils.hash64ToHexString(result)).toEqual('0x0000000000000000');
result = convert(0xFFFFFFFFFFFFF);
- assertEquals('0x000fffffffffffff', jspb.utils.hash64ToHexString(result));
+ expect(jspb.utils.hash64ToHexString(result)).toEqual('0x000fffffffffffff');
result = convert(0x123456789ABCD);
- assertEquals('0x000123456789abcd', jspb.utils.hash64ToHexString(result));
+ expect(jspb.utils.hash64ToHexString(result)).toEqual('0x000123456789abcd');
result = convert(0xDCBA987654321);
- assertEquals('0x000dcba987654321', jspb.utils.hash64ToHexString(result));
+ expect(jspb.utils.hash64ToHexString(result)).toEqual('0x000dcba987654321');
// 53 bits of precision should not be truncated.
result = convert(0x10000000000001);
- assertEquals('0x0010000000000001', jspb.utils.hash64ToHexString(result));
+ expect(jspb.utils.hash64ToHexString(result)).toEqual('0x0010000000000001');
// 54 bits of precision should be truncated.
result = convert(0x20000000000001);
- assertNotEquals(
- '0x0020000000000001', jspb.utils.hash64ToHexString(result));
+ expect(jspb.utils.hash64ToHexString(result))
+ .not.toEqual('0x0020000000000001');
});
@@ -322,15 +321,15 @@
// come back out of the string unchanged.
for (var i = 0; i < 65536; i++) {
strings[i] = 'a' + String.fromCharCode(i) + 'a';
- if (3 != strings[i].length) throw 'fail!';
- if (i != strings[i].charCodeAt(1)) throw 'fail!';
+ expect(strings[i].length).toEqual(3);
+ expect(strings[i].charCodeAt(1)).toEqual(i);
}
// Each unicode character should compare equal to itself and not equal to a
// different unicode character.
for (var i = 0; i < 65536; i++) {
- if (strings[i] != strings[i]) throw 'fail!';
- if (strings[i] == strings[(i + 1) % 65536]) throw 'fail!';
+ expect(strings[i] == strings[i]).toEqual(true);
+ expect(strings[i] == strings[(i + 1) % 65536]).toEqual(false);
}
});
@@ -345,10 +344,9 @@
// NaN.
jspb.utils.splitFloat32(NaN);
- if (!isNaN(jspb.utils.joinFloat32(jspb.utils.split64Low,
- jspb.utils.split64High))) {
- throw 'fail!';
- }
+ expect(isNaN(jspb.utils.joinFloat32(
+ jspb.utils.split64Low, jspb.utils.split64High)))
+ .toEqual(true);
/**
* @param {number} x
@@ -359,10 +357,9 @@
if (goog.isDef(opt_bits)) {
if (opt_bits != jspb.utils.split64Low) throw 'fail!';
}
- if (truncate(x) != jspb.utils.joinFloat32(jspb.utils.split64Low,
- jspb.utils.split64High)) {
- throw 'fail!';
- }
+ expect(truncate(x))
+ .toEqual(jspb.utils.joinFloat32(
+ jspb.utils.split64Low, jspb.utils.split64High));
}
// Positive and negative infinity.
@@ -411,10 +408,9 @@
// NaN.
jspb.utils.splitFloat64(NaN);
- if (!isNaN(jspb.utils.joinFloat64(jspb.utils.split64Low,
- jspb.utils.split64High))) {
- throw 'fail!';
- }
+ expect(isNaN(jspb.utils.joinFloat64(
+ jspb.utils.split64Low, jspb.utils.split64High)))
+ .toEqual(true);
/**
* @param {number} x
@@ -429,10 +425,9 @@
if (goog.isDef(opt_lowBits)) {
if (opt_lowBits != jspb.utils.split64Low) throw 'fail!';
}
- if (x != jspb.utils.joinFloat64(jspb.utils.split64Low,
- jspb.utils.split64High)) {
- throw 'fail!';
- }
+ expect(
+ jspb.utils.joinFloat64(jspb.utils.split64Low, jspb.utils.split64High))
+ .toEqual(x);
}
// Positive and negative infinity.
@@ -487,8 +482,8 @@
// We should have two more varints than we started with - one for the field
// tag, one for the packed length.
- assertEquals(values.length + 2,
- jspb.utils.countVarints(buffer, 0, buffer.length));
+ expect(jspb.utils.countVarints(buffer, 0, buffer.length))
+ .toEqual(values.length + 2);
});
@@ -506,8 +501,8 @@
writer.writeString(2, 'terminator');
var buffer = new Uint8Array(writer.getResultBuffer());
- assertEquals(count,
- jspb.utils.countVarintFields(buffer, 0, buffer.length, 1));
+ expect(jspb.utils.countVarintFields(buffer, 0, buffer.length, 1))
+ .toEqual(count);
writer = new jspb.BinaryWriter();
@@ -519,8 +514,8 @@
writer.writeString(2, 'terminator');
buffer = new Uint8Array(writer.getResultBuffer());
- assertEquals(count,
- jspb.utils.countVarintFields(buffer, 0, buffer.length, 123456789));
+ expect(jspb.utils.countVarintFields(buffer, 0, buffer.length, 123456789))
+ .toEqual(count);
});
@@ -538,8 +533,8 @@
writer.writeString(2, 'terminator');
var buffer = new Uint8Array(writer.getResultBuffer());
- assertEquals(count,
- jspb.utils.countFixed32Fields(buffer, 0, buffer.length, 1));
+ expect(jspb.utils.countFixed32Fields(buffer, 0, buffer.length, 1))
+ .toEqual(count);
writer = new jspb.BinaryWriter();
@@ -551,8 +546,8 @@
writer.writeString(2, 'terminator');
buffer = new Uint8Array(writer.getResultBuffer());
- assertEquals(count,
- jspb.utils.countFixed32Fields(buffer, 0, buffer.length, 123456789));
+ expect(jspb.utils.countFixed32Fields(buffer, 0, buffer.length, 123456789))
+ .toEqual(count);
});
@@ -570,8 +565,8 @@
writer.writeString(2, 'terminator');
var buffer = new Uint8Array(writer.getResultBuffer());
- assertEquals(count,
- jspb.utils.countFixed64Fields(buffer, 0, buffer.length, 1));
+ expect(jspb.utils.countFixed64Fields(buffer, 0, buffer.length, 1))
+ .toEqual(count);
writer = new jspb.BinaryWriter();
@@ -583,8 +578,8 @@
writer.writeString(2, 'terminator');
buffer = new Uint8Array(writer.getResultBuffer());
- assertEquals(count,
- jspb.utils.countFixed64Fields(buffer, 0, buffer.length, 123456789));
+ expect(jspb.utils.countFixed64Fields(buffer, 0, buffer.length, 123456789))
+ .toEqual(count);
});
@@ -602,8 +597,8 @@
writer.writeString(2, 'terminator');
var buffer = new Uint8Array(writer.getResultBuffer());
- assertEquals(count,
- jspb.utils.countDelimitedFields(buffer, 0, buffer.length, 1));
+ expect(jspb.utils.countDelimitedFields(buffer, 0, buffer.length, 1))
+ .toEqual(count);
writer = new jspb.BinaryWriter();
@@ -615,8 +610,8 @@
writer.writeString(2, 'terminator');
buffer = new Uint8Array(writer.getResultBuffer());
- assertEquals(count,
- jspb.utils.countDelimitedFields(buffer, 0, buffer.length, 123456789));
+ expect(jspb.utils.countDelimitedFields(buffer, 0, buffer.length, 123456789))
+ .toEqual(count);
});
@@ -624,9 +619,10 @@
* Tests byte format for debug strings.
*/
it('testDebugBytesToTextFormat', function() {
- assertEquals('""', jspb.utils.debugBytesToTextFormat(null));
- assertEquals('"\\x00\\x10\\xff"',
- jspb.utils.debugBytesToTextFormat([0, 16, 255]));
+ expect(jspb.utils.debugBytesToTextFormat(null)).toEqual('""');
+ expect(jspb.utils.debugBytesToTextFormat([
+ 0, 16, 255
+ ])).toEqual('"\\x00\\x10\\xff"');
});
@@ -647,15 +643,15 @@
var sourceString = goog.crypt.byteArrayToString(sourceData);
function check(result) {
- assertEquals(Uint8Array, result.constructor);
- assertEquals(sourceData.length, result.length);
+ expect(result.constructor).toEqual(Uint8Array);
+ expect(result.length).toEqual(sourceData.length);
for (var i = 0; i < result.length; i++) {
- assertEquals(sourceData[i], result[i]);
+ expect(result[i]).toEqual(sourceData[i]);
}
}
// Converting Uint8Arrays into Uint8Arrays should be a no-op.
- assertEquals(sourceBytes, convert(sourceBytes));
+ expect(convert(sourceBytes)).toEqual(sourceBytes);
// Converting Array<numbers> into Uint8Arrays should work.
check(convert(sourceData));
diff --git a/js/binary/writer.js b/js/binary/writer.js
index ae1c29b..017d481 100644
--- a/js/binary/writer.js
+++ b/js/binary/writer.js
@@ -887,6 +887,32 @@
/**
+ * Writes a 64-bit field to the buffer as a fixed64.
+ * @param {number} field The field number.
+ * @param {number} lowBits The low 32 bits.
+ * @param {number} highBits The high 32 bits.
+ */
+jspb.BinaryWriter.prototype.writeSplitFixed64 = function(
+ field, lowBits, highBits) {
+ this.writeFieldHeader_(field, jspb.BinaryConstants.WireType.FIXED64);
+ this.encoder_.writeSplitFixed64(lowBits, highBits);
+};
+
+
+/**
+ * Writes a 64-bit field to the buffer as a varint.
+ * @param {number} field The field number.
+ * @param {number} lowBits The low 32 bits.
+ * @param {number} highBits The high 32 bits.
+ */
+jspb.BinaryWriter.prototype.writeSplitVarint64 = function(
+ field, lowBits, highBits) {
+ this.writeFieldHeader_(field, jspb.BinaryConstants.WireType.VARINT);
+ this.encoder_.writeSplitVarint64(lowBits, highBits);
+};
+
+
+/**
* Writes an array of numbers to the buffer as a repeated 32-bit int field.
* @param {number} field The field number.
* @param {?Array<number>} value The array of ints to write.
@@ -927,6 +953,40 @@
/**
+ * Writes an array of 64-bit values to the buffer as a fixed64.
+ * @param {number} field The field number.
+ * @param {?Array<T>} value The value.
+ * @param {function(T): number} lo Function to get low bits.
+ * @param {function(T): number} hi Function to get high bits.
+ * @template T
+ */
+jspb.BinaryWriter.prototype.writeRepeatedSplitFixed64 = function(
+ field, value, lo, hi) {
+ if (value == null) return;
+ for (var i = 0; i < value.length; i++) {
+ this.writeSplitFixed64(field, lo(value[i]), hi(value[i]));
+ }
+};
+
+
+/**
+ * Writes an array of 64-bit values to the buffer as a varint.
+ * @param {number} field The field number.
+ * @param {?Array<T>} value The value.
+ * @param {function(T): number} lo Function to get low bits.
+ * @param {function(T): number} hi Function to get high bits.
+ * @template T
+ */
+jspb.BinaryWriter.prototype.writeRepeatedSplitVarint64 = function(
+ field, value, lo, hi) {
+ if (value == null) return;
+ for (var i = 0; i < value.length; i++) {
+ this.writeSplitVarint64(field, lo(value[i]), hi(value[i]));
+ }
+};
+
+
+/**
* Writes an array of numbers formatted as strings to the buffer as a repeated
* 64-bit int field.
* @param {number} field The field number.
@@ -1314,6 +1374,44 @@
/**
+ * Writes an array of 64-bit values to the buffer as a fixed64.
+ * @param {number} field The field number.
+ * @param {?Array<T>} value The value.
+ * @param {function(T): number} lo Function to get low bits.
+ * @param {function(T): number} hi Function to get high bits.
+ * @template T
+ */
+jspb.BinaryWriter.prototype.writePackedSplitFixed64 = function(
+ field, value, lo, hi) {
+ if (value == null) return;
+ var bookmark = this.beginDelimited_(field);
+ for (var i = 0; i < value.length; i++) {
+ this.encoder_.writeSplitFixed64(lo(value[i]), hi(value[i]));
+ }
+ this.endDelimited_(bookmark);
+};
+
+
+/**
+ * Writes an array of 64-bit values to the buffer as a varint.
+ * @param {number} field The field number.
+ * @param {?Array<T>} value The value.
+ * @param {function(T): number} lo Function to get low bits.
+ * @param {function(T): number} hi Function to get high bits.
+ * @template T
+ */
+jspb.BinaryWriter.prototype.writePackedSplitVarint64 = function(
+ field, value, lo, hi) {
+ if (value == null) return;
+ var bookmark = this.beginDelimited_(field);
+ for (var i = 0; i < value.length; i++) {
+ this.encoder_.writeSplitVarint64(lo(value[i]), hi(value[i]));
+ }
+ this.endDelimited_(bookmark);
+};
+
+
+/**
* Writes an array of numbers represented as strings to the buffer as a packed
* 64-bit int field.
* @param {number} field
diff --git a/js/binary/writer_test.js b/js/binary/writer_test.js
index 8a9a1bb..b4860a1 100644
--- a/js/binary/writer_test.js
+++ b/js/binary/writer_test.js
@@ -40,6 +40,7 @@
goog.require('goog.crypt');
goog.require('goog.testing.asserts');
+goog.require('jspb.BinaryReader');
goog.require('jspb.BinaryWriter');
@@ -130,4 +131,74 @@
assertEquals('CgF/', writer.getResultBase64String(false));
assertEquals('CgF_', writer.getResultBase64String(true));
});
+
+ it('writes split 64 fields', function() {
+ var writer = new jspb.BinaryWriter();
+ writer.writeSplitVarint64(1, 0x1, 0x2);
+ writer.writeSplitVarint64(1, 0xFFFFFFFF, 0xFFFFFFFF);
+ writer.writeSplitFixed64(2, 0x1, 0x2);
+ writer.writeSplitFixed64(2, 0xFFFFFFF0, 0xFFFFFFFF);
+ function lo(i) {
+ return i + 1;
+ }
+ function hi(i) {
+ return i + 2;
+ }
+ writer.writeRepeatedSplitVarint64(3, [0, 1, 2], lo, hi);
+ writer.writeRepeatedSplitFixed64(4, [0, 1, 2], lo, hi);
+ writer.writePackedSplitVarint64(5, [0, 1, 2], lo, hi);
+ writer.writePackedSplitFixed64(6, [0, 1, 2], lo, hi);
+
+ function bitsAsArray(lowBits, highBits) {
+ return [lowBits >>> 0, highBits >>> 0];
+ }
+ var reader = jspb.BinaryReader.alloc(writer.getResultBuffer());
+ reader.nextField();
+ expect(reader.getFieldNumber()).toEqual(1);
+ expect(reader.readSplitVarint64(bitsAsArray)).toEqual([0x1, 0x2]);
+
+ reader.nextField();
+ expect(reader.getFieldNumber()).toEqual(1);
+ expect(reader.readSplitVarint64(bitsAsArray)).toEqual([
+ 0xFFFFFFFF, 0xFFFFFFFF
+ ]);
+
+ reader.nextField();
+ expect(reader.getFieldNumber()).toEqual(2);
+ expect(reader.readSplitFixed64(bitsAsArray)).toEqual([0x1, 0x2]);
+
+ reader.nextField();
+ expect(reader.getFieldNumber()).toEqual(2);
+ expect(reader.readSplitFixed64(bitsAsArray)).toEqual([
+ 0xFFFFFFF0, 0xFFFFFFFF
+ ]);
+
+ for (let i = 0; i < 3; i++) {
+ reader.nextField();
+ expect(reader.getFieldNumber()).toEqual(3);
+ expect(reader.readSplitVarint64(bitsAsArray)).toEqual([i + 1, i + 2]);
+ }
+
+ for (let i = 0; i < 3; i++) {
+ reader.nextField();
+ expect(reader.getFieldNumber()).toEqual(4);
+ expect(reader.readSplitFixed64(bitsAsArray)).toEqual([i + 1, i + 2]);
+ }
+
+ reader.nextField();
+ expect(reader.getFieldNumber()).toEqual(5);
+ expect(reader.readPackedInt64String()).toEqual([
+ String(2 * 2 ** 32 + 1),
+ String(3 * 2 ** 32 + 2),
+ String(4 * 2 ** 32 + 3),
+ ]);
+
+ reader.nextField();
+ expect(reader.getFieldNumber()).toEqual(6);
+ expect(reader.readPackedFixed64String()).toEqual([
+ String(2 * 2 ** 32 + 1),
+ String(3 * 2 ** 32 + 2),
+ String(4 * 2 ** 32 + 3),
+ ]);
+ });
});
diff --git a/js/message.js b/js/message.js
index 23e5af0..0957c6d 100644
--- a/js/message.js
+++ b/js/message.js
@@ -104,7 +104,7 @@
/**
* Stores binary-related information for a single extension field.
* @param {!jspb.ExtensionFieldInfo<T>} fieldInfo
- * @param {function(this:jspb.BinaryReader,number,?)} binaryReaderFn
+ * @param {function(this:jspb.BinaryReader,number,?,?)} binaryReaderFn
* @param {function(this:jspb.BinaryWriter,number,?)
* |function(this:jspb.BinaryWriter,number,?,?,?,?,?)} binaryWriterFn
* @param {function(?,?)=} opt_binaryMessageSerializeFn
@@ -976,153 +976,186 @@
/**
* Sets the value of a non-extension field.
- * @param {!jspb.Message} msg A jspb proto.
+ * @param {T} msg A jspb proto.
* @param {number} fieldNumber The field number.
* @param {string|number|boolean|Uint8Array|Array|undefined} value New value
+ * @return {T} return msg
+ * @template T
* @protected
*/
jspb.Message.setField = function(msg, fieldNumber, value) {
+ // TODO(b/35241823): replace this with a bounded generic when available
+ goog.asserts.assertInstanceof(msg, jspb.Message);
if (fieldNumber < msg.pivot_) {
msg.array[jspb.Message.getIndex_(msg, fieldNumber)] = value;
} else {
jspb.Message.maybeInitEmptyExtensionObject_(msg);
msg.extensionObject_[fieldNumber] = value;
}
+ return msg;
};
/**
* Sets the value of a non-extension integer field of a proto3
- * @param {!jspb.Message} msg A jspb proto.
+ * @param {T} msg A jspb proto.
* @param {number} fieldNumber The field number.
* @param {number} value New value
+ * @return {T} return msg
+ * @template T
* @protected
*/
jspb.Message.setProto3IntField = function(msg, fieldNumber, value) {
- jspb.Message.setFieldIgnoringDefault_(msg, fieldNumber, value, 0);
+ return jspb.Message.setFieldIgnoringDefault_(msg, fieldNumber, value, 0);
};
/**
* Sets the value of a non-extension floating point field of a proto3
- * @param {!jspb.Message} msg A jspb proto.
+ * @param {T} msg A jspb proto.
* @param {number} fieldNumber The field number.
* @param {number} value New value
+ * @return {T} return msg
+ * @template T
* @protected
*/
jspb.Message.setProto3FloatField = function(msg, fieldNumber, value) {
- jspb.Message.setFieldIgnoringDefault_(msg, fieldNumber, value, 0.0);
+ return jspb.Message.setFieldIgnoringDefault_(msg, fieldNumber, value, 0.0);
};
/**
* Sets the value of a non-extension boolean field of a proto3
- * @param {!jspb.Message} msg A jspb proto.
+ * @param {T} msg A jspb proto.
* @param {number} fieldNumber The field number.
* @param {boolean} value New value
+ * @return {T} return msg
+ * @template T
* @protected
*/
jspb.Message.setProto3BooleanField = function(msg, fieldNumber, value) {
- jspb.Message.setFieldIgnoringDefault_(msg, fieldNumber, value, false);
+ return jspb.Message.setFieldIgnoringDefault_(msg, fieldNumber, value, false);
};
/**
* Sets the value of a non-extension String field of a proto3
- * @param {!jspb.Message} msg A jspb proto.
+ * @param {T} msg A jspb proto.
* @param {number} fieldNumber The field number.
* @param {string} value New value
+ * @return {T} return msg
+ * @template T
* @protected
*/
jspb.Message.setProto3StringField = function(msg, fieldNumber, value) {
- jspb.Message.setFieldIgnoringDefault_(msg, fieldNumber, value, "");
+ return jspb.Message.setFieldIgnoringDefault_(msg, fieldNumber, value, '');
};
/**
* Sets the value of a non-extension Bytes field of a proto3
- * @param {!jspb.Message} msg A jspb proto.
+ * @param {T} msg A jspb proto.
* @param {number} fieldNumber The field number.
* @param {!Uint8Array|string} value New value
+ * @return {T} return msg
+ * @template T
* @protected
*/
jspb.Message.setProto3BytesField = function(msg, fieldNumber, value) {
- jspb.Message.setFieldIgnoringDefault_(msg, fieldNumber, value, "");
+ return jspb.Message.setFieldIgnoringDefault_(msg, fieldNumber, value, '');
};
/**
* Sets the value of a non-extension enum field of a proto3
- * @param {!jspb.Message} msg A jspb proto.
+ * @param {T} msg A jspb proto.
* @param {number} fieldNumber The field number.
* @param {number} value New value
+ * @return {T} return msg
+ * @template T
* @protected
*/
jspb.Message.setProto3EnumField = function(msg, fieldNumber, value) {
- jspb.Message.setFieldIgnoringDefault_(msg, fieldNumber, value, 0);
+ return jspb.Message.setFieldIgnoringDefault_(msg, fieldNumber, value, 0);
};
/**
* Sets the value of a non-extension int field of a proto3 that has jstype set
* to String.
- * @param {!jspb.Message} msg A jspb proto.
+ * @param {T} msg A jspb proto.
* @param {number} fieldNumber The field number.
* @param {string} value New value
+ * @return {T} return msg
+ * @template T
* @protected
*/
jspb.Message.setProto3StringIntField = function(msg, fieldNumber, value) {
- jspb.Message.setFieldIgnoringDefault_(msg, fieldNumber, value, "0");
+ return jspb.Message.setFieldIgnoringDefault_(msg, fieldNumber, value, '0');
};
/**
* Sets the value of a non-extension primitive field, with proto3 (non-nullable
* primitives) semantics of ignoring values that are equal to the type's
* default.
- * @param {!jspb.Message} msg A jspb proto.
+ * @param {T} msg A jspb proto.
* @param {number} fieldNumber The field number.
* @param {!Uint8Array|string|number|boolean|undefined} value New value
* @param {!Uint8Array|string|number|boolean} defaultValue The default value.
+ * @return {T} return msg
+ * @template T
* @private
*/
jspb.Message.setFieldIgnoringDefault_ = function(
msg, fieldNumber, value, defaultValue) {
+ // TODO(b/35241823): replace this with a bounded generic when available
+ goog.asserts.assertInstanceof(msg, jspb.Message);
if (value !== defaultValue) {
jspb.Message.setField(msg, fieldNumber, value);
} else {
msg.array[jspb.Message.getIndex_(msg, fieldNumber)] = null;
}
+ return msg;
};
/**
* Adds a value to a repeated, primitive field.
- * @param {!jspb.Message} msg A jspb proto.
+ * @param {T} msg A jspb proto.
* @param {number} fieldNumber The field number.
* @param {string|number|boolean|!Uint8Array} value New value
* @param {number=} opt_index Index where to put new value.
+ * @return {T} return msg
+ * @template T
* @protected
*/
jspb.Message.addToRepeatedField = function(msg, fieldNumber, value, opt_index) {
+ // TODO(b/35241823): replace this with a bounded generic when available
+ goog.asserts.assertInstanceof(msg, jspb.Message);
var arr = jspb.Message.getRepeatedField(msg, fieldNumber);
if (opt_index != undefined) {
arr.splice(opt_index, 0, value);
} else {
arr.push(value);
}
+ return msg;
};
/**
* Sets the value of a field in a oneof union and clears all other fields in
* the union.
- * @param {!jspb.Message} msg A jspb proto.
+ * @param {T} msg A jspb proto.
* @param {number} fieldNumber The field number.
* @param {!Array<number>} oneof The fields belonging to the union.
* @param {string|number|boolean|Uint8Array|Array|undefined} value New value
+ * @return {T} return msg
+ * @template T
* @protected
*/
jspb.Message.setOneofField = function(msg, fieldNumber, oneof, value) {
+ // TODO(b/35241823): replace this with a bounded generic when available
+ goog.asserts.assertInstanceof(msg, jspb.Message);
var currentCase = jspb.Message.computeOneofCase(msg, oneof);
if (currentCase && currentCase !== fieldNumber && value !== undefined) {
if (msg.wrappers_ && currentCase in msg.wrappers_) {
@@ -1130,7 +1163,7 @@
}
jspb.Message.setField(msg, currentCase, undefined);
}
- jspb.Message.setField(msg, fieldNumber, value);
+ return jspb.Message.setField(msg, fieldNumber, value);
};
@@ -1244,48 +1277,61 @@
/**
* Sets a proto field and syncs it to the backing array.
- * @param {!jspb.Message} msg A jspb proto.
+ * @param {T} msg A jspb proto.
* @param {number} fieldNumber The field number.
* @param {?jspb.Message|?jspb.Map|undefined} value A new value for this proto
* field.
+ * @return {T} the msg
+ * @template T
* @protected
*/
jspb.Message.setWrapperField = function(msg, fieldNumber, value) {
+ // TODO(b/35241823): replace this with a bounded generic when available
+ goog.asserts.assertInstanceof(msg, jspb.Message);
if (!msg.wrappers_) {
msg.wrappers_ = {};
}
var data = value ? value.toArray() : value;
msg.wrappers_[fieldNumber] = value;
- jspb.Message.setField(msg, fieldNumber, data);
+ return jspb.Message.setField(msg, fieldNumber, data);
};
+
/**
* Sets a proto field in a oneof union and syncs it to the backing array.
- * @param {!jspb.Message} msg A jspb proto.
+ * @param {T} msg A jspb proto.
* @param {number} fieldNumber The field number.
* @param {!Array<number>} oneof The fields belonging to the union.
* @param {jspb.Message|undefined} value A new value for this proto field.
+ * @return {T} the msg
+ * @template T
* @protected
*/
jspb.Message.setOneofWrapperField = function(msg, fieldNumber, oneof, value) {
+ // TODO(b/35241823): replace this with a bounded generic when available
+ goog.asserts.assertInstanceof(msg, jspb.Message);
if (!msg.wrappers_) {
msg.wrappers_ = {};
}
var data = value ? value.toArray() : value;
msg.wrappers_[fieldNumber] = value;
- jspb.Message.setOneofField(msg, fieldNumber, oneof, data);
+ return jspb.Message.setOneofField(msg, fieldNumber, oneof, data);
};
/**
* Sets a repeated proto field and syncs it to the backing array.
- * @param {!jspb.Message} msg A jspb proto.
+ * @param {T} msg A jspb proto.
* @param {number} fieldNumber The field number.
* @param {Array<!jspb.Message>|undefined} value An array of protos.
+ * @return {T} the msg
+ * @template T
* @protected
*/
jspb.Message.setRepeatedWrapperField = function(msg, fieldNumber, value) {
+ // TODO(b/35241823): replace this with a bounded generic when available
+ goog.asserts.assertInstanceof(msg, jspb.Message);
if (!msg.wrappers_) {
msg.wrappers_ = {};
}
@@ -1294,7 +1340,7 @@
data[i] = value[i].toArray();
}
msg.wrappers_[fieldNumber] = value;
- jspb.Message.setField(msg, fieldNumber, data);
+ return jspb.Message.setField(msg, fieldNumber, data);
};
diff --git a/js/message_test.js b/js/message_test.js
index a9fc64a..1965348 100644
--- a/js/message_test.js
+++ b/js/message_test.js
@@ -118,6 +118,7 @@
goog.require('proto.jspb.test.ExtensionMessage');
goog.require('proto.jspb.test.TestExtensionsMessage');
+goog.require('proto.jspb.test.TestAllowAliasEnum');
describe('Message test suite', function() {
var stubs = new goog.testing.PropertyReplacer();
diff --git a/js/test.proto b/js/test.proto
index 7c2a469..7c0578a 100644
--- a/js/test.proto
+++ b/js/test.proto
@@ -28,6 +28,7 @@
// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+// LINT: LEGACY_NAMES
// Author: mwr@google.com (Mark Rawling)
syntax = "proto2";
@@ -311,3 +312,11 @@
}
+
+enum TestAllowAliasEnum {
+ option allow_alias = true;
+
+ TEST_ALLOW_ALIAS_DEFAULT = 0;
+ VALUE1 = 1;
+ value1 = 1;
+}
diff --git a/objectivec/google/protobuf/Duration.pbobjc.h b/objectivec/google/protobuf/Duration.pbobjc.h
index 3e36759..561b093 100644
--- a/objectivec/google/protobuf/Duration.pbobjc.h
+++ b/objectivec/google/protobuf/Duration.pbobjc.h
@@ -77,7 +77,7 @@
* if (duration.seconds < 0 && duration.nanos > 0) {
* duration.seconds += 1;
* duration.nanos -= 1000000000;
- * } else if (durations.seconds > 0 && duration.nanos < 0) {
+ * } else if (duration.seconds > 0 && duration.nanos < 0) {
* duration.seconds -= 1;
* duration.nanos += 1000000000;
* }
diff --git a/python/google/protobuf/internal/message_test.py b/python/google/protobuf/internal/message_test.py
index 9de3e7a..86bcce8 100755
--- a/python/google/protobuf/internal/message_test.py
+++ b/python/google/protobuf/internal/message_test.py
@@ -1998,6 +1998,13 @@
m1.MergeFrom(m2)
self.assertEqual(10, m2.map_int32_foreign_message[123].c)
+ # Test merge maps within different message types.
+ m1 = map_unittest_pb2.TestMap()
+ m2 = map_unittest_pb2.TestMessageMap()
+ m2.map_int32_message[123].optional_int32 = 10
+ m1.map_int32_all_types.MergeFrom(m2.map_int32_message)
+ self.assertEqual(10, m1.map_int32_all_types[123].optional_int32)
+
def testMergeFromBadType(self):
msg = map_unittest_pb2.TestMap()
with self.assertRaisesRegexp(
diff --git a/python/google/protobuf/internal/python_message.py b/python/google/protobuf/internal/python_message.py
index 803ae84..8f3ec9d 100755
--- a/python/google/protobuf/internal/python_message.py
+++ b/python/google/protobuf/internal/python_message.py
@@ -620,7 +620,7 @@
def _AddPropertiesForRepeatedField(field, cls):
"""Adds a public property for a "repeated" protocol message field. Clients
can use this property to get the value of the field, which will be either a
- _RepeatedScalarFieldContainer or _RepeatedCompositeFieldContainer (see
+ RepeatedScalarFieldContainer or RepeatedCompositeFieldContainer (see
below).
Note that when clients add values to these containers, we perform
diff --git a/python/google/protobuf/pyext/map_container.cc b/python/google/protobuf/pyext/map_container.cc
index 9c8727e..222a001 100644
--- a/python/google/protobuf/pyext/map_container.cc
+++ b/python/google/protobuf/pyext/map_container.cc
@@ -343,9 +343,8 @@
const Reflection* other_reflection = other_message->GetReflection();
internal::MapFieldBase* field = reflection->MutableMapData(
message, self->parent_field_descriptor);
- const internal::MapFieldBase* other_field =
- other_reflection->GetMapData(*other_message,
- self->parent_field_descriptor);
+ const internal::MapFieldBase* other_field = other_reflection->GetMapData(
+ *other_message, other_map->parent_field_descriptor);
field->MergeFrom(*other_field);
self->version++;
Py_RETURN_NONE;
diff --git a/python/google/protobuf/pyext/message.cc b/python/google/protobuf/pyext/message.cc
index 3530a9b..dc2f772 100644
--- a/python/google/protobuf/pyext/message.cc
+++ b/python/google/protobuf/pyext/message.cc
@@ -47,7 +47,6 @@
#endif
#include <google/protobuf/stubs/common.h>
#include <google/protobuf/stubs/logging.h>
-#include <google/protobuf/io/strtod.h>
#include <google/protobuf/io/coded_stream.h>
#include <google/protobuf/io/zero_copy_stream_impl_lite.h>
#include <google/protobuf/descriptor.pb.h>
@@ -63,14 +62,17 @@
#include <google/protobuf/pyext/message_factory.h>
#include <google/protobuf/pyext/repeated_composite_container.h>
#include <google/protobuf/pyext/repeated_scalar_container.h>
-#include <google/protobuf/pyext/unknown_fields.h>
#include <google/protobuf/pyext/safe_numerics.h>
#include <google/protobuf/pyext/scoped_pyobject_ptr.h>
+#include <google/protobuf/pyext/unknown_fields.h>
#include <google/protobuf/util/message_differencer.h>
#include <google/protobuf/stubs/strutil.h>
+#include <google/protobuf/io/strtod.h>
#include <google/protobuf/stubs/map_util.h>
+// clang-format off
#include <google/protobuf/port_def.inc>
+// clang-format on
#if PY_MAJOR_VERSION >= 3
#define PyInt_AsLong PyLong_AsLong
diff --git a/src/Makefile.am b/src/Makefile.am
index dc50703..0d93d95 100644
--- a/src/Makefile.am
+++ b/src/Makefile.am
@@ -213,7 +213,6 @@
google/protobuf/repeated_field.cc \
google/protobuf/wire_format_lite.cc \
google/protobuf/io/coded_stream.cc \
- google/protobuf/io/coded_stream_inl.h \
google/protobuf/io/strtod.cc \
google/protobuf/io/zero_copy_stream.cc \
google/protobuf/io/zero_copy_stream_impl.cc \
diff --git a/src/google/protobuf/any.pb.cc b/src/google/protobuf/any.pb.cc
index bd382d1..aa720e3 100644
--- a/src/google/protobuf/any.pb.cc
+++ b/src/google/protobuf/any.pb.cc
@@ -32,7 +32,7 @@
}
PROTOBUF_EXPORT ::PROTOBUF_NAMESPACE_ID::internal::SCCInfo<0> scc_info_Any_google_2fprotobuf_2fany_2eproto =
- {{ATOMIC_VAR_INIT(::PROTOBUF_NAMESPACE_ID::internal::SCCInfoBase::kUninitialized), 0, InitDefaultsscc_info_Any_google_2fprotobuf_2fany_2eproto}, {}};
+ {{ATOMIC_VAR_INIT(::PROTOBUF_NAMESPACE_ID::internal::SCCInfoBase::kUninitialized), 0, 0, InitDefaultsscc_info_Any_google_2fprotobuf_2fany_2eproto}, {}};
static ::PROTOBUF_NAMESPACE_ID::Metadata file_level_metadata_google_2fprotobuf_2fany_2eproto[1];
static constexpr ::PROTOBUF_NAMESPACE_ID::EnumDescriptor const** file_level_enum_descriptors_google_2fprotobuf_2fany_2eproto = nullptr;
@@ -125,11 +125,11 @@
_any_metadata_(&type_url_, &value_) {
_internal_metadata_.MergeFrom(from._internal_metadata_);
type_url_.UnsafeSetDefault(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited());
- if (!from.type_url().empty()) {
+ if (!from._internal_type_url().empty()) {
type_url_.AssignWithDefault(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(), from.type_url_);
}
value_.UnsafeSetDefault(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited());
- if (!from.value().empty()) {
+ if (!from._internal_value().empty()) {
value_.AssignWithDefault(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(), from.value_);
}
// @@protoc_insertion_point(copy_constructor:google.protobuf.Any)
@@ -182,14 +182,14 @@
// string type_url = 1;
case 1:
if (PROTOBUF_PREDICT_TRUE(static_cast<::PROTOBUF_NAMESPACE_ID::uint8>(tag) == 10)) {
- ptr = ::PROTOBUF_NAMESPACE_ID::internal::InlineGreedyStringParserUTF8(mutable_type_url(), ptr, ctx, "google.protobuf.Any.type_url");
+ ptr = ::PROTOBUF_NAMESPACE_ID::internal::InlineGreedyStringParserUTF8(_internal_mutable_type_url(), ptr, ctx, "google.protobuf.Any.type_url");
CHK_(ptr);
} else goto handle_unusual;
continue;
// bytes value = 2;
case 2:
if (PROTOBUF_PREDICT_TRUE(static_cast<::PROTOBUF_NAMESPACE_ID::uint8>(tag) == 18)) {
- ptr = ::PROTOBUF_NAMESPACE_ID::internal::InlineGreedyStringParser(mutable_value(), ptr, ctx);
+ ptr = ::PROTOBUF_NAMESPACE_ID::internal::InlineGreedyStringParser(_internal_mutable_value(), ptr, ctx);
CHK_(ptr);
} else goto handle_unusual;
continue;
@@ -227,9 +227,9 @@
case 1: {
if (static_cast< ::PROTOBUF_NAMESPACE_ID::uint8>(tag) == (10 & 0xFF)) {
DO_(::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::ReadString(
- input, this->mutable_type_url()));
+ input, this->_internal_mutable_type_url()));
DO_(::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::VerifyUtf8String(
- this->type_url().data(), static_cast<int>(this->type_url().length()),
+ this->_internal_type_url().data(), static_cast<int>(this->_internal_type_url().length()),
::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::PARSE,
"google.protobuf.Any.type_url"));
} else {
@@ -242,7 +242,7 @@
case 2: {
if (static_cast< ::PROTOBUF_NAMESPACE_ID::uint8>(tag) == (18 & 0xFF)) {
DO_(::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::ReadBytes(
- input, this->mutable_value()));
+ input, this->_internal_mutable_value()));
} else {
goto handle_unusual;
}
@@ -279,17 +279,17 @@
// string type_url = 1;
if (this->type_url().size() > 0) {
::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::VerifyUtf8String(
- this->type_url().data(), static_cast<int>(this->type_url().length()),
+ this->_internal_type_url().data(), static_cast<int>(this->_internal_type_url().length()),
::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::SERIALIZE,
"google.protobuf.Any.type_url");
target = stream->WriteStringMaybeAliased(
- 1, this->type_url(), target);
+ 1, this->_internal_type_url(), target);
}
// bytes value = 2;
if (this->value().size() > 0) {
target = stream->WriteBytesMaybeAliased(
- 2, this->value(), target);
+ 2, this->_internal_value(), target);
}
if (PROTOBUF_PREDICT_FALSE(_internal_metadata_.have_unknown_fields())) {
@@ -312,14 +312,14 @@
if (this->type_url().size() > 0) {
total_size += 1 +
::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::StringSize(
- this->type_url());
+ this->_internal_type_url());
}
// bytes value = 2;
if (this->value().size() > 0) {
total_size += 1 +
::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::BytesSize(
- this->value());
+ this->_internal_value());
}
if (PROTOBUF_PREDICT_FALSE(_internal_metadata_.have_unknown_fields())) {
diff --git a/src/google/protobuf/any.pb.h b/src/google/protobuf/any.pb.h
index 7430dce..1a69b92 100644
--- a/src/google/protobuf/any.pb.h
+++ b/src/google/protobuf/any.pb.h
@@ -206,6 +206,11 @@
std::string* mutable_type_url();
std::string* release_type_url();
void set_allocated_type_url(std::string* type_url);
+ private:
+ const std::string& _internal_type_url() const;
+ void _internal_set_type_url(const std::string& value);
+ std::string* _internal_mutable_type_url();
+ public:
// bytes value = 2;
void clear_value();
@@ -217,6 +222,11 @@
std::string* mutable_value();
std::string* release_value();
void set_allocated_value(std::string* value);
+ private:
+ const std::string& _internal_value() const;
+ void _internal_set_value(const std::string& value);
+ std::string* _internal_mutable_value();
+ public:
// @@protoc_insertion_point(class_scope:google.protobuf.Any)
private:
@@ -246,12 +256,22 @@
}
inline const std::string& Any::type_url() const {
// @@protoc_insertion_point(field_get:google.protobuf.Any.type_url)
- return type_url_.GetNoArena();
+ return _internal_type_url();
}
inline void Any::set_type_url(const std::string& value) {
+ _internal_set_type_url(value);
+ // @@protoc_insertion_point(field_set:google.protobuf.Any.type_url)
+}
+inline std::string* Any::mutable_type_url() {
+ // @@protoc_insertion_point(field_mutable:google.protobuf.Any.type_url)
+ return _internal_mutable_type_url();
+}
+inline const std::string& Any::_internal_type_url() const {
+ return type_url_.GetNoArena();
+}
+inline void Any::_internal_set_type_url(const std::string& value) {
type_url_.SetNoArena(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(), value);
- // @@protoc_insertion_point(field_set:google.protobuf.Any.type_url)
}
inline void Any::set_type_url(std::string&& value) {
@@ -271,9 +291,8 @@
::std::string(reinterpret_cast<const char*>(value), size));
// @@protoc_insertion_point(field_set_pointer:google.protobuf.Any.type_url)
}
-inline std::string* Any::mutable_type_url() {
+inline std::string* Any::_internal_mutable_type_url() {
- // @@protoc_insertion_point(field_mutable:google.protobuf.Any.type_url)
return type_url_.MutableNoArena(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited());
}
inline std::string* Any::release_type_url() {
@@ -297,12 +316,22 @@
}
inline const std::string& Any::value() const {
// @@protoc_insertion_point(field_get:google.protobuf.Any.value)
- return value_.GetNoArena();
+ return _internal_value();
}
inline void Any::set_value(const std::string& value) {
+ _internal_set_value(value);
+ // @@protoc_insertion_point(field_set:google.protobuf.Any.value)
+}
+inline std::string* Any::mutable_value() {
+ // @@protoc_insertion_point(field_mutable:google.protobuf.Any.value)
+ return _internal_mutable_value();
+}
+inline const std::string& Any::_internal_value() const {
+ return value_.GetNoArena();
+}
+inline void Any::_internal_set_value(const std::string& value) {
value_.SetNoArena(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(), value);
- // @@protoc_insertion_point(field_set:google.protobuf.Any.value)
}
inline void Any::set_value(std::string&& value) {
@@ -322,9 +351,8 @@
::std::string(reinterpret_cast<const char*>(value), size));
// @@protoc_insertion_point(field_set_pointer:google.protobuf.Any.value)
}
-inline std::string* Any::mutable_value() {
+inline std::string* Any::_internal_mutable_value() {
- // @@protoc_insertion_point(field_mutable:google.protobuf.Any.value)
return value_.MutableNoArena(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited());
}
inline std::string* Any::release_value() {
diff --git a/src/google/protobuf/any_lite.cc b/src/google/protobuf/any_lite.cc
index 7403ed3..7839381 100644
--- a/src/google/protobuf/any_lite.cc
+++ b/src/google/protobuf/any_lite.cc
@@ -35,7 +35,6 @@
#include <google/protobuf/generated_message_util.h>
#include <google/protobuf/stubs/strutil.h>
-
namespace google {
namespace protobuf {
namespace internal {
diff --git a/src/google/protobuf/any_test.cc b/src/google/protobuf/any_test.cc
index 4fbf0b6..0d8893f 100644
--- a/src/google/protobuf/any_test.cc
+++ b/src/google/protobuf/any_test.cc
@@ -33,7 +33,6 @@
#include <gtest/gtest.h>
-
namespace google {
namespace protobuf {
namespace {
diff --git a/src/google/protobuf/api.pb.cc b/src/google/protobuf/api.pb.cc
index 123026f..1c943d1 100644
--- a/src/google/protobuf/api.pb.cc
+++ b/src/google/protobuf/api.pb.cc
@@ -44,7 +44,7 @@
}
PROTOBUF_EXPORT ::PROTOBUF_NAMESPACE_ID::internal::SCCInfo<4> scc_info_Api_google_2fprotobuf_2fapi_2eproto =
- {{ATOMIC_VAR_INIT(::PROTOBUF_NAMESPACE_ID::internal::SCCInfoBase::kUninitialized), 4, InitDefaultsscc_info_Api_google_2fprotobuf_2fapi_2eproto}, {
+ {{ATOMIC_VAR_INIT(::PROTOBUF_NAMESPACE_ID::internal::SCCInfoBase::kUninitialized), 4, 0, InitDefaultsscc_info_Api_google_2fprotobuf_2fapi_2eproto}, {
&scc_info_Method_google_2fprotobuf_2fapi_2eproto.base,
&scc_info_Option_google_2fprotobuf_2ftype_2eproto.base,
&scc_info_SourceContext_google_2fprotobuf_2fsource_5fcontext_2eproto.base,
@@ -62,7 +62,7 @@
}
PROTOBUF_EXPORT ::PROTOBUF_NAMESPACE_ID::internal::SCCInfo<1> scc_info_Method_google_2fprotobuf_2fapi_2eproto =
- {{ATOMIC_VAR_INIT(::PROTOBUF_NAMESPACE_ID::internal::SCCInfoBase::kUninitialized), 1, InitDefaultsscc_info_Method_google_2fprotobuf_2fapi_2eproto}, {
+ {{ATOMIC_VAR_INIT(::PROTOBUF_NAMESPACE_ID::internal::SCCInfoBase::kUninitialized), 1, 0, InitDefaultsscc_info_Method_google_2fprotobuf_2fapi_2eproto}, {
&scc_info_Option_google_2fprotobuf_2ftype_2eproto.base,}};
static void InitDefaultsscc_info_Mixin_google_2fprotobuf_2fapi_2eproto() {
@@ -77,7 +77,7 @@
}
PROTOBUF_EXPORT ::PROTOBUF_NAMESPACE_ID::internal::SCCInfo<0> scc_info_Mixin_google_2fprotobuf_2fapi_2eproto =
- {{ATOMIC_VAR_INIT(::PROTOBUF_NAMESPACE_ID::internal::SCCInfoBase::kUninitialized), 0, InitDefaultsscc_info_Mixin_google_2fprotobuf_2fapi_2eproto}, {}};
+ {{ATOMIC_VAR_INIT(::PROTOBUF_NAMESPACE_ID::internal::SCCInfoBase::kUninitialized), 0, 0, InitDefaultsscc_info_Mixin_google_2fprotobuf_2fapi_2eproto}, {}};
static ::PROTOBUF_NAMESPACE_ID::Metadata file_level_metadata_google_2fprotobuf_2fapi_2eproto[3];
static constexpr ::PROTOBUF_NAMESPACE_ID::EnumDescriptor const** file_level_enum_descriptors_google_2fprotobuf_2fapi_2eproto = nullptr;
@@ -208,11 +208,11 @@
mixins_(from.mixins_) {
_internal_metadata_.MergeFrom(from._internal_metadata_);
name_.UnsafeSetDefault(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited());
- if (!from.name().empty()) {
+ if (!from._internal_name().empty()) {
name_.AssignWithDefault(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(), from.name_);
}
version_.UnsafeSetDefault(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited());
- if (!from.version().empty()) {
+ if (!from._internal_version().empty()) {
version_.AssignWithDefault(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(), from.version_);
}
if (from.has_source_context()) {
@@ -283,7 +283,7 @@
// string name = 1;
case 1:
if (PROTOBUF_PREDICT_TRUE(static_cast<::PROTOBUF_NAMESPACE_ID::uint8>(tag) == 10)) {
- ptr = ::PROTOBUF_NAMESPACE_ID::internal::InlineGreedyStringParserUTF8(mutable_name(), ptr, ctx, "google.protobuf.Api.name");
+ ptr = ::PROTOBUF_NAMESPACE_ID::internal::InlineGreedyStringParserUTF8(_internal_mutable_name(), ptr, ctx, "google.protobuf.Api.name");
CHK_(ptr);
} else goto handle_unusual;
continue;
@@ -296,7 +296,7 @@
ptr = ctx->ParseMessage(add_methods(), ptr);
CHK_(ptr);
if (!ctx->DataAvailable(ptr)) break;
- } while (::PROTOBUF_NAMESPACE_ID::internal::UnalignedLoad<::PROTOBUF_NAMESPACE_ID::uint8>(ptr) == 18);
+ } while (::PROTOBUF_NAMESPACE_ID::internal::ExpectTag<18>(ptr));
} else goto handle_unusual;
continue;
// repeated .google.protobuf.Option options = 3;
@@ -308,13 +308,13 @@
ptr = ctx->ParseMessage(add_options(), ptr);
CHK_(ptr);
if (!ctx->DataAvailable(ptr)) break;
- } while (::PROTOBUF_NAMESPACE_ID::internal::UnalignedLoad<::PROTOBUF_NAMESPACE_ID::uint8>(ptr) == 26);
+ } while (::PROTOBUF_NAMESPACE_ID::internal::ExpectTag<26>(ptr));
} else goto handle_unusual;
continue;
// string version = 4;
case 4:
if (PROTOBUF_PREDICT_TRUE(static_cast<::PROTOBUF_NAMESPACE_ID::uint8>(tag) == 34)) {
- ptr = ::PROTOBUF_NAMESPACE_ID::internal::InlineGreedyStringParserUTF8(mutable_version(), ptr, ctx, "google.protobuf.Api.version");
+ ptr = ::PROTOBUF_NAMESPACE_ID::internal::InlineGreedyStringParserUTF8(_internal_mutable_version(), ptr, ctx, "google.protobuf.Api.version");
CHK_(ptr);
} else goto handle_unusual;
continue;
@@ -334,7 +334,7 @@
ptr = ctx->ParseMessage(add_mixins(), ptr);
CHK_(ptr);
if (!ctx->DataAvailable(ptr)) break;
- } while (::PROTOBUF_NAMESPACE_ID::internal::UnalignedLoad<::PROTOBUF_NAMESPACE_ID::uint8>(ptr) == 50);
+ } while (::PROTOBUF_NAMESPACE_ID::internal::ExpectTag<50>(ptr));
} else goto handle_unusual;
continue;
// .google.protobuf.Syntax syntax = 7;
@@ -379,9 +379,9 @@
case 1: {
if (static_cast< ::PROTOBUF_NAMESPACE_ID::uint8>(tag) == (10 & 0xFF)) {
DO_(::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::ReadString(
- input, this->mutable_name()));
+ input, this->_internal_mutable_name()));
DO_(::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::VerifyUtf8String(
- this->name().data(), static_cast<int>(this->name().length()),
+ this->_internal_name().data(), static_cast<int>(this->_internal_name().length()),
::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::PARSE,
"google.protobuf.Api.name"));
} else {
@@ -416,9 +416,9 @@
case 4: {
if (static_cast< ::PROTOBUF_NAMESPACE_ID::uint8>(tag) == (34 & 0xFF)) {
DO_(::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::ReadString(
- input, this->mutable_version()));
+ input, this->_internal_mutable_version()));
DO_(::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::VerifyUtf8String(
- this->version().data(), static_cast<int>(this->version().length()),
+ this->_internal_version().data(), static_cast<int>(this->_internal_version().length()),
::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::PARSE,
"google.protobuf.Api.version"));
} else {
@@ -493,24 +493,24 @@
// string name = 1;
if (this->name().size() > 0) {
::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::VerifyUtf8String(
- this->name().data(), static_cast<int>(this->name().length()),
+ this->_internal_name().data(), static_cast<int>(this->_internal_name().length()),
::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::SERIALIZE,
"google.protobuf.Api.name");
target = stream->WriteStringMaybeAliased(
- 1, this->name(), target);
+ 1, this->_internal_name(), target);
}
// repeated .google.protobuf.Method methods = 2;
- for (auto it = this->methods().pointer_begin(),
- end = this->methods().pointer_end(); it < end; ++it) {
+ for (auto it = this->methods_.pointer_begin(),
+ end = this->methods_.pointer_end(); it < end; ++it) {
stream->EnsureSpace(&target);
target = ::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::
InternalWriteMessageToArray(2, **it, target, stream);
}
// repeated .google.protobuf.Option options = 3;
- for (auto it = this->options().pointer_begin(),
- end = this->options().pointer_end(); it < end; ++it) {
+ for (auto it = this->options_.pointer_begin(),
+ end = this->options_.pointer_end(); it < end; ++it) {
stream->EnsureSpace(&target);
target = ::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::
InternalWriteMessageToArray(3, **it, target, stream);
@@ -519,11 +519,11 @@
// string version = 4;
if (this->version().size() > 0) {
::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::VerifyUtf8String(
- this->version().data(), static_cast<int>(this->version().length()),
+ this->_internal_version().data(), static_cast<int>(this->_internal_version().length()),
::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::SERIALIZE,
"google.protobuf.Api.version");
target = stream->WriteStringMaybeAliased(
- 4, this->version(), target);
+ 4, this->_internal_version(), target);
}
// .google.protobuf.SourceContext source_context = 5;
@@ -535,8 +535,8 @@
}
// repeated .google.protobuf.Mixin mixins = 6;
- for (auto it = this->mixins().pointer_begin(),
- end = this->mixins().pointer_end(); it < end; ++it) {
+ for (auto it = this->mixins_.pointer_begin(),
+ end = this->mixins_.pointer_end(); it < end; ++it) {
stream->EnsureSpace(&target);
target = ::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::
InternalWriteMessageToArray(6, **it, target, stream);
@@ -566,50 +566,38 @@
(void) cached_has_bits;
// repeated .google.protobuf.Method methods = 2;
- {
- unsigned int count = static_cast<unsigned int>(this->methods_size());
- total_size += 1UL * count;
- for (unsigned int i = 0; i < count; i++) {
- total_size +=
- ::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::MessageSize(
- this->methods(static_cast<int>(i)));
- }
+ total_size += 1UL * this->methods_size();
+ for (const auto& msg : this->methods_) {
+ total_size +=
+ ::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::MessageSize(msg);
}
// repeated .google.protobuf.Option options = 3;
- {
- unsigned int count = static_cast<unsigned int>(this->options_size());
- total_size += 1UL * count;
- for (unsigned int i = 0; i < count; i++) {
- total_size +=
- ::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::MessageSize(
- this->options(static_cast<int>(i)));
- }
+ total_size += 1UL * this->options_size();
+ for (const auto& msg : this->options_) {
+ total_size +=
+ ::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::MessageSize(msg);
}
// repeated .google.protobuf.Mixin mixins = 6;
- {
- unsigned int count = static_cast<unsigned int>(this->mixins_size());
- total_size += 1UL * count;
- for (unsigned int i = 0; i < count; i++) {
- total_size +=
- ::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::MessageSize(
- this->mixins(static_cast<int>(i)));
- }
+ total_size += 1UL * this->mixins_size();
+ for (const auto& msg : this->mixins_) {
+ total_size +=
+ ::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::MessageSize(msg);
}
// string name = 1;
if (this->name().size() > 0) {
total_size += 1 +
::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::StringSize(
- this->name());
+ this->_internal_name());
}
// string version = 4;
if (this->version().size() > 0) {
total_size += 1 +
::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::StringSize(
- this->version());
+ this->_internal_version());
}
// .google.protobuf.SourceContext source_context = 5;
@@ -696,9 +684,9 @@
void Api::InternalSwap(Api* other) {
using std::swap;
_internal_metadata_.Swap(&other->_internal_metadata_);
- CastToBase(&methods_)->InternalSwap(CastToBase(&other->methods_));
- CastToBase(&options_)->InternalSwap(CastToBase(&other->options_));
- CastToBase(&mixins_)->InternalSwap(CastToBase(&other->mixins_));
+ methods_.InternalSwap(&other->methods_);
+ options_.InternalSwap(&other->options_);
+ mixins_.InternalSwap(&other->mixins_);
name_.Swap(&other->name_, &::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(),
GetArenaNoVirtual());
version_.Swap(&other->version_, &::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(),
@@ -734,15 +722,15 @@
options_(from.options_) {
_internal_metadata_.MergeFrom(from._internal_metadata_);
name_.UnsafeSetDefault(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited());
- if (!from.name().empty()) {
+ if (!from._internal_name().empty()) {
name_.AssignWithDefault(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(), from.name_);
}
request_type_url_.UnsafeSetDefault(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited());
- if (!from.request_type_url().empty()) {
+ if (!from._internal_request_type_url().empty()) {
request_type_url_.AssignWithDefault(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(), from.request_type_url_);
}
response_type_url_.UnsafeSetDefault(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited());
- if (!from.response_type_url().empty()) {
+ if (!from._internal_response_type_url().empty()) {
response_type_url_.AssignWithDefault(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(), from.response_type_url_);
}
::memcpy(&request_streaming_, &from.request_streaming_,
@@ -808,14 +796,14 @@
// string name = 1;
case 1:
if (PROTOBUF_PREDICT_TRUE(static_cast<::PROTOBUF_NAMESPACE_ID::uint8>(tag) == 10)) {
- ptr = ::PROTOBUF_NAMESPACE_ID::internal::InlineGreedyStringParserUTF8(mutable_name(), ptr, ctx, "google.protobuf.Method.name");
+ ptr = ::PROTOBUF_NAMESPACE_ID::internal::InlineGreedyStringParserUTF8(_internal_mutable_name(), ptr, ctx, "google.protobuf.Method.name");
CHK_(ptr);
} else goto handle_unusual;
continue;
// string request_type_url = 2;
case 2:
if (PROTOBUF_PREDICT_TRUE(static_cast<::PROTOBUF_NAMESPACE_ID::uint8>(tag) == 18)) {
- ptr = ::PROTOBUF_NAMESPACE_ID::internal::InlineGreedyStringParserUTF8(mutable_request_type_url(), ptr, ctx, "google.protobuf.Method.request_type_url");
+ ptr = ::PROTOBUF_NAMESPACE_ID::internal::InlineGreedyStringParserUTF8(_internal_mutable_request_type_url(), ptr, ctx, "google.protobuf.Method.request_type_url");
CHK_(ptr);
} else goto handle_unusual;
continue;
@@ -829,7 +817,7 @@
// string response_type_url = 4;
case 4:
if (PROTOBUF_PREDICT_TRUE(static_cast<::PROTOBUF_NAMESPACE_ID::uint8>(tag) == 34)) {
- ptr = ::PROTOBUF_NAMESPACE_ID::internal::InlineGreedyStringParserUTF8(mutable_response_type_url(), ptr, ctx, "google.protobuf.Method.response_type_url");
+ ptr = ::PROTOBUF_NAMESPACE_ID::internal::InlineGreedyStringParserUTF8(_internal_mutable_response_type_url(), ptr, ctx, "google.protobuf.Method.response_type_url");
CHK_(ptr);
} else goto handle_unusual;
continue;
@@ -849,7 +837,7 @@
ptr = ctx->ParseMessage(add_options(), ptr);
CHK_(ptr);
if (!ctx->DataAvailable(ptr)) break;
- } while (::PROTOBUF_NAMESPACE_ID::internal::UnalignedLoad<::PROTOBUF_NAMESPACE_ID::uint8>(ptr) == 50);
+ } while (::PROTOBUF_NAMESPACE_ID::internal::ExpectTag<50>(ptr));
} else goto handle_unusual;
continue;
// .google.protobuf.Syntax syntax = 7;
@@ -894,9 +882,9 @@
case 1: {
if (static_cast< ::PROTOBUF_NAMESPACE_ID::uint8>(tag) == (10 & 0xFF)) {
DO_(::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::ReadString(
- input, this->mutable_name()));
+ input, this->_internal_mutable_name()));
DO_(::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::VerifyUtf8String(
- this->name().data(), static_cast<int>(this->name().length()),
+ this->_internal_name().data(), static_cast<int>(this->_internal_name().length()),
::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::PARSE,
"google.protobuf.Method.name"));
} else {
@@ -909,9 +897,9 @@
case 2: {
if (static_cast< ::PROTOBUF_NAMESPACE_ID::uint8>(tag) == (18 & 0xFF)) {
DO_(::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::ReadString(
- input, this->mutable_request_type_url()));
+ input, this->_internal_mutable_request_type_url()));
DO_(::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::VerifyUtf8String(
- this->request_type_url().data(), static_cast<int>(this->request_type_url().length()),
+ this->_internal_request_type_url().data(), static_cast<int>(this->_internal_request_type_url().length()),
::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::PARSE,
"google.protobuf.Method.request_type_url"));
} else {
@@ -937,9 +925,9 @@
case 4: {
if (static_cast< ::PROTOBUF_NAMESPACE_ID::uint8>(tag) == (34 & 0xFF)) {
DO_(::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::ReadString(
- input, this->mutable_response_type_url()));
+ input, this->_internal_mutable_response_type_url()));
DO_(::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::VerifyUtf8String(
- this->response_type_url().data(), static_cast<int>(this->response_type_url().length()),
+ this->_internal_response_type_url().data(), static_cast<int>(this->_internal_response_type_url().length()),
::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::PARSE,
"google.protobuf.Method.response_type_url"));
} else {
@@ -1016,21 +1004,21 @@
// string name = 1;
if (this->name().size() > 0) {
::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::VerifyUtf8String(
- this->name().data(), static_cast<int>(this->name().length()),
+ this->_internal_name().data(), static_cast<int>(this->_internal_name().length()),
::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::SERIALIZE,
"google.protobuf.Method.name");
target = stream->WriteStringMaybeAliased(
- 1, this->name(), target);
+ 1, this->_internal_name(), target);
}
// string request_type_url = 2;
if (this->request_type_url().size() > 0) {
::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::VerifyUtf8String(
- this->request_type_url().data(), static_cast<int>(this->request_type_url().length()),
+ this->_internal_request_type_url().data(), static_cast<int>(this->_internal_request_type_url().length()),
::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::SERIALIZE,
"google.protobuf.Method.request_type_url");
target = stream->WriteStringMaybeAliased(
- 2, this->request_type_url(), target);
+ 2, this->_internal_request_type_url(), target);
}
// bool request_streaming = 3;
@@ -1042,11 +1030,11 @@
// string response_type_url = 4;
if (this->response_type_url().size() > 0) {
::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::VerifyUtf8String(
- this->response_type_url().data(), static_cast<int>(this->response_type_url().length()),
+ this->_internal_response_type_url().data(), static_cast<int>(this->_internal_response_type_url().length()),
::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::SERIALIZE,
"google.protobuf.Method.response_type_url");
target = stream->WriteStringMaybeAliased(
- 4, this->response_type_url(), target);
+ 4, this->_internal_response_type_url(), target);
}
// bool response_streaming = 5;
@@ -1056,8 +1044,8 @@
}
// repeated .google.protobuf.Option options = 6;
- for (auto it = this->options().pointer_begin(),
- end = this->options().pointer_end(); it < end; ++it) {
+ for (auto it = this->options_.pointer_begin(),
+ end = this->options_.pointer_end(); it < end; ++it) {
stream->EnsureSpace(&target);
target = ::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::
InternalWriteMessageToArray(6, **it, target, stream);
@@ -1087,35 +1075,31 @@
(void) cached_has_bits;
// repeated .google.protobuf.Option options = 6;
- {
- unsigned int count = static_cast<unsigned int>(this->options_size());
- total_size += 1UL * count;
- for (unsigned int i = 0; i < count; i++) {
- total_size +=
- ::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::MessageSize(
- this->options(static_cast<int>(i)));
- }
+ total_size += 1UL * this->options_size();
+ for (const auto& msg : this->options_) {
+ total_size +=
+ ::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::MessageSize(msg);
}
// string name = 1;
if (this->name().size() > 0) {
total_size += 1 +
::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::StringSize(
- this->name());
+ this->_internal_name());
}
// string request_type_url = 2;
if (this->request_type_url().size() > 0) {
total_size += 1 +
::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::StringSize(
- this->request_type_url());
+ this->_internal_request_type_url());
}
// string response_type_url = 4;
if (this->response_type_url().size() > 0) {
total_size += 1 +
::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::StringSize(
- this->response_type_url());
+ this->_internal_response_type_url());
}
// bool request_streaming = 3;
@@ -1210,7 +1194,7 @@
void Method::InternalSwap(Method* other) {
using std::swap;
_internal_metadata_.Swap(&other->_internal_metadata_);
- CastToBase(&options_)->InternalSwap(CastToBase(&other->options_));
+ options_.InternalSwap(&other->options_);
name_.Swap(&other->name_, &::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(),
GetArenaNoVirtual());
request_type_url_.Swap(&other->request_type_url_, &::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(),
@@ -1245,11 +1229,11 @@
_internal_metadata_(nullptr) {
_internal_metadata_.MergeFrom(from._internal_metadata_);
name_.UnsafeSetDefault(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited());
- if (!from.name().empty()) {
+ if (!from._internal_name().empty()) {
name_.AssignWithDefault(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(), from.name_);
}
root_.UnsafeSetDefault(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited());
- if (!from.root().empty()) {
+ if (!from._internal_root().empty()) {
root_.AssignWithDefault(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(), from.root_);
}
// @@protoc_insertion_point(copy_constructor:google.protobuf.Mixin)
@@ -1302,14 +1286,14 @@
// string name = 1;
case 1:
if (PROTOBUF_PREDICT_TRUE(static_cast<::PROTOBUF_NAMESPACE_ID::uint8>(tag) == 10)) {
- ptr = ::PROTOBUF_NAMESPACE_ID::internal::InlineGreedyStringParserUTF8(mutable_name(), ptr, ctx, "google.protobuf.Mixin.name");
+ ptr = ::PROTOBUF_NAMESPACE_ID::internal::InlineGreedyStringParserUTF8(_internal_mutable_name(), ptr, ctx, "google.protobuf.Mixin.name");
CHK_(ptr);
} else goto handle_unusual;
continue;
// string root = 2;
case 2:
if (PROTOBUF_PREDICT_TRUE(static_cast<::PROTOBUF_NAMESPACE_ID::uint8>(tag) == 18)) {
- ptr = ::PROTOBUF_NAMESPACE_ID::internal::InlineGreedyStringParserUTF8(mutable_root(), ptr, ctx, "google.protobuf.Mixin.root");
+ ptr = ::PROTOBUF_NAMESPACE_ID::internal::InlineGreedyStringParserUTF8(_internal_mutable_root(), ptr, ctx, "google.protobuf.Mixin.root");
CHK_(ptr);
} else goto handle_unusual;
continue;
@@ -1347,9 +1331,9 @@
case 1: {
if (static_cast< ::PROTOBUF_NAMESPACE_ID::uint8>(tag) == (10 & 0xFF)) {
DO_(::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::ReadString(
- input, this->mutable_name()));
+ input, this->_internal_mutable_name()));
DO_(::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::VerifyUtf8String(
- this->name().data(), static_cast<int>(this->name().length()),
+ this->_internal_name().data(), static_cast<int>(this->_internal_name().length()),
::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::PARSE,
"google.protobuf.Mixin.name"));
} else {
@@ -1362,9 +1346,9 @@
case 2: {
if (static_cast< ::PROTOBUF_NAMESPACE_ID::uint8>(tag) == (18 & 0xFF)) {
DO_(::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::ReadString(
- input, this->mutable_root()));
+ input, this->_internal_mutable_root()));
DO_(::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::VerifyUtf8String(
- this->root().data(), static_cast<int>(this->root().length()),
+ this->_internal_root().data(), static_cast<int>(this->_internal_root().length()),
::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::PARSE,
"google.protobuf.Mixin.root"));
} else {
@@ -1403,21 +1387,21 @@
// string name = 1;
if (this->name().size() > 0) {
::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::VerifyUtf8String(
- this->name().data(), static_cast<int>(this->name().length()),
+ this->_internal_name().data(), static_cast<int>(this->_internal_name().length()),
::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::SERIALIZE,
"google.protobuf.Mixin.name");
target = stream->WriteStringMaybeAliased(
- 1, this->name(), target);
+ 1, this->_internal_name(), target);
}
// string root = 2;
if (this->root().size() > 0) {
::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::VerifyUtf8String(
- this->root().data(), static_cast<int>(this->root().length()),
+ this->_internal_root().data(), static_cast<int>(this->_internal_root().length()),
::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::SERIALIZE,
"google.protobuf.Mixin.root");
target = stream->WriteStringMaybeAliased(
- 2, this->root(), target);
+ 2, this->_internal_root(), target);
}
if (PROTOBUF_PREDICT_FALSE(_internal_metadata_.have_unknown_fields())) {
@@ -1440,14 +1424,14 @@
if (this->name().size() > 0) {
total_size += 1 +
::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::StringSize(
- this->name());
+ this->_internal_name());
}
// string root = 2;
if (this->root().size() > 0) {
total_size += 1 +
::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::StringSize(
- this->root());
+ this->_internal_root());
}
if (PROTOBUF_PREDICT_FALSE(_internal_metadata_.have_unknown_fields())) {
diff --git a/src/google/protobuf/api.pb.h b/src/google/protobuf/api.pb.h
index 836641f..4e2a745 100644
--- a/src/google/protobuf/api.pb.h
+++ b/src/google/protobuf/api.pb.h
@@ -238,6 +238,11 @@
std::string* mutable_name();
std::string* release_name();
void set_allocated_name(std::string* name);
+ private:
+ const std::string& _internal_name() const;
+ void _internal_set_name(const std::string& value);
+ std::string* _internal_mutable_name();
+ public:
// string version = 4;
void clear_version();
@@ -249,9 +254,17 @@
std::string* mutable_version();
std::string* release_version();
void set_allocated_version(std::string* version);
+ private:
+ const std::string& _internal_version() const;
+ void _internal_set_version(const std::string& value);
+ std::string* _internal_mutable_version();
+ public:
// .google.protobuf.SourceContext source_context = 5;
bool has_source_context() const;
+ private:
+ bool _internal_has_source_context() const;
+ public:
void clear_source_context();
const PROTOBUF_NAMESPACE_ID::SourceContext& source_context() const;
PROTOBUF_NAMESPACE_ID::SourceContext* release_source_context();
@@ -420,6 +433,11 @@
std::string* mutable_name();
std::string* release_name();
void set_allocated_name(std::string* name);
+ private:
+ const std::string& _internal_name() const;
+ void _internal_set_name(const std::string& value);
+ std::string* _internal_mutable_name();
+ public:
// string request_type_url = 2;
void clear_request_type_url();
@@ -431,6 +449,11 @@
std::string* mutable_request_type_url();
std::string* release_request_type_url();
void set_allocated_request_type_url(std::string* request_type_url);
+ private:
+ const std::string& _internal_request_type_url() const;
+ void _internal_set_request_type_url(const std::string& value);
+ std::string* _internal_mutable_request_type_url();
+ public:
// string response_type_url = 4;
void clear_response_type_url();
@@ -442,6 +465,11 @@
std::string* mutable_response_type_url();
std::string* release_response_type_url();
void set_allocated_response_type_url(std::string* response_type_url);
+ private:
+ const std::string& _internal_response_type_url() const;
+ void _internal_set_response_type_url(const std::string& value);
+ std::string* _internal_mutable_response_type_url();
+ public:
// bool request_streaming = 3;
void clear_request_streaming();
@@ -599,6 +627,11 @@
std::string* mutable_name();
std::string* release_name();
void set_allocated_name(std::string* name);
+ private:
+ const std::string& _internal_name() const;
+ void _internal_set_name(const std::string& value);
+ std::string* _internal_mutable_name();
+ public:
// string root = 2;
void clear_root();
@@ -610,6 +643,11 @@
std::string* mutable_root();
std::string* release_root();
void set_allocated_root(std::string* root);
+ private:
+ const std::string& _internal_root() const;
+ void _internal_set_root(const std::string& value);
+ std::string* _internal_mutable_root();
+ public:
// @@protoc_insertion_point(class_scope:google.protobuf.Mixin)
private:
@@ -638,12 +676,22 @@
}
inline const std::string& Api::name() const {
// @@protoc_insertion_point(field_get:google.protobuf.Api.name)
- return name_.GetNoArena();
+ return _internal_name();
}
inline void Api::set_name(const std::string& value) {
+ _internal_set_name(value);
+ // @@protoc_insertion_point(field_set:google.protobuf.Api.name)
+}
+inline std::string* Api::mutable_name() {
+ // @@protoc_insertion_point(field_mutable:google.protobuf.Api.name)
+ return _internal_mutable_name();
+}
+inline const std::string& Api::_internal_name() const {
+ return name_.GetNoArena();
+}
+inline void Api::_internal_set_name(const std::string& value) {
name_.SetNoArena(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(), value);
- // @@protoc_insertion_point(field_set:google.protobuf.Api.name)
}
inline void Api::set_name(std::string&& value) {
@@ -663,9 +711,8 @@
::std::string(reinterpret_cast<const char*>(value), size));
// @@protoc_insertion_point(field_set_pointer:google.protobuf.Api.name)
}
-inline std::string* Api::mutable_name() {
+inline std::string* Api::_internal_mutable_name() {
- // @@protoc_insertion_point(field_mutable:google.protobuf.Api.name)
return name_.MutableNoArena(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited());
}
inline std::string* Api::release_name() {
@@ -746,12 +793,22 @@
}
inline const std::string& Api::version() const {
// @@protoc_insertion_point(field_get:google.protobuf.Api.version)
- return version_.GetNoArena();
+ return _internal_version();
}
inline void Api::set_version(const std::string& value) {
+ _internal_set_version(value);
+ // @@protoc_insertion_point(field_set:google.protobuf.Api.version)
+}
+inline std::string* Api::mutable_version() {
+ // @@protoc_insertion_point(field_mutable:google.protobuf.Api.version)
+ return _internal_mutable_version();
+}
+inline const std::string& Api::_internal_version() const {
+ return version_.GetNoArena();
+}
+inline void Api::_internal_set_version(const std::string& value) {
version_.SetNoArena(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(), value);
- // @@protoc_insertion_point(field_set:google.protobuf.Api.version)
}
inline void Api::set_version(std::string&& value) {
@@ -771,9 +828,8 @@
::std::string(reinterpret_cast<const char*>(value), size));
// @@protoc_insertion_point(field_set_pointer:google.protobuf.Api.version)
}
-inline std::string* Api::mutable_version() {
+inline std::string* Api::_internal_mutable_version() {
- // @@protoc_insertion_point(field_mutable:google.protobuf.Api.version)
return version_.MutableNoArena(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited());
}
inline std::string* Api::release_version() {
@@ -890,12 +946,22 @@
}
inline const std::string& Method::name() const {
// @@protoc_insertion_point(field_get:google.protobuf.Method.name)
- return name_.GetNoArena();
+ return _internal_name();
}
inline void Method::set_name(const std::string& value) {
+ _internal_set_name(value);
+ // @@protoc_insertion_point(field_set:google.protobuf.Method.name)
+}
+inline std::string* Method::mutable_name() {
+ // @@protoc_insertion_point(field_mutable:google.protobuf.Method.name)
+ return _internal_mutable_name();
+}
+inline const std::string& Method::_internal_name() const {
+ return name_.GetNoArena();
+}
+inline void Method::_internal_set_name(const std::string& value) {
name_.SetNoArena(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(), value);
- // @@protoc_insertion_point(field_set:google.protobuf.Method.name)
}
inline void Method::set_name(std::string&& value) {
@@ -915,9 +981,8 @@
::std::string(reinterpret_cast<const char*>(value), size));
// @@protoc_insertion_point(field_set_pointer:google.protobuf.Method.name)
}
-inline std::string* Method::mutable_name() {
+inline std::string* Method::_internal_mutable_name() {
- // @@protoc_insertion_point(field_mutable:google.protobuf.Method.name)
return name_.MutableNoArena(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited());
}
inline std::string* Method::release_name() {
@@ -941,12 +1006,22 @@
}
inline const std::string& Method::request_type_url() const {
// @@protoc_insertion_point(field_get:google.protobuf.Method.request_type_url)
- return request_type_url_.GetNoArena();
+ return _internal_request_type_url();
}
inline void Method::set_request_type_url(const std::string& value) {
+ _internal_set_request_type_url(value);
+ // @@protoc_insertion_point(field_set:google.protobuf.Method.request_type_url)
+}
+inline std::string* Method::mutable_request_type_url() {
+ // @@protoc_insertion_point(field_mutable:google.protobuf.Method.request_type_url)
+ return _internal_mutable_request_type_url();
+}
+inline const std::string& Method::_internal_request_type_url() const {
+ return request_type_url_.GetNoArena();
+}
+inline void Method::_internal_set_request_type_url(const std::string& value) {
request_type_url_.SetNoArena(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(), value);
- // @@protoc_insertion_point(field_set:google.protobuf.Method.request_type_url)
}
inline void Method::set_request_type_url(std::string&& value) {
@@ -966,9 +1041,8 @@
::std::string(reinterpret_cast<const char*>(value), size));
// @@protoc_insertion_point(field_set_pointer:google.protobuf.Method.request_type_url)
}
-inline std::string* Method::mutable_request_type_url() {
+inline std::string* Method::_internal_mutable_request_type_url() {
- // @@protoc_insertion_point(field_mutable:google.protobuf.Method.request_type_url)
return request_type_url_.MutableNoArena(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited());
}
inline std::string* Method::release_request_type_url() {
@@ -1006,12 +1080,22 @@
}
inline const std::string& Method::response_type_url() const {
// @@protoc_insertion_point(field_get:google.protobuf.Method.response_type_url)
- return response_type_url_.GetNoArena();
+ return _internal_response_type_url();
}
inline void Method::set_response_type_url(const std::string& value) {
+ _internal_set_response_type_url(value);
+ // @@protoc_insertion_point(field_set:google.protobuf.Method.response_type_url)
+}
+inline std::string* Method::mutable_response_type_url() {
+ // @@protoc_insertion_point(field_mutable:google.protobuf.Method.response_type_url)
+ return _internal_mutable_response_type_url();
+}
+inline const std::string& Method::_internal_response_type_url() const {
+ return response_type_url_.GetNoArena();
+}
+inline void Method::_internal_set_response_type_url(const std::string& value) {
response_type_url_.SetNoArena(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(), value);
- // @@protoc_insertion_point(field_set:google.protobuf.Method.response_type_url)
}
inline void Method::set_response_type_url(std::string&& value) {
@@ -1031,9 +1115,8 @@
::std::string(reinterpret_cast<const char*>(value), size));
// @@protoc_insertion_point(field_set_pointer:google.protobuf.Method.response_type_url)
}
-inline std::string* Method::mutable_response_type_url() {
+inline std::string* Method::_internal_mutable_response_type_url() {
- // @@protoc_insertion_point(field_mutable:google.protobuf.Method.response_type_url)
return response_type_url_.MutableNoArena(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited());
}
inline std::string* Method::release_response_type_url() {
@@ -1116,12 +1199,22 @@
}
inline const std::string& Mixin::name() const {
// @@protoc_insertion_point(field_get:google.protobuf.Mixin.name)
- return name_.GetNoArena();
+ return _internal_name();
}
inline void Mixin::set_name(const std::string& value) {
+ _internal_set_name(value);
+ // @@protoc_insertion_point(field_set:google.protobuf.Mixin.name)
+}
+inline std::string* Mixin::mutable_name() {
+ // @@protoc_insertion_point(field_mutable:google.protobuf.Mixin.name)
+ return _internal_mutable_name();
+}
+inline const std::string& Mixin::_internal_name() const {
+ return name_.GetNoArena();
+}
+inline void Mixin::_internal_set_name(const std::string& value) {
name_.SetNoArena(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(), value);
- // @@protoc_insertion_point(field_set:google.protobuf.Mixin.name)
}
inline void Mixin::set_name(std::string&& value) {
@@ -1141,9 +1234,8 @@
::std::string(reinterpret_cast<const char*>(value), size));
// @@protoc_insertion_point(field_set_pointer:google.protobuf.Mixin.name)
}
-inline std::string* Mixin::mutable_name() {
+inline std::string* Mixin::_internal_mutable_name() {
- // @@protoc_insertion_point(field_mutable:google.protobuf.Mixin.name)
return name_.MutableNoArena(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited());
}
inline std::string* Mixin::release_name() {
@@ -1167,12 +1259,22 @@
}
inline const std::string& Mixin::root() const {
// @@protoc_insertion_point(field_get:google.protobuf.Mixin.root)
- return root_.GetNoArena();
+ return _internal_root();
}
inline void Mixin::set_root(const std::string& value) {
+ _internal_set_root(value);
+ // @@protoc_insertion_point(field_set:google.protobuf.Mixin.root)
+}
+inline std::string* Mixin::mutable_root() {
+ // @@protoc_insertion_point(field_mutable:google.protobuf.Mixin.root)
+ return _internal_mutable_root();
+}
+inline const std::string& Mixin::_internal_root() const {
+ return root_.GetNoArena();
+}
+inline void Mixin::_internal_set_root(const std::string& value) {
root_.SetNoArena(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(), value);
- // @@protoc_insertion_point(field_set:google.protobuf.Mixin.root)
}
inline void Mixin::set_root(std::string&& value) {
@@ -1192,9 +1294,8 @@
::std::string(reinterpret_cast<const char*>(value), size));
// @@protoc_insertion_point(field_set_pointer:google.protobuf.Mixin.root)
}
-inline std::string* Mixin::mutable_root() {
+inline std::string* Mixin::_internal_mutable_root() {
- // @@protoc_insertion_point(field_mutable:google.protobuf.Mixin.root)
return root_.MutableNoArena(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited());
}
inline std::string* Mixin::release_root() {
diff --git a/src/google/protobuf/arena.h b/src/google/protobuf/arena.h
index d38aed7..620e187 100644
--- a/src/google/protobuf/arena.h
+++ b/src/google/protobuf/arena.h
@@ -50,9 +50,9 @@
#include <typeinfo>
#endif
-#include <google/protobuf/port.h>
#include <type_traits>
#include <google/protobuf/arena_impl.h>
+#include <google/protobuf/port.h>
#include <google/protobuf/port_def.inc>
diff --git a/src/google/protobuf/compiler/command_line_interface.cc b/src/google/protobuf/compiler/command_line_interface.cc
index 557bec3..267ea3c 100644
--- a/src/google/protobuf/compiler/command_line_interface.cc
+++ b/src/google/protobuf/compiler/command_line_interface.cc
@@ -70,7 +70,6 @@
#include <google/protobuf/compiler/plugin.pb.h>
#include <google/protobuf/compiler/code_generator.h>
#include <google/protobuf/compiler/importer.h>
-#include <google/protobuf/io/io_win32.h>
#include <google/protobuf/io/coded_stream.h>
#include <google/protobuf/io/printer.h>
#include <google/protobuf/io/zero_copy_stream_impl.h>
@@ -79,8 +78,7 @@
#include <google/protobuf/text_format.h>
#include <google/protobuf/stubs/strutil.h>
#include <google/protobuf/stubs/substitute.h>
-
-
+#include <google/protobuf/io/io_win32.h>
#include <google/protobuf/stubs/map_util.h>
#include <google/protobuf/stubs/stl_util.h>
diff --git a/src/google/protobuf/compiler/command_line_interface_unittest.cc b/src/google/protobuf/compiler/command_line_interface_unittest.cc
index 6ea2565..01e69ee 100644
--- a/src/google/protobuf/compiler/command_line_interface_unittest.cc
+++ b/src/google/protobuf/compiler/command_line_interface_unittest.cc
@@ -45,22 +45,21 @@
#include <google/protobuf/stubs/stringprintf.h>
#include <google/protobuf/testing/file.h>
#include <google/protobuf/testing/file.h>
+#include <google/protobuf/testing/file.h>
#include <google/protobuf/compiler/mock_code_generator.h>
#include <google/protobuf/compiler/subprocess.h>
#include <google/protobuf/compiler/code_generator.h>
#include <google/protobuf/compiler/command_line_interface.h>
#include <google/protobuf/test_util2.h>
#include <google/protobuf/unittest.pb.h>
-#include <google/protobuf/io/io_win32.h>
#include <google/protobuf/io/printer.h>
#include <google/protobuf/io/zero_copy_stream.h>
#include <google/protobuf/descriptor.pb.h>
#include <google/protobuf/descriptor.h>
#include <google/protobuf/stubs/substitute.h>
-
-#include <google/protobuf/testing/file.h>
#include <google/protobuf/testing/googletest.h>
#include <gtest/gtest.h>
+#include <google/protobuf/io/io_win32.h>
#include <google/protobuf/stubs/strutil.h>
diff --git a/src/google/protobuf/compiler/cpp/cpp_extension.cc b/src/google/protobuf/compiler/cpp/cpp_extension.cc
index 97be5e6..8a661ea 100644
--- a/src/google/protobuf/compiler/cpp/cpp_extension.cc
+++ b/src/google/protobuf/compiler/cpp/cpp_extension.cc
@@ -39,8 +39,6 @@
#include <google/protobuf/io/printer.h>
#include <google/protobuf/stubs/strutil.h>
-
-
namespace google {
namespace protobuf {
namespace compiler {
diff --git a/src/google/protobuf/compiler/cpp/cpp_field.cc b/src/google/protobuf/compiler/cpp/cpp_field.cc
index 72d6fa2..e9b1d42 100644
--- a/src/google/protobuf/compiler/cpp/cpp_field.cc
+++ b/src/google/protobuf/compiler/cpp/cpp_field.cc
@@ -38,7 +38,6 @@
#include <google/protobuf/compiler/cpp/cpp_helpers.h>
#include <google/protobuf/compiler/cpp/cpp_primitive_field.h>
#include <google/protobuf/compiler/cpp/cpp_string_field.h>
-
#include <google/protobuf/stubs/logging.h>
#include <google/protobuf/stubs/common.h>
#include <google/protobuf/compiler/cpp/cpp_enum_field.h>
diff --git a/src/google/protobuf/compiler/cpp/cpp_file.cc b/src/google/protobuf/compiler/cpp/cpp_file.cc
index 3db64b4..8449b35 100644
--- a/src/google/protobuf/compiler/cpp/cpp_file.cc
+++ b/src/google/protobuf/compiler/cpp/cpp_file.cc
@@ -51,8 +51,6 @@
#include <google/protobuf/io/printer.h>
#include <google/protobuf/stubs/strutil.h>
-
-
#include <google/protobuf/port_def.inc>
namespace google {
@@ -440,17 +438,22 @@
void FileGenerator::GenerateSourceDefaultInstance(int idx,
io::Printer* printer) {
Formatter format(printer, variables_);
+ MessageGenerator* generator = message_generators_[idx].get();
format(
"class $1$ {\n"
" public:\n"
" ::$proto_ns$::internal::ExplicitlyConstructed<$2$> _instance;\n",
- DefaultInstanceType(message_generators_[idx]->descriptor_, options_),
- message_generators_[idx]->classname_);
+ DefaultInstanceType(generator->descriptor_, options_),
+ generator->classname_);
format.Indent();
- message_generators_[idx]->GenerateExtraDefaultFields(printer);
+ generator->GenerateExtraDefaultFields(printer);
format.Outdent();
- format("} $1$;\n",
- DefaultInstanceName(message_generators_[idx]->descriptor_, options_));
+ format("} $1$;\n", DefaultInstanceName(generator->descriptor_, options_));
+ if (options_.lite_implicit_weak_fields) {
+ format("$1$DefaultTypeInternal* $2$ = &$3$;\n", generator->classname_,
+ DefaultInstancePtr(generator->descriptor_, options_),
+ DefaultInstanceName(generator->descriptor_, options_));
+ }
}
// A list of things defined in one .pb.cc file that we need to reference from
@@ -513,19 +516,43 @@
}
for (auto scc : Sorted(refs.weak_sccs)) {
- format(
- "extern __attribute__((weak)) ::$proto_ns$::internal::SCCInfo<$1$> "
- "$2$;\n",
- scc->children.size(), SccInfoSymbol(scc, options_));
+ // We do things a little bit differently for proto1-style weak fields versus
+ // lite implicit weak fields, even though they are trying to accomplish
+ // similar things. We need to support implicit weak fields on iOS, and the
+ // Apple linker only supports weak definitions, not weak declarations. For
+ // that reason we need a pointer type which we can weakly define to be null.
+ // However, code size considerations prevent us from using the same approach
+ // for proto1-style weak fields.
+ if (options_.lite_implicit_weak_fields) {
+ format("extern ::$proto_ns$::internal::SCCInfo<$1$> $2$;\n",
+ scc->children.size(), SccInfoSymbol(scc, options_));
+ format(
+ "__attribute__((weak)) ::$proto_ns$::internal::SCCInfo<$1$>*\n"
+ " $2$ = nullptr;\n",
+ scc->children.size(), SccInfoPtrSymbol(scc, options_));
+ } else {
+ format(
+ "extern __attribute__((weak)) ::$proto_ns$::internal::SCCInfo<$1$> "
+ "$2$;\n",
+ scc->children.size(), SccInfoSymbol(scc, options_));
+ }
}
{
NamespaceOpener ns(format);
for (auto instance : Sorted(refs.weak_default_instances)) {
ns.ChangeTo(Namespace(instance, options_));
- format("extern __attribute__((weak)) $1$ $2$;\n",
- DefaultInstanceType(instance, options_),
- DefaultInstanceName(instance, options_));
+ if (options_.lite_implicit_weak_fields) {
+ format("extern $1$ $2$;\n", DefaultInstanceType(instance, options_),
+ DefaultInstanceName(instance, options_));
+ format("__attribute__((weak)) $1$* $2$ = nullptr;\n",
+ DefaultInstanceType(instance, options_),
+ DefaultInstancePtr(instance, options_));
+ } else {
+ format("extern __attribute__((weak)) $1$ $2$;\n",
+ DefaultInstanceType(instance, options_),
+ DefaultInstanceName(instance, options_));
+ }
}
}
@@ -555,7 +582,8 @@
GenerateInternalForwardDeclarations(refs, printer);
if (IsSCCRepresentative(message_generators_[idx]->descriptor_)) {
- GenerateInitForSCC(GetSCC(message_generators_[idx]->descriptor_), printer);
+ GenerateInitForSCC(GetSCC(message_generators_[idx]->descriptor_), refs,
+ printer);
}
{ // package namespace
@@ -649,7 +677,7 @@
// Now generate the InitDefaults for each SCC.
for (auto scc : sccs_) {
- GenerateInitForSCC(scc, printer);
+ GenerateInitForSCC(scc, refs, printer);
}
if (HasDescriptorMethods(file_, options_)) {
@@ -904,7 +932,9 @@
}
}
-void FileGenerator::GenerateInitForSCC(const SCC* scc, io::Printer* printer) {
+void FileGenerator::GenerateInitForSCC(const SCC* scc,
+ const CrossFileReferences& refs,
+ io::Printer* printer) {
Formatter format(printer, variables_);
// We use static and not anonymous namespace because symbol names are
// substantially shorter.
@@ -954,17 +984,46 @@
format.Outdent();
format("}\n\n");
+ // If we are using lite implicit weak fields then we need to distinguish
+ // between regular SCC dependencies and ones that we need to reference weakly
+ // through an extra pointer indirection.
+ std::vector<const SCC*> regular_sccs;
+ std::vector<const SCC*> implicit_weak_sccs;
+ for (const SCC* child : scc->children) {
+ if (options_.lite_implicit_weak_fields &&
+ refs.weak_sccs.find(child) != refs.weak_sccs.end()) {
+ implicit_weak_sccs.push_back(child);
+ } else {
+ regular_sccs.push_back(child);
+ }
+ }
+
format(
"$dllexport_decl $::$proto_ns$::internal::SCCInfo<$1$> $2$ =\n"
" "
"{{ATOMIC_VAR_INIT(::$proto_ns$::internal::SCCInfoBase::kUninitialized), "
- "$1$, InitDefaults$2$}, {",
+ "$3$, $4$, InitDefaults$2$}, {",
scc->children.size(), // 1
- SccInfoSymbol(scc, options_));
- for (const SCC* child : scc->children) {
+ SccInfoSymbol(scc, options_), regular_sccs.size(),
+ implicit_weak_sccs.size());
+ for (const SCC* child : regular_sccs) {
format("\n &$1$.base,", SccInfoSymbol(child, options_));
}
+ for (const SCC* child : implicit_weak_sccs) {
+ format(
+ "\n reinterpret_cast<::$proto_ns$::internal::SCCInfoBase**>("
+ "\n &$1$),",
+ SccInfoPtrSymbol(child, options_));
+ }
format("}};\n\n");
+
+ if (options_.lite_implicit_weak_fields) {
+ format(
+ "$dllexport_decl $::$proto_ns$::internal::SCCInfo<$1$>*\n"
+ " $2$ = &$3$;\n\n",
+ scc->children.size(), SccInfoPtrSymbol(scc, options_),
+ SccInfoSymbol(scc, options_));
+ }
}
void FileGenerator::GenerateTables(io::Printer* printer) {
diff --git a/src/google/protobuf/compiler/cpp/cpp_file.h b/src/google/protobuf/compiler/cpp/cpp_file.h
index 33734c5..e81af42 100644
--- a/src/google/protobuf/compiler/cpp/cpp_file.h
+++ b/src/google/protobuf/compiler/cpp/cpp_file.h
@@ -113,7 +113,8 @@
void GenerateSourceIncludes(io::Printer* printer);
void GenerateSourceDefaultInstance(int idx, io::Printer* printer);
- void GenerateInitForSCC(const SCC* scc, io::Printer* printer);
+ void GenerateInitForSCC(const SCC* scc, const CrossFileReferences& refs,
+ io::Printer* printer);
void GenerateTables(io::Printer* printer);
void GenerateReflectionInitializationCode(io::Printer* printer);
diff --git a/src/google/protobuf/compiler/cpp/cpp_generator.cc b/src/google/protobuf/compiler/cpp/cpp_generator.cc
index 7de0765..0d80ea2 100644
--- a/src/google/protobuf/compiler/cpp/cpp_generator.cc
+++ b/src/google/protobuf/compiler/cpp/cpp_generator.cc
@@ -45,8 +45,6 @@
#include <google/protobuf/io/printer.h>
#include <google/protobuf/io/zero_copy_stream.h>
-
-
namespace google {
namespace protobuf {
namespace compiler {
diff --git a/src/google/protobuf/compiler/cpp/cpp_helpers.cc b/src/google/protobuf/compiler/cpp/cpp_helpers.cc
index 624bbd3..8f9b89c 100644
--- a/src/google/protobuf/compiler/cpp/cpp_helpers.cc
+++ b/src/google/protobuf/compiler/cpp/cpp_helpers.cc
@@ -44,7 +44,6 @@
#include <google/protobuf/stubs/common.h>
#include <google/protobuf/stubs/logging.h>
#include <google/protobuf/descriptor.h>
-
#include <google/protobuf/compiler/scc.h>
#include <google/protobuf/io/printer.h>
#include <google/protobuf/io/zero_copy_stream.h>
@@ -52,8 +51,6 @@
#include <google/protobuf/wire_format_lite.h>
#include <google/protobuf/stubs/strutil.h>
#include <google/protobuf/stubs/substitute.h>
-
-
#include <google/protobuf/stubs/hash.h>
#include <google/protobuf/port_def.inc>
@@ -204,6 +201,10 @@
(*variables)[type] = IntTypeName(options, type);
}
+bool HasInternalAccessors(const FieldOptions::CType ctype) {
+ return ctype == FieldOptions::STRING;
+}
+
} // namespace
void SetCommonVars(const Options& options,
@@ -373,12 +374,22 @@
return "_" + ClassName(descriptor, false) + "_default_instance_";
}
+std::string DefaultInstancePtr(const Descriptor* descriptor,
+ const Options& options) {
+ return DefaultInstanceName(descriptor, options) + "ptr_";
+}
+
std::string QualifiedDefaultInstanceName(const Descriptor* descriptor,
const Options& options) {
return QualifiedFileLevelSymbol(
descriptor->file(), DefaultInstanceName(descriptor, options), options);
}
+std::string QualifiedDefaultInstancePtr(const Descriptor* descriptor,
+ const Options& options) {
+ return QualifiedDefaultInstanceName(descriptor, options) + "ptr_";
+}
+
std::string DescriptorTableName(const FileDescriptor* file,
const Options& options) {
return UniqueName("descriptor_table", file, options);
@@ -1125,7 +1136,7 @@
MessageSCCAnalyzer* scc_analyzer) {
return UsingImplicitWeakFields(field->file(), options) &&
field->type() == FieldDescriptor::TYPE_MESSAGE &&
- !field->is_required() && !field->is_map() &&
+ !field->is_required() && !field->is_map() && !field->is_extension() &&
field->containing_oneof() == nullptr &&
!IsWellKnownMessage(field->message_type()->file()) &&
field->message_type()->file()->name() !=
@@ -1479,7 +1490,8 @@
name = "StringPieceParser" + utf8;
break;
}
- format_("ptr = $pi_ns$::Inline$1$($2$_$3$(), ptr, ctx$4$);\n", name,
+ format_("ptr = $pi_ns$::Inline$1$($2$$3$_$4$(), ptr, ctx$5$);\n", name,
+ HasInternalAccessors(ctype) ? "_internal_" : "",
field->is_repeated() && !field->is_packable() ? "add" : "mutable",
FieldName(field), field_name);
}
@@ -1551,10 +1563,9 @@
FieldName(field));
} else {
format_(
- "ptr = ctx->ParseMessage("
- "CastToBase(&$1$_)->AddWeak(reinterpret_cast<const "
- "::$proto_ns$::MessageLite*>(&$2$::_$3$_default_instance_)), "
- "ptr);\n",
+ "ptr = ctx->ParseMessage($1$_.AddWeak(reinterpret_cast<const "
+ "::$proto_ns$::MessageLite*>($2$::_$3$_default_instance_ptr_)"
+ "), ptr);\n",
FieldName(field), Namespace(field->message_type(), options_),
ClassName(field->message_type()));
}
@@ -1757,12 +1768,11 @@
}
GenerateFieldBody(wiretype, field);
if (is_repeat) {
- string type = tag_size == 2 ? "uint16" : "uint8";
format_.Outdent();
format_(
" if (!ctx->DataAvailable(ptr)) break;\n"
- "} while ($pi_ns$::UnalignedLoad<$1$>(ptr) == $2$);\n",
- IntTypeName(options_, type), SmallVarintValue(tag));
+ "} while ($pi_ns$::ExpectTag<$1$>(ptr));\n",
+ tag);
}
format_.Outdent();
if (fallback_tag) {
diff --git a/src/google/protobuf/compiler/cpp/cpp_helpers.h b/src/google/protobuf/compiler/cpp/cpp_helpers.h
index fd518e0..abb3979 100644
--- a/src/google/protobuf/compiler/cpp/cpp_helpers.h
+++ b/src/google/protobuf/compiler/cpp/cpp_helpers.h
@@ -49,7 +49,6 @@
#include <google/protobuf/port.h>
#include <google/protobuf/stubs/strutil.h>
-
#include <google/protobuf/port_def.inc>
namespace google {
@@ -133,10 +132,19 @@
std::string DefaultInstanceName(const Descriptor* descriptor,
const Options& options);
+// Non-qualified name of the default instance pointer. This is used only for
+// implicit weak fields, where we need an extra indirection.
+std::string DefaultInstancePtr(const Descriptor* descriptor,
+ const Options& options);
+
// Fully qualified name of the default_instance of this message.
std::string QualifiedDefaultInstanceName(const Descriptor* descriptor,
const Options& options);
+// Fully qualified name of the default instance pointer.
+std::string QualifiedDefaultInstancePtr(const Descriptor* descriptor,
+ const Options& options);
+
// DescriptorTable variable name.
std::string DescriptorTableName(const FileDescriptor* file,
const Options& options);
@@ -549,6 +557,11 @@
scc->GetRepresentative(), options);
}
+inline std::string SccInfoPtrSymbol(const SCC* scc, const Options& options) {
+ return UniqueName("scc_info_ptr_" + ClassName(scc->GetRepresentative()),
+ scc->GetRepresentative(), options);
+}
+
void ListAllFields(const Descriptor* d,
std::vector<const FieldDescriptor*>* fields);
void ListAllFields(const FileDescriptor* d,
diff --git a/src/google/protobuf/compiler/cpp/cpp_message.cc b/src/google/protobuf/compiler/cpp/cpp_message.cc
index 8dba163..a02dd19 100644
--- a/src/google/protobuf/compiler/cpp/cpp_message.cc
+++ b/src/google/protobuf/compiler/cpp/cpp_message.cc
@@ -55,8 +55,6 @@
#include <google/protobuf/wire_format.h>
#include <google/protobuf/stubs/strutil.h>
#include <google/protobuf/stubs/substitute.h>
-
-
#include <google/protobuf/stubs/hash.h>
@@ -738,7 +736,12 @@
if (field->is_repeated()) {
format("$deprecated_attr$int ${1$$name$_size$}$() const;\n", field);
} else if (HasHasMethod(field)) {
- format("$deprecated_attr$bool ${1$has_$name$$}$() const;\n", field);
+ format(
+ "$deprecated_attr$bool ${1$has_$name$$}$() const;\n"
+ "private:\n"
+ "bool _internal_has_$name$() const;\n"
+ "public:\n",
+ field);
} else if (HasPrivateHasMethod(field)) {
format(
"private:\n"
@@ -800,9 +803,12 @@
format.Set("has_mask",
strings::Hex(1u << (has_bit_index % 32), strings::ZERO_PAD_8));
format(
+ "inline bool $classname$::_internal_has_$name$() const {\n"
+ " return (_has_bits_[$has_array_index$] & 0x$has_mask$u) != 0;\n"
+ "}\n"
"inline bool $classname$::has_$name$() const {\n"
"$annotate_accessor$"
- " return (_has_bits_[$has_array_index$] & 0x$has_mask$u) != 0;\n"
+ " return _internal_has_$name$();\n"
"}\n");
} else {
// Message fields have a has_$name$() method.
@@ -849,13 +855,28 @@
// Oneofs also have has_$name$() but only as a private helper
// method, so that generated code is slightly cleaner (vs. comparing
// _oneof_case_[index] against a constant everywhere).
+ //
+ // If has_$name$() is private, there is no need to add an internal accessor.
+ // Only annotate public accessors.
+ if (HasPrivateHasMethod(field)) {
+ format(
+ "inline bool $classname$::has_$name$() const {\n"
+ " return $oneof_name$_case() == k$field_name$;\n"
+ "}\n");
+ } else {
+ format(
+ "inline bool $classname$::_internal_has_$name$() const {\n"
+ " return $oneof_name$_case() == k$field_name$;\n"
+ "}\n"
+ "inline bool $classname$::has_$name$() const {\n"
+ "$annotate_accessor$"
+ " return _internal_has_$name$();\n"
+ "}\n");
+ }
+ // set_has_$name$() for oneof fields is always private; hence should not be
+ // annotated.
format(
- "inline bool $classname$::has_$name$() const {\n"
- "$annotate_accessor$"
- " return $oneof_name$_case() == k$field_name$;\n"
- "}\n"
"inline void $classname$::set_has_$name$() {\n"
- "$annotate_accessor$"
" _oneof_case_[$oneof_index$] = k$field_name$;\n"
"}\n");
}
@@ -918,8 +939,12 @@
format(
"inline int $classname$::$name$_size() const {\n"
"$annotate_accessor$"
- " return $name$_.size();\n"
- "}\n");
+ " return $name$_$1$.size();\n"
+ "}\n",
+ IsImplicitWeakField(field, options_, scc_analyzer_) &&
+ field->message_type()
+ ? ".weak"
+ : "");
} else if (field->containing_oneof()) {
format.Set("field_name", UnderscoresToCamelCase(field->name(), true));
format.Set("oneof_name", field->containing_oneof()->name());
@@ -1943,10 +1968,18 @@
options_)); // 1
continue;
}
- format(
- "$package_ns$::$name$_ = const_cast< $1$*>(\n"
- " $1$::internal_default_instance());\n",
- FieldMessageTypeName(field, options_));
+ if (IsImplicitWeakField(field, options_, scc_analyzer_)) {
+ format(
+ "$package_ns$::$name$_ = reinterpret_cast<$1$*>(\n"
+ " $2$);\n",
+ FieldMessageTypeName(field, options_),
+ QualifiedDefaultInstancePtr(field->message_type(), options_));
+ } else {
+ format(
+ "$package_ns$::$name$_ = const_cast< $1$*>(\n"
+ " $1$::internal_default_instance());\n",
+ FieldMessageTypeName(field, options_));
+ }
} else if (field->containing_oneof() &&
HasDescriptorMethods(descriptor_->file(), options_)) {
field_generators_.get(field).GenerateConstructorCode(printer);
@@ -4295,7 +4328,9 @@
if (field->is_repeated()) {
if (IsImplicitWeakField(field, options_, scc_analyzer_)) {
format(
- "if (!::$proto_ns$::internal::AllAreInitializedWeak(this->$1$_))"
+ "if "
+ "(!::$proto_ns$::internal::AllAreInitializedWeak(this->$1$_.weak)"
+ ")"
" return false;\n",
FieldName(field));
} else {
diff --git a/src/google/protobuf/compiler/cpp/cpp_message_field.cc b/src/google/protobuf/compiler/cpp/cpp_message_field.cc
index 7d621e0..d8d5fdb 100644
--- a/src/google/protobuf/compiler/cpp/cpp_message_field.cc
+++ b/src/google/protobuf/compiler/cpp/cpp_message_field.cc
@@ -62,6 +62,8 @@
(*variables)["type"] + "*", (*variables)["name"] + "_", implicit_weak);
(*variables)["type_default_instance"] =
QualifiedDefaultInstanceName(descriptor->message_type(), options);
+ (*variables)["type_default_instance_ptr"] =
+ QualifiedDefaultInstancePtr(descriptor->message_type(), options);
(*variables)["type_reference_function"] =
implicit_weak
? (" " + ReferenceFunctionName(descriptor->message_type(), options) +
@@ -149,47 +151,40 @@
format(
"inline const $type$& $classname$::$name$() const {\n"
"$annotate_accessor$"
+ "$type_reference_function$"
" const $type$* p = $casted_member$;\n"
" // @@protoc_insertion_point(field_get:$full_name$)\n"
" return p != nullptr ? *p : *reinterpret_cast<const $type$*>(\n"
" &$type_default_instance$);\n"
"}\n");
+ if (SupportsArenas(descriptor_)) {
+ format(
+ "inline $type$* $classname$::$release_name$() {\n"
+ " auto temp = unsafe_arena_release_$name$();\n"
+ " if (GetArenaNoVirtual() != nullptr) {\n"
+ " temp = ::$proto_ns$::internal::DuplicateIfNonNull(temp);\n"
+ " }\n"
+ " return temp;\n"
+ "}\n"
+ "inline $type$* $classname$::unsafe_arena_release_$name$() {\n");
+ } else {
+ format("inline $type$* $classname$::$release_name$() {\n");
+ }
format(
- "inline $type$* $classname$::$release_name$() {\n"
"$annotate_accessor$"
" // @@protoc_insertion_point(field_release:$full_name$)\n"
"$type_reference_function$"
" $clear_hasbit$\n"
- " $type$* temp = $casted_member$;\n");
- if (SupportsArenas(descriptor_)) {
- format(
- " if (GetArenaNoVirtual() != nullptr) {\n"
- " temp = ::$proto_ns$::internal::DuplicateIfNonNull(temp);\n"
- " }\n");
- }
- format(
+ " $type$* temp = $casted_member$;\n"
" $name$_ = nullptr;\n"
" return temp;\n"
"}\n");
- if (SupportsArenas(descriptor_)) {
- format(
- "inline $type$* $classname$::unsafe_arena_release_$name$() {\n"
- "$annotate_accessor$"
- " // "
- "@@protoc_insertion_point(field_unsafe_arena_release:$full_name$)\n"
- "$type_reference_function$"
- " $clear_hasbit$\n"
- " $type$* temp = $casted_member$;\n"
- " $name$_ = nullptr;\n"
- " return temp;\n"
- "}\n");
- }
-
format(
"inline $type$* $classname$::mutable_$name$() {\n"
"$annotate_accessor$"
+ "$type_reference_function$"
" $set_hasbit$\n"
" if ($name$_ == nullptr) {\n"
" auto* p = CreateMaybeMessage<$type$>(GetArenaNoVirtual());\n");
@@ -283,9 +278,9 @@
" const $classname$* msg) {\n"
" if (msg->$name$_ != nullptr) {\n"
" return *msg->$name$_;\n"
- " } else if (&$type_default_instance$ != nullptr) {\n"
+ " } else if ($type_default_instance_ptr$ != nullptr) {\n"
" return *reinterpret_cast<const ::$proto_ns$::MessageLite*>(\n"
- " &$type_default_instance$);\n"
+ " $type_default_instance_ptr$);\n"
" } else {\n"
" return "
"*::$proto_ns$::internal::ImplicitWeakMessage::default_instance();\n"
@@ -300,14 +295,14 @@
}
format(
" if (msg->$name$_ == nullptr) {\n"
- " if (&$type_default_instance$ == nullptr) {\n"
+ " if ($type_default_instance_ptr$ == nullptr) {\n"
" msg->$name$_ = ::$proto_ns$::Arena::CreateMessage<\n"
" ::$proto_ns$::internal::ImplicitWeakMessage>(\n"
" msg->GetArenaNoVirtual());\n"
" } else {\n"
" msg->$name$_ = reinterpret_cast<const "
"::$proto_ns$::MessageLite*>(\n"
- " &$type_default_instance$)->New("
+ " $type_default_instance_ptr$)->New("
"msg->GetArenaNoVirtual());\n"
" }\n"
" }\n"
@@ -322,13 +317,13 @@
}
format(
" if (msg->$name$_ == nullptr) {\n"
- " if (&$type_default_instance$ == nullptr) {\n"
+ " if ($type_default_instance_ptr$ == nullptr) {\n"
" msg->$name$_ = "
"new ::$proto_ns$::internal::ImplicitWeakMessage;\n"
" } else {\n"
" msg->$name$_ = "
"reinterpret_cast<const ::$proto_ns$::MessageLite*>(\n"
- " &$type_default_instance$)->New();\n"
+ " $type_default_instance_ptr$)->New();\n"
" }\n"
" }\n"
" return msg->$name$_;\n"
@@ -637,7 +632,11 @@
void RepeatedMessageFieldGenerator::GeneratePrivateMembers(
io::Printer* printer) const {
Formatter format(printer, variables_);
- format("::$proto_ns$::RepeatedPtrField< $type$ > $name$_;\n");
+ if (implicit_weak_field_) {
+ format("::$proto_ns$::WeakRepeatedPtrField< $type$ > $name$_;\n");
+ } else {
+ format("::$proto_ns$::RepeatedPtrField< $type$ > $name$_;\n");
+ }
}
void RepeatedMessageFieldGenerator::GenerateAccessorDeclarations(
@@ -657,20 +656,22 @@
void RepeatedMessageFieldGenerator::GenerateInlineAccessorDefinitions(
io::Printer* printer) const {
Formatter format(printer, variables_);
+ format.Set("weak", implicit_weak_field_ ? ".weak" : "");
+
format(
"inline $type$* $classname$::mutable_$name$(int index) {\n"
"$annotate_accessor$"
// TODO(dlj): move insertion points
" // @@protoc_insertion_point(field_mutable:$full_name$)\n"
"$type_reference_function$"
- " return $name$_.Mutable(index);\n"
+ " return $name$_$weak$.Mutable(index);\n"
"}\n"
"inline ::$proto_ns$::RepeatedPtrField< $type$ >*\n"
"$classname$::mutable_$name$() {\n"
"$annotate_accessor$"
" // @@protoc_insertion_point(field_mutable_list:$full_name$)\n"
"$type_reference_function$"
- " return &$name$_;\n"
+ " return &$name$_$weak$;\n"
"}\n");
if (options_.safe_boundary_check) {
@@ -678,7 +679,7 @@
"inline const $type$& $classname$::$name$(int index) const {\n"
"$annotate_accessor$"
" // @@protoc_insertion_point(field_get:$full_name$)\n"
- " return $name$_.InternalCheckedGet(index,\n"
+ " return $name$_$weak$.InternalCheckedGet(index,\n"
" *reinterpret_cast<const $type$*>(&$type_default_instance$));\n"
"}\n");
} else {
@@ -687,7 +688,7 @@
"$annotate_accessor$"
" // @@protoc_insertion_point(field_get:$full_name$)\n"
"$type_reference_function$"
- " return $name$_.Get(index);\n"
+ " return $name$_$weak$.Get(index);\n"
"}\n");
}
@@ -695,7 +696,7 @@
"inline $type$* $classname$::add_$name$() {\n"
"$annotate_accessor$"
" // @@protoc_insertion_point(field_add:$full_name$)\n"
- " return $name$_.Add();\n"
+ " return $name$_$weak$.Add();\n"
"}\n");
format(
@@ -704,39 +705,26 @@
"$annotate_accessor$"
" // @@protoc_insertion_point(field_list:$full_name$)\n"
"$type_reference_function$"
- " return $name$_;\n"
+ " return $name$_$weak$;\n"
"}\n");
}
void RepeatedMessageFieldGenerator::GenerateClearingCode(
io::Printer* printer) const {
Formatter format(printer, variables_);
- if (implicit_weak_field_) {
- format(
- "CastToBase(&$name$_)->Clear<"
- "::$proto_ns$::internal::ImplicitWeakTypeHandler<$type$>>();\n");
- } else {
- format("$name$_.Clear();\n");
- }
+ format("$name$_.Clear();\n");
}
void RepeatedMessageFieldGenerator::GenerateMergingCode(
io::Printer* printer) const {
Formatter format(printer, variables_);
- if (implicit_weak_field_) {
- format(
- "CastToBase(&$name$_)->MergeFrom<"
- "::$proto_ns$::internal::ImplicitWeakTypeHandler<$type$>>(CastToBase("
- "from.$name$_));\n");
- } else {
- format("$name$_.MergeFrom(from.$name$_);\n");
- }
+ format("$name$_.MergeFrom(from.$name$_);\n");
}
void RepeatedMessageFieldGenerator::GenerateSwappingCode(
io::Printer* printer) const {
Formatter format(printer, variables_);
- format("CastToBase(&$name$_)->InternalSwap(CastToBase(&other->$name$_));\n");
+ format("$name$_.InternalSwap(&other->$name$_);\n");
}
void RepeatedMessageFieldGenerator::GenerateConstructorCode(
@@ -751,9 +739,9 @@
if (implicit_weak_field_) {
format(
"DO_(::$proto_ns$::internal::WireFormatLite::"
- "ReadMessage(input, CastToBase(&$name$_)->AddWeak(\n"
+ "ReadMessage(input, $name$_.AddWeak(\n"
" reinterpret_cast<const ::$proto_ns$::MessageLite*>(\n"
- " &$type_default_instance$))));\n");
+ " $type_default_instance_ptr$))));\n");
} else {
format(
"DO_(::$proto_ns$::internal::WireFormatLite::"
@@ -770,55 +758,25 @@
void RepeatedMessageFieldGenerator::GenerateSerializeWithCachedSizesToArray(
io::Printer* printer) const {
Formatter format(printer, variables_);
- if (implicit_weak_field_) {
- format(
- "for (unsigned int i = 0,\n"
- " n = static_cast<unsigned int>(this->$name$_size()); i < n; i++) "
- "{\n"
- " stream->EnsureSpace(&target);\n"
- " target = ::$proto_ns$::internal::WireFormatLite::\n"
- " InternalWrite$declared_type$ToArray(\n"
- " $number$,\n"
- " CastToBase($name$_).Get<"
- "::$proto_ns$::internal::ImplicitWeakTypeHandler<$type$>>("
- "static_cast<int>(i)), target, stream);\n"
- "}\n");
- } else {
- format(
- "for (auto it = this->$name$().pointer_begin(),\n"
- " end = this->$name$().pointer_end(); it < end; ++it) {\n"
- " stream->EnsureSpace(&target);\n"
- " target = ::$proto_ns$::internal::WireFormatLite::\n"
- " InternalWrite$declared_type$ToArray($number$, **it, target, "
- "stream);\n"
- "}\n");
- }
+ format(
+ "for (auto it = this->$name$_.pointer_begin(),\n"
+ " end = this->$name$_.pointer_end(); it < end; ++it) {\n"
+ " stream->EnsureSpace(&target);\n"
+ " target = ::$proto_ns$::internal::WireFormatLite::\n"
+ " InternalWrite$declared_type$ToArray($number$, **it, target, "
+ "stream);\n"
+ "}\n");
}
void RepeatedMessageFieldGenerator::GenerateByteSize(
io::Printer* printer) const {
Formatter format(printer, variables_);
format(
- "{\n"
- " unsigned int count = static_cast<unsigned "
- "int>(this->$name$_size());\n");
- format.Indent();
- format(
- "total_size += $tag_size$UL * count;\n"
- "for (unsigned int i = 0; i < count; i++) {\n"
+ "total_size += $tag_size$UL * this->$name$_size();\n"
+ "for (const auto& msg : this->$name$_) {\n"
" total_size +=\n"
- " ::$proto_ns$::internal::WireFormatLite::$declared_type$Size(\n");
- if (implicit_weak_field_) {
- format(
- " CastToBase($name$_).Get<"
- "::$proto_ns$::internal::ImplicitWeakTypeHandler<$type$>>("
- "static_cast<int>(i)));\n");
- } else {
- format(" this->$name$(static_cast<int>(i)));\n");
- }
- format("}\n");
- format.Outdent();
- format("}\n");
+ " ::$proto_ns$::internal::WireFormatLite::$declared_type$Size(msg);\n"
+ "}\n");
}
} // namespace cpp
diff --git a/src/google/protobuf/compiler/cpp/cpp_primitive_field.cc b/src/google/protobuf/compiler/cpp/cpp_primitive_field.cc
index 62dcdcc..db9a300 100644
--- a/src/google/protobuf/compiler/cpp/cpp_primitive_field.cc
+++ b/src/google/protobuf/compiler/cpp/cpp_primitive_field.cc
@@ -38,7 +38,6 @@
#include <google/protobuf/wire_format.h>
#include <google/protobuf/stubs/strutil.h>
-
namespace google {
namespace protobuf {
namespace compiler {
diff --git a/src/google/protobuf/compiler/cpp/cpp_string_field.cc b/src/google/protobuf/compiler/cpp/cpp_string_field.cc
index 455ac6e..76d0097 100644
--- a/src/google/protobuf/compiler/cpp/cpp_string_field.cc
+++ b/src/google/protobuf/compiler/cpp/cpp_string_field.cc
@@ -39,7 +39,6 @@
#include <google/protobuf/stubs/strutil.h>
-
namespace google {
namespace protobuf {
namespace compiler {
@@ -197,6 +196,12 @@
descriptor_);
}
}
+ format(
+ "private:\n"
+ "const std::string& _internal_$name$() const;\n"
+ "void _internal_set_$name$(const std::string& value);\n"
+ "std::string* _internal_mutable_$name$();\n"
+ "public:\n");
if (unknown_ctype) {
format.Outdent();
@@ -208,18 +213,31 @@
void StringFieldGenerator::GenerateInlineAccessorDefinitions(
io::Printer* printer) const {
Formatter format(printer, variables_);
+ format(
+ "inline const std::string& $classname$::$name$() const {\n"
+ "$annotate_accessor$"
+ " // @@protoc_insertion_point(field_get:$full_name$)\n"
+ " return _internal_$name$();\n"
+ "}\n"
+ "inline void $classname$::set_$name$(const std::string& value) {\n"
+ "$annotate_accessor$"
+ " _internal_set_$name$(value);\n"
+ " // @@protoc_insertion_point(field_set:$full_name$)\n"
+ "}\n"
+ "inline std::string* $classname$::mutable_$name$() {\n"
+ "$annotate_accessor$"
+ " // @@protoc_insertion_point(field_mutable:$full_name$)\n"
+ " return _internal_mutable_$name$();\n"
+ "}\n");
if (SupportsArenas(descriptor_)) {
format(
- "inline const std::string& $classname$::$name$() const {\n"
- "$annotate_accessor$"
- " // @@protoc_insertion_point(field_get:$full_name$)\n"
+ "inline const std::string& $classname$::_internal_$name$() const {\n"
" return $name$_.Get();\n"
"}\n"
- "inline void $classname$::set_$name$(const std::string& value) {\n"
- "$annotate_accessor$"
+ "inline void $classname$::_internal_set_$name$(const std::string& "
+ "value) {\n"
" $set_hasbit$\n"
" $name$_.Set$lite$($default_variable$, value, GetArenaNoVirtual());\n"
- " // @@protoc_insertion_point(field_set:$full_name$)\n"
"}\n"
"inline void $classname$::set_$name$(std::string&& value) {\n"
"$annotate_accessor$"
@@ -257,10 +275,8 @@
"GetArenaNoVirtual());\n"
" // @@protoc_insertion_point(field_set_pointer:$full_name$)\n"
"}\n"
- "inline std::string* $classname$::mutable_$name$() {\n"
- "$annotate_accessor$"
+ "inline std::string* $classname$::_internal_mutable_$name$() {\n"
" $set_hasbit$\n"
- " // @@protoc_insertion_point(field_mutable:$full_name$)\n"
" return $name$_.Mutable($default_variable$, GetArenaNoVirtual());\n"
"}\n"
"inline std::string* $classname$::$release_name$() {\n"
@@ -324,16 +340,13 @@
} else {
// No-arena case.
format(
- "inline const std::string& $classname$::$name$() const {\n"
- "$annotate_accessor$"
- " // @@protoc_insertion_point(field_get:$full_name$)\n"
+ "inline const std::string& $classname$::_internal_$name$() const {\n"
" return $name$_.GetNoArena();\n"
"}\n"
- "inline void $classname$::set_$name$(const std::string& value) {\n"
- "$annotate_accessor$"
+ "inline void $classname$::_internal_set_$name$(const std::string& "
+ "value) {\n"
" $set_hasbit$\n"
" $name$_.SetNoArena($default_variable$, value);\n"
- " // @@protoc_insertion_point(field_set:$full_name$)\n"
"}\n"
"inline void $classname$::set_$name$(std::string&& value) {\n"
"$annotate_accessor$"
@@ -368,10 +381,8 @@
" $string_piece$(reinterpret_cast<const char*>(value), size));\n"
" // @@protoc_insertion_point(field_set_pointer:$full_name$)\n"
"}\n"
- "inline std::string* $classname$::mutable_$name$() {\n"
- "$annotate_accessor$"
+ "inline std::string* $classname$::_internal_mutable_$name$() {\n"
" $set_hasbit$\n"
- " // @@protoc_insertion_point(field_mutable:$full_name$)\n"
" return $name$_.MutableNoArena($default_variable$);\n"
"}\n"
"inline std::string* $classname$::$release_name$() {\n"
@@ -500,7 +511,7 @@
Formatter format(printer, variables_);
if (SupportsArenas(descriptor_) || descriptor_->containing_oneof() != NULL) {
// TODO(gpike): improve this
- format("set_$name$(from.$name$());\n");
+ format("_internal_set_$name$(from._internal_$name$());\n");
} else {
format(
"$set_hasbit$\n"
@@ -537,9 +548,9 @@
GenerateConstructorCode(printer);
if (HasFieldPresence(descriptor_->file())) {
- format("if (from.has_$name$()) {\n");
+ format("if (from._internal_has_$name$()) {\n");
} else {
- format("if (!from.$name$().empty()) {\n");
+ format("if (!from._internal_$name$().empty()) {\n");
}
format.Indent();
@@ -547,7 +558,7 @@
if (SupportsArenas(descriptor_) || descriptor_->containing_oneof() != NULL) {
// TODO(gpike): improve this
format(
- "$name$_.Set$lite$($default_variable$, from.$name$(),\n"
+ "$name$_.Set$lite$($default_variable$, from._internal_$name$(),\n"
" GetArenaNoVirtual());\n");
} else {
format("$name$_.AssignWithDefault($default_variable$, from.$name$_);\n");
@@ -612,18 +623,19 @@
" $name$_.UnsafeSetTaggedPointer(str);\n"
"} else {\n"
" DO_(::$proto_ns$::internal::WireFormatLite::Read$declared_type$(\n"
- " input, this->mutable_$name$()));\n"
+ " input, this->_internal_mutable_$name$()));\n"
"}\n");
} else {
format(
"DO_(::$proto_ns$::internal::WireFormatLite::Read$declared_type$(\n"
- " input, this->mutable_$name$()));\n");
+ " input, this->_internal_mutable_$name$()));\n");
}
if (descriptor_->type() == FieldDescriptor::TYPE_STRING) {
GenerateUtf8CheckCodeForString(
descriptor_, options_, true,
- "this->$name$().data(), static_cast<int>(this->$name$().length()),\n",
+ "this->_internal_$name$().data(), "
+ "static_cast<int>(this->_internal_$name$().length()),\n",
format);
}
}
@@ -638,12 +650,13 @@
if (descriptor_->type() == FieldDescriptor::TYPE_STRING) {
GenerateUtf8CheckCodeForString(
descriptor_, options_, false,
- "this->$name$().data(), static_cast<int>(this->$name$().length()),\n",
+ "this->_internal_$name$().data(), "
+ "static_cast<int>(this->_internal_$name$().length()),\n",
format);
}
format(
"target = stream->Write$declared_type$MaybeAliased(\n"
- " $number$, this->$name$(), target);\n");
+ " $number$, this->_internal_$name$(), target);\n");
}
void StringFieldGenerator::GenerateByteSize(io::Printer* printer) const {
@@ -651,7 +664,7 @@
format(
"total_size += $tag_size$ +\n"
" ::$proto_ns$::internal::WireFormatLite::$declared_type$Size(\n"
- " this->$name$());\n");
+ " this->_internal_$name$());\n");
}
uint32 StringFieldGenerator::CalculateFieldTag() const {
@@ -666,6 +679,13 @@
inlined_ = false;
SetCommonOneofFieldVariables(descriptor, &variables_);
+ variables_["field_name"] = UnderscoresToCamelCase(descriptor->name(), true);
+ variables_["oneof_index"] =
+ StrCat(descriptor->containing_oneof()->index());
+ // has_$name$() for oneof fields is private if has_bit is not present. In that
+ // case, use _has_$name$() instead of _internal_has_$name$().
+ variables_["internal"] =
+ HasFieldPresence(descriptor->file()) ? "_internal_" : "";
}
StringOneofFieldGenerator::~StringOneofFieldGenerator() {}
@@ -673,26 +693,39 @@
void StringOneofFieldGenerator::GenerateInlineAccessorDefinitions(
io::Printer* printer) const {
Formatter format(printer, variables_);
+ format(
+ "inline const std::string& $classname$::$name$() const {\n"
+ "$annotate_accessor$"
+ " // @@protoc_insertion_point(field_get:$full_name$)\n"
+ " return _internal_$name$();\n"
+ "}\n"
+ "inline void $classname$::set_$name$(const std::string& value) {\n"
+ "$annotate_accessor$"
+ " _internal_set_$name$(value);\n"
+ " // @@protoc_insertion_point(field_set:$full_name$)\n"
+ "}\n"
+ "inline std::string* $classname$::mutable_$name$() {\n"
+ "$annotate_accessor$"
+ " // @@protoc_insertion_point(field_mutable:$full_name$)\n"
+ " return _internal_mutable_$name$();\n"
+ "}\n");
if (SupportsArenas(descriptor_)) {
format(
- "inline const std::string& $classname$::$name$() const {\n"
- "$annotate_accessor$"
- " // @@protoc_insertion_point(field_get:$full_name$)\n"
- " if (has_$name$()) {\n"
+ "inline const std::string& $classname$::_internal_$name$() const {\n"
+ " if ($internal$has_$name$()) {\n"
" return $field_member$.Get();\n"
" }\n"
" return *$default_variable$;\n"
"}\n"
- "inline void $classname$::set_$name$(const std::string& value) {\n"
- "$annotate_accessor$"
- " if (!has_$name$()) {\n"
+ "inline void $classname$::_internal_set_$name$(const std::string& "
+ "value) {\n"
+ " if (!$internal$has_$name$()) {\n"
" clear_$oneof_name$();\n"
" set_has_$name$();\n"
" $field_member$.UnsafeSetDefault($default_variable$);\n"
" }\n"
" $field_member$.Set$lite$($default_variable$, value,\n"
" GetArenaNoVirtual());\n"
- " // @@protoc_insertion_point(field_set:$full_name$)\n"
"}\n"
"inline void $classname$::set_$name$(std::string&& value) {\n"
"$annotate_accessor$"
@@ -748,16 +781,14 @@
" GetArenaNoVirtual());\n"
" // @@protoc_insertion_point(field_set_pointer:$full_name$)\n"
"}\n"
- "inline std::string* $classname$::mutable_$name$() {\n"
- "$annotate_accessor$"
- " if (!has_$name$()) {\n"
+ "inline std::string* $classname$::_internal_mutable_$name$() {\n"
+ " if (!$internal$has_$name$()) {\n"
" clear_$oneof_name$();\n"
" set_has_$name$();\n"
" $field_member$.UnsafeSetDefault($default_variable$);\n"
" }\n"
" return $field_member$.Mutable($default_variable$,\n"
" GetArenaNoVirtual());\n"
- " // @@protoc_insertion_point(field_mutable:$full_name$)\n"
"}\n"
"inline std::string* $classname$::$release_name$() {\n"
"$annotate_accessor$"
@@ -816,24 +847,20 @@
} else {
// No-arena case.
format(
- "inline const std::string& $classname$::$name$() const {\n"
- "$annotate_accessor$"
- " // @@protoc_insertion_point(field_get:$full_name$)\n"
- " if (has_$name$()) {\n"
+ "inline const std::string& $classname$::_internal_$name$() const {\n"
+ " if ($internal$has_$name$()) {\n"
" return $field_member$.GetNoArena();\n"
" }\n"
" return *$default_variable$;\n"
"}\n"
- "inline void $classname$::set_$name$(const std::string& value) {\n"
- "$annotate_accessor$"
- " // @@protoc_insertion_point(field_set:$full_name$)\n"
- " if (!has_$name$()) {\n"
+ "inline void $classname$::_internal_set_$name$(const std::string& "
+ "value) {\n"
+ " if (!$internal$has_$name$()) {\n"
" clear_$oneof_name$();\n"
" set_has_$name$();\n"
" $field_member$.UnsafeSetDefault($default_variable$);\n"
" }\n"
" $field_member$.SetNoArena($default_variable$, value);\n"
- " // @@protoc_insertion_point(field_set:$full_name$)\n"
"}\n"
"inline void $classname$::set_$name$(std::string&& value) {\n"
"$annotate_accessor$"
@@ -885,14 +912,12 @@
" reinterpret_cast<const char*>(value), size));\n"
" // @@protoc_insertion_point(field_set_pointer:$full_name$)\n"
"}\n"
- "inline std::string* $classname$::mutable_$name$() {\n"
- "$annotate_accessor$"
- " if (!has_$name$()) {\n"
+ "inline std::string* $classname$::_internal_mutable_$name$() {\n"
+ " if (!$internal$has_$name$()) {\n"
" clear_$oneof_name$();\n"
" set_has_$name$();\n"
" $field_member$.UnsafeSetDefault($default_variable$);\n"
" }\n"
- " // @@protoc_insertion_point(field_mutable:$full_name$)\n"
" return $field_member$.MutableNoArena($default_variable$);\n"
"}\n"
"inline std::string* $classname$::$release_name$() {\n"
@@ -979,18 +1004,19 @@
" $field_member$.UnsafeSetTaggedPointer(new_value);\n"
"} else {\n"
" DO_(::$proto_ns$::internal::WireFormatLite::Read$declared_type$(\n"
- " input, this->mutable_$name$()));\n"
+ " input, this->_internal_mutable_$name$()));\n"
"}\n");
} else {
format(
"DO_(::$proto_ns$::internal::WireFormatLite::Read$declared_type$(\n"
- " input, this->mutable_$name$()));\n");
+ " input, this->_internal_mutable_$name$()));\n");
}
if (descriptor_->type() == FieldDescriptor::TYPE_STRING) {
GenerateUtf8CheckCodeForString(
descriptor_, options_, true,
- "this->$name$().data(), static_cast<int>(this->$name$().length()),\n",
+ "this->_internal_$name$().data(), "
+ "static_cast<int>(this->_internal_$name$().length()),\n",
format);
}
}
@@ -1064,7 +1090,10 @@
"const;\n"
"$deprecated_attr$::$proto_ns$::RepeatedPtrField<std::string>* "
"${1$mutable_$name$$}$()"
- ";\n",
+ ";\n"
+ "private:\n"
+ "std::string* _internal_add_$name$();\n"
+ "public:\n",
descriptor_);
if (unknown_ctype) {
@@ -1077,6 +1106,12 @@
void RepeatedStringFieldGenerator::GenerateInlineAccessorDefinitions(
io::Printer* printer) const {
Formatter format(printer, variables_);
+ format(
+ "inline std::string* $classname$::add_$name$() {\n"
+ "$annotate_accessor$"
+ " // @@protoc_insertion_point(field_add_mutable:$full_name$)\n"
+ " return _internal_add_$name$();\n"
+ "}\n");
if (options_.safe_boundary_check) {
format(
"inline const std::string& $classname$::$name$(int index) const {\n"
@@ -1135,9 +1170,7 @@
" reinterpret_cast<const char*>(value), size);\n"
" // @@protoc_insertion_point(field_set_pointer:$full_name$)\n"
"}\n"
- "inline std::string* $classname$::add_$name$() {\n"
- "$annotate_accessor$"
- " // @@protoc_insertion_point(field_add_mutable:$full_name$)\n"
+ "inline std::string* $classname$::_internal_add_$name$() {\n"
" return $name$_.Add();\n"
"}\n"
"inline void $classname$::add_$name$(const std::string& value) {\n"
@@ -1200,7 +1233,7 @@
void RepeatedStringFieldGenerator::GenerateSwappingCode(
io::Printer* printer) const {
Formatter format(printer, variables_);
- format("$name$_.InternalSwap(CastToBase(&other->$name$_));\n");
+ format("$name$_.InternalSwap(&other->$name$_);\n");
}
void RepeatedStringFieldGenerator::GenerateConstructorCode(
@@ -1219,12 +1252,12 @@
Formatter format(printer, variables_);
format(
"DO_(::$proto_ns$::internal::WireFormatLite::Read$declared_type$(\n"
- " input, this->add_$name$()));\n");
+ " input, this->_internal_add_$name$()));\n");
if (descriptor_->type() == FieldDescriptor::TYPE_STRING) {
GenerateUtf8CheckCodeForString(
descriptor_, options_, true,
- "this->$name$(this->$name$_size() - 1).data(),\n"
- "static_cast<int>(this->$name$(this->$name$_size() - 1).length()),\n",
+ "$name$_.Get($name$_.size() - 1).data(),\n"
+ "static_cast<int>($name$_.Get($name$_.size() - 1).length()),\n",
format);
}
}
@@ -1233,8 +1266,8 @@
io::Printer* printer) const {
Formatter format(printer, variables_);
format(
- "for (auto it = this->$name$().pointer_begin(),\n"
- " end = this->$name$().pointer_end(); it < end; ++it) {\n"
+ "for (auto it = $field_member$.pointer_begin(),\n"
+ " end = $field_member$.pointer_end(); it < end; ++it) {\n"
" const auto& s = **it;\n");
// format("for (const std::string& s : this->$name$()) {\n");
format.Indent();
@@ -1254,11 +1287,11 @@
Formatter format(printer, variables_);
format(
"total_size += $tag_size$ *\n"
- " ::$proto_ns$::internal::FromIntSize(this->$name$_size());\n"
- "for (int i = 0, n = this->$name$_size(); i < n; i++) {\n"
+ " ::$proto_ns$::internal::FromIntSize($name$_.size());\n"
+ "for (int i = 0, n = $name$_.size(); i < n; i++) {\n"
" total_size += "
"::$proto_ns$::internal::WireFormatLite::$declared_type$Size(\n"
- " this->$name$(i));\n"
+ " $name$_.Get(i));\n"
"}\n");
}
diff --git a/src/google/protobuf/compiler/csharp/csharp_doc_comment.cc b/src/google/protobuf/compiler/csharp/csharp_doc_comment.cc
index fcc0aec..a4e9ff4 100644
--- a/src/google/protobuf/compiler/csharp/csharp_doc_comment.cc
+++ b/src/google/protobuf/compiler/csharp/csharp_doc_comment.cc
@@ -57,7 +57,7 @@
comments = StringReplace(comments, "&", "&", true);
comments = StringReplace(comments, "<", "<", true);
std::vector<string> lines;
- SplitStringAllowEmpty(comments, "\n", &lines);
+ lines = Split(comments, "\n", false);
// TODO: We really should work out which part to put in the summary and which to put in the remarks...
// but that needs to be part of a bigger effort to understand the markdown better anyway.
printer->Print("/// <summary>\n");
diff --git a/src/google/protobuf/compiler/csharp/csharp_helpers.h b/src/google/protobuf/compiler/csharp/csharp_helpers.h
index df18348..c51681e 100644
--- a/src/google/protobuf/compiler/csharp/csharp_helpers.h
+++ b/src/google/protobuf/compiler/csharp/csharp_helpers.h
@@ -36,7 +36,7 @@
#define GOOGLE_PROTOBUF_COMPILER_CSHARP_HELPERS_H__
#include <string>
-#include <google/protobuf/stubs/port.h>
+#include <google/protobuf/stubs/common.h>
#include <google/protobuf/descriptor.pb.h>
#include <google/protobuf/descriptor.h>
#include <google/protobuf/compiler/code_generator.h>
diff --git a/src/google/protobuf/compiler/csharp/csharp_names.h b/src/google/protobuf/compiler/csharp/csharp_names.h
index 0c5ade9..fa3e245 100644
--- a/src/google/protobuf/compiler/csharp/csharp_names.h
+++ b/src/google/protobuf/compiler/csharp/csharp_names.h
@@ -39,7 +39,7 @@
#define GOOGLE_PROTOBUF_COMPILER_CSHARP_NAMES_H__
#include <string>
-#include <google/protobuf/stubs/port.h>
+#include <google/protobuf/stubs/common.h>
#include <google/protobuf/port_def.inc>
diff --git a/src/google/protobuf/compiler/csharp/csharp_reflection_class.cc b/src/google/protobuf/compiler/csharp/csharp_reflection_class.cc
index 38a3602..c481f14 100644
--- a/src/google/protobuf/compiler/csharp/csharp_reflection_class.cc
+++ b/src/google/protobuf/compiler/csharp/csharp_reflection_class.cc
@@ -213,7 +213,7 @@
for (int i = 0; i < file_->extension_count(); i++) {
extensions.push_back(GetFullExtensionName(file_->extension(i)));
}
- printer->Print("new pb::Extension[] { $extensions$ }, ", "extensions", JoinStrings(extensions, ", "));
+ printer->Print("new pb::Extension[] { $extensions$ }, ", "extensions", Join(extensions, ", "));
}
else {
printer->Print("null, ");
@@ -264,7 +264,7 @@
for (int i = 0; i < descriptor->field_count(); i++) {
fields.push_back(GetPropertyName(descriptor->field(i)));
}
- printer->Print("new[]{ \"$fields$\" }, ", "fields", JoinStrings(fields, "\", \""));
+ printer->Print("new[]{ \"$fields$\" }, ", "fields", Join(fields, "\", \""));
}
else {
printer->Print("null, ");
@@ -276,7 +276,7 @@
for (int i = 0; i < descriptor->oneof_decl_count(); i++) {
oneofs.push_back(UnderscoresToCamelCase(descriptor->oneof_decl(i)->name(), true));
}
- printer->Print("new[]{ \"$oneofs$\" }, ", "oneofs", JoinStrings(oneofs, "\", \""));
+ printer->Print("new[]{ \"$oneofs$\" }, ", "oneofs", Join(oneofs, "\", \""));
}
else {
printer->Print("null, ");
@@ -288,7 +288,7 @@
for (int i = 0; i < descriptor->enum_type_count(); i++) {
enums.push_back(GetClassName(descriptor->enum_type(i)));
}
- printer->Print("new[]{ typeof($enums$) }, ", "enums", JoinStrings(enums, "), typeof("));
+ printer->Print("new[]{ typeof($enums$) }, ", "enums", Join(enums, "), typeof("));
}
else {
printer->Print("null, ");
@@ -300,7 +300,7 @@
for (int i = 0; i < descriptor->extension_count(); i++) {
extensions.push_back(GetFullExtensionName(descriptor->extension(i)));
}
- printer->Print("new pb::Extension[] { $extensions$ }, ", "extensions", JoinStrings(extensions, ", "));
+ printer->Print("new pb::Extension[] { $extensions$ }, ", "extensions", Join(extensions, ", "));
}
else {
printer->Print("null, ");
diff --git a/src/google/protobuf/compiler/importer.cc b/src/google/protobuf/compiler/importer.cc
index 715d999..9308519 100644
--- a/src/google/protobuf/compiler/importer.cc
+++ b/src/google/protobuf/compiler/importer.cc
@@ -46,14 +46,11 @@
#include <memory>
#include <google/protobuf/compiler/importer.h>
-
#include <google/protobuf/compiler/parser.h>
-#include <google/protobuf/io/io_win32.h>
#include <google/protobuf/io/tokenizer.h>
#include <google/protobuf/io/zero_copy_stream_impl.h>
#include <google/protobuf/stubs/strutil.h>
-
-
+#include <google/protobuf/io/io_win32.h>
#ifdef _WIN32
#include <ctype.h>
diff --git a/src/google/protobuf/compiler/java/java_context.cc b/src/google/protobuf/compiler/java/java_context.cc
index 778d3ba..d74a7ed 100644
--- a/src/google/protobuf/compiler/java/java_context.cc
+++ b/src/google/protobuf/compiler/java/java_context.cc
@@ -35,7 +35,6 @@
#include <google/protobuf/compiler/java/java_name_resolver.h>
#include <google/protobuf/descriptor.h>
#include <google/protobuf/stubs/strutil.h>
-
#include <google/protobuf/stubs/map_util.h>
namespace google {
diff --git a/src/google/protobuf/compiler/java/java_doc_comment.cc b/src/google/protobuf/compiler/java/java_doc_comment.cc
index 2aee232..2376488 100644
--- a/src/google/protobuf/compiler/java/java_doc_comment.cc
+++ b/src/google/protobuf/compiler/java/java_doc_comment.cc
@@ -174,7 +174,8 @@
void WriteFieldDocComment(io::Printer* printer, const FieldDescriptor* field) {
// We start the comment with the main body based on the comments from the
- // .proto file (if present). We then continue with the field declaration, e.g.:
+ // .proto file (if present). We then continue with the field declaration,
+ // e.g.:
// optional string foo = 5;
// And then we end with the javadoc tags if applicable.
// If the field is a group, the debug string might end with {.
@@ -185,17 +186,17 @@
printer->Print(" */\n");
}
-void WriteFieldAccessorDocComment(io::Printer* printer,
+void WriteFieldAccessorDocComment(io::Printer* printer,
const FieldDescriptor* field,
const FieldAccessorType type,
const bool builder) {
printer->Print("/**\n");
WriteDocCommentBody(printer, field);
- printer->Print(" * <code>$def$</code>\n", "def",
+ printer->Print(" * <code>$def$</code>\n", "def",
EscapeJavadoc(FirstLineOf(field->DebugString())));
switch (type) {
case HAZZER:
- printer->Print(" * @return Whether the $name$ field is set.\n", "name",
+ printer->Print(" * @return Whether the $name$ field is set.\n", "name",
field->camelcase_name());
break;
case GETTER:
@@ -211,16 +212,16 @@
break;
// Repeated
case LIST_COUNT:
- printer->Print(" * @return The number of $name$(s).\n", "name",
- field->camelcase_name());
+ printer->Print(" * @return The count of $name$.\n", "name",
+ field->camelcase_name());
break;
case LIST_GETTER:
- printer->Print(" * @return A list containing the $name$(s).\n", "name",
+ printer->Print(" * @return A list containing the $name$.\n", "name",
field->camelcase_name());
break;
case LIST_INDEXED_GETTER:
printer->Print(" * @param index The index of the element to return.\n");
- printer->Print(" * @return The $name$(s) at the given index.\n", "name",
+ printer->Print(" * @return The $name$ at the given index.\n", "name",
field->camelcase_name());
break;
case LIST_INDEXED_SETTER:
@@ -233,8 +234,8 @@
field->camelcase_name());
break;
case LIST_MULTI_ADDER:
- printer->Print(" * @param values The $name$(s) to add.\n", "name",
- field->camelcase_name());
+ printer->Print(" * @param values The $name$ to add.\n", "name",
+ field->camelcase_name());
break;
}
if (builder) {
@@ -243,25 +244,28 @@
printer->Print(" */\n");
}
-void WriteFieldEnumValueAccessorDocComment(io::Printer* printer,
+void WriteFieldEnumValueAccessorDocComment(io::Printer* printer,
const FieldDescriptor* field,
const FieldAccessorType type,
const bool builder) {
printer->Print("/**\n");
WriteDocCommentBody(printer, field);
- printer->Print(" * <code>$def$</code>\n", "def",
+ printer->Print(" * <code>$def$</code>\n", "def",
EscapeJavadoc(FirstLineOf(field->DebugString())));
switch (type) {
case HAZZER:
// Should never happen
break;
case GETTER:
- printer->Print(" * @return The enum value for $name$.\n", "name",
- field->camelcase_name());
+ printer->Print(
+ " * @return The enum numeric value on the wire for $name$.\n", "name",
+ field->camelcase_name());
break;
case SETTER:
- printer->Print(" * @param value The enum value for $name$ to set.\n",
- "name", field->camelcase_name());
+ printer->Print(
+ " * @param value The enum numeric value on the wire for $name$ to "
+ "set.\n",
+ "name", field->camelcase_name());
break;
case CLEARER:
// Print nothing
@@ -271,26 +275,36 @@
// Should never happen
break;
case LIST_GETTER:
- printer->Print(" * @return A list containing the enum values for "
- "$name$(s).\n", "name", field->camelcase_name());
+ printer->Print(
+ " * @return A list containing the enum numeric values on the wire "
+ "for $name$.\n",
+ "name", field->camelcase_name());
break;
case LIST_INDEXED_GETTER:
printer->Print(" * @param index The index of the value to return.\n");
- printer->Print(" * @return The enum value of the $name$ at the given "
- "index.\n", "name", field->camelcase_name());
+ printer->Print(
+ " * @return The enum numeric value on the wire of $name$ at the "
+ "given index.\n",
+ "name", field->camelcase_name());
break;
case LIST_INDEXED_SETTER:
printer->Print(" * @param index The index to set the value at.\n");
- printer->Print(" * @param value The enum value of the $name$ to set.\n",
- "name", field->camelcase_name());
+ printer->Print(
+ " * @param value The enum numeric value on the wire for $name$ to "
+ "set.\n",
+ "name", field->camelcase_name());
break;
case LIST_ADDER:
- printer->Print(" * @param value The enum value of the $name$ to add.\n",
- "name", field->camelcase_name());
+ printer->Print(
+ " * @param value The enum numeric value on the wire for $name$ to "
+ "add.\n",
+ "name", field->camelcase_name());
break;
case LIST_MULTI_ADDER:
- printer->Print(" * @param values The enum values of the $name$(s) to "
- "add.\n", "name", field->camelcase_name());
+ printer->Print(
+ " * @param values The enum numeric values on the wire for $name$ to "
+ "add.\n",
+ "name", field->camelcase_name());
break;
}
if (builder) {
@@ -299,13 +313,13 @@
printer->Print(" */\n");
}
-void WriteFieldStringBytesAccessorDocComment(io::Printer* printer,
+void WriteFieldStringBytesAccessorDocComment(io::Printer* printer,
const FieldDescriptor* field,
const FieldAccessorType type,
const bool builder) {
printer->Print("/**\n");
WriteDocCommentBody(printer, field);
- printer->Print(" * <code>$def$</code>\n", "def",
+ printer->Print(" * <code>$def$</code>\n", "def",
EscapeJavadoc(FirstLineOf(field->DebugString())));
switch (type) {
case HAZZER:
@@ -313,11 +327,11 @@
break;
case GETTER:
printer->Print(" * @return The bytes for $name$.\n", "name",
- field->camelcase_name());
+ field->camelcase_name());
break;
case SETTER:
- printer->Print(" * @param value The bytes for $name$ to set.\n",
- "name", field->camelcase_name());
+ printer->Print(" * @param value The bytes for $name$ to set.\n", "name",
+ field->camelcase_name());
break;
case CLEARER:
// Print nothing
@@ -327,7 +341,7 @@
// Should never happen
break;
case LIST_GETTER:
- printer->Print(" * @return A list containing the bytes for $name$(s).\n",
+ printer->Print(" * @return A list containing the bytes for $name$.\n",
"name", field->camelcase_name());
break;
case LIST_INDEXED_GETTER:
@@ -345,7 +359,7 @@
"name", field->camelcase_name());
break;
case LIST_MULTI_ADDER:
- printer->Print(" * @param values The bytes of the $name$(s) to add.\n",
+ printer->Print(" * @param values The bytes of the $name$ to add.\n",
"name", field->camelcase_name());
break;
}
diff --git a/src/google/protobuf/compiler/java/java_doc_comment.h b/src/google/protobuf/compiler/java/java_doc_comment.h
index a5ef096..b7de877 100644
--- a/src/google/protobuf/compiler/java/java_doc_comment.h
+++ b/src/google/protobuf/compiler/java/java_doc_comment.h
@@ -53,35 +53,33 @@
namespace java {
enum FieldAccessorType {
-
- HAZZER,
- GETTER,
- SETTER,
- CLEARER,
- // Repeated
- LIST_COUNT,
- LIST_GETTER,
- LIST_INDEXED_GETTER,
- LIST_INDEXED_SETTER,
- LIST_ADDER,
- LIST_MULTI_ADDER
-
+ HAZZER,
+ GETTER,
+ SETTER,
+ CLEARER,
+ // Repeated
+ LIST_COUNT,
+ LIST_GETTER,
+ LIST_INDEXED_GETTER,
+ LIST_INDEXED_SETTER,
+ LIST_ADDER,
+ LIST_MULTI_ADDER
};
void WriteMessageDocComment(io::Printer* printer, const Descriptor* message);
void WriteFieldDocComment(io::Printer* printer, const FieldDescriptor* field);
void WriteFieldAccessorDocComment(io::Printer* printer,
- const FieldDescriptor* field,
- const FieldAccessorType type,
- const bool builder = false);
+ const FieldDescriptor* field,
+ const FieldAccessorType type,
+ const bool builder = false);
void WriteFieldEnumValueAccessorDocComment(io::Printer* printer,
- const FieldDescriptor* field,
- const FieldAccessorType type,
- const bool builder = false);
+ const FieldDescriptor* field,
+ const FieldAccessorType type,
+ const bool builder = false);
void WriteFieldStringBytesAccessorDocComment(io::Printer* printer,
- const FieldDescriptor* field,
- const FieldAccessorType type,
- const bool builder = false);
+ const FieldDescriptor* field,
+ const FieldAccessorType type,
+ const bool builder = false);
void WriteEnumDocComment(io::Printer* printer, const EnumDescriptor* enum_);
void WriteEnumValueDocComment(io::Printer* printer,
const EnumValueDescriptor* value);
diff --git a/src/google/protobuf/compiler/java/java_enum.cc b/src/google/protobuf/compiler/java/java_enum.cc
index bf911be..9415eb5 100644
--- a/src/google/protobuf/compiler/java/java_enum.cc
+++ b/src/google/protobuf/compiler/java/java_enum.cc
@@ -44,7 +44,6 @@
#include <google/protobuf/io/printer.h>
#include <google/protobuf/stubs/strutil.h>
-
namespace google {
namespace protobuf {
namespace compiler {
@@ -175,8 +174,9 @@
"}\n"
"\n"
"/**\n"
- " * @param value The number of the enum to look for.\n"
- " * @return The enum associated with the given number.\n"
+ " * @param value The numeric wire value of the corresponding enum "
+ "entry.\n"
+ " * @return The enum associated with the given numeric wire value.\n"
" * @deprecated Use {@link #forNumber(int)} instead.\n"
" */\n"
"@java.lang.Deprecated\n"
@@ -184,6 +184,11 @@
" return forNumber(value);\n"
"}\n"
"\n"
+ "/**\n"
+ " * @param value The numeric wire value of the corresponding enum "
+ "entry.\n"
+ " * @return The enum associated with the given numeric wire value.\n"
+ " */\n"
"public static $classname$ forNumber(int value) {\n"
" switch (value) {\n",
"classname", descriptor_->name());
diff --git a/src/google/protobuf/compiler/java/java_enum_field.cc b/src/google/protobuf/compiler/java/java_enum_field.cc
index 5ae51ff..5f77f04 100644
--- a/src/google/protobuf/compiler/java/java_enum_field.cc
+++ b/src/google/protobuf/compiler/java/java_enum_field.cc
@@ -46,7 +46,6 @@
#include <google/protobuf/wire_format.h>
#include <google/protobuf/stubs/strutil.h>
-
namespace google {
namespace protobuf {
namespace compiler {
@@ -221,7 +220,7 @@
"}\n");
printer->Annotate("{", "}", descriptor_);
WriteFieldEnumValueAccessorDocComment(printer, descriptor_, SETTER,
- /* builder */ true);
+ /* builder */ true);
printer->Print(variables_,
"$deprecation$public Builder "
"${$set$capitalized_name$Value$}$(int value) {\n"
diff --git a/src/google/protobuf/compiler/java/java_enum_field_lite.cc b/src/google/protobuf/compiler/java/java_enum_field_lite.cc
index b3b4c3c..e4b97e6 100644
--- a/src/google/protobuf/compiler/java/java_enum_field_lite.cc
+++ b/src/google/protobuf/compiler/java/java_enum_field_lite.cc
@@ -46,7 +46,6 @@
#include <google/protobuf/wire_format.h>
#include <google/protobuf/stubs/strutil.h>
-
namespace google {
namespace protobuf {
namespace compiler {
diff --git a/src/google/protobuf/compiler/java/java_enum_lite.cc b/src/google/protobuf/compiler/java/java_enum_lite.cc
index f8e0653..69bd26c 100644
--- a/src/google/protobuf/compiler/java/java_enum_lite.cc
+++ b/src/google/protobuf/compiler/java/java_enum_lite.cc
@@ -43,7 +43,6 @@
#include <google/protobuf/descriptor.pb.h>
#include <google/protobuf/io/printer.h>
#include <google/protobuf/stubs/strutil.h>
-
#include <google/protobuf/stubs/map_util.h>
namespace google {
diff --git a/src/google/protobuf/compiler/java/java_extension.cc b/src/google/protobuf/compiler/java/java_extension.cc
index 3ad64e0..db210fb 100644
--- a/src/google/protobuf/compiler/java/java_extension.cc
+++ b/src/google/protobuf/compiler/java/java_extension.cc
@@ -41,7 +41,6 @@
#include <google/protobuf/io/printer.h>
#include <google/protobuf/stubs/strutil.h>
-
namespace google {
namespace protobuf {
namespace compiler {
diff --git a/src/google/protobuf/compiler/java/java_field.cc b/src/google/protobuf/compiler/java/java_field.cc
index 18a86ba..96ed234 100644
--- a/src/google/protobuf/compiler/java/java_field.cc
+++ b/src/google/protobuf/compiler/java/java_field.cc
@@ -55,7 +55,6 @@
#include <google/protobuf/stubs/substitute.h>
-
namespace google {
namespace protobuf {
namespace compiler {
diff --git a/src/google/protobuf/compiler/java/java_file.cc b/src/google/protobuf/compiler/java/java_file.cc
index 5bc847c..076f30a 100644
--- a/src/google/protobuf/compiler/java/java_file.cc
+++ b/src/google/protobuf/compiler/java/java_file.cc
@@ -54,7 +54,6 @@
#include <google/protobuf/dynamic_message.h>
#include <google/protobuf/stubs/strutil.h>
-
namespace google {
namespace protobuf {
namespace compiler {
diff --git a/src/google/protobuf/compiler/java/java_helpers.cc b/src/google/protobuf/compiler/java/java_helpers.cc
index ac0e9cd..bdc43ac 100644
--- a/src/google/protobuf/compiler/java/java_helpers.cc
+++ b/src/google/protobuf/compiler/java/java_helpers.cc
@@ -44,9 +44,6 @@
#include <google/protobuf/wire_format.h>
#include <google/protobuf/stubs/strutil.h>
#include <google/protobuf/stubs/substitute.h>
-
-
-
#include <google/protobuf/stubs/hash.h> // for hash<T *>
namespace google {
diff --git a/src/google/protobuf/compiler/java/java_message.cc b/src/google/protobuf/compiler/java/java_message.cc
index 63bbe02..941e838 100644
--- a/src/google/protobuf/compiler/java/java_message.cc
+++ b/src/google/protobuf/compiler/java/java_message.cc
@@ -55,8 +55,6 @@
#include <google/protobuf/stubs/strutil.h>
#include <google/protobuf/stubs/substitute.h>
-
-
namespace google {
namespace protobuf {
namespace compiler {
diff --git a/src/google/protobuf/compiler/java/java_message_builder.cc b/src/google/protobuf/compiler/java/java_message_builder.cc
index aa00a66..16e63af 100644
--- a/src/google/protobuf/compiler/java/java_message_builder.cc
+++ b/src/google/protobuf/compiler/java/java_message_builder.cc
@@ -53,8 +53,6 @@
#include <google/protobuf/stubs/strutil.h>
#include <google/protobuf/stubs/substitute.h>
-
-
namespace google {
namespace protobuf {
namespace compiler {
diff --git a/src/google/protobuf/compiler/java/java_message_builder_lite.cc b/src/google/protobuf/compiler/java/java_message_builder_lite.cc
index ae34499..6e78fb7 100644
--- a/src/google/protobuf/compiler/java/java_message_builder_lite.cc
+++ b/src/google/protobuf/compiler/java/java_message_builder_lite.cc
@@ -53,7 +53,6 @@
#include <google/protobuf/stubs/strutil.h>
#include <google/protobuf/stubs/substitute.h>
-
namespace google {
namespace protobuf {
namespace compiler {
diff --git a/src/google/protobuf/compiler/java/java_message_field_lite.cc b/src/google/protobuf/compiler/java/java_message_field_lite.cc
index 1a055fe..b111099 100644
--- a/src/google/protobuf/compiler/java/java_message_field_lite.cc
+++ b/src/google/protobuf/compiler/java/java_message_field_lite.cc
@@ -44,7 +44,6 @@
#include <google/protobuf/wire_format.h>
#include <google/protobuf/stubs/strutil.h>
-
namespace google {
namespace protobuf {
namespace compiler {
diff --git a/src/google/protobuf/compiler/java/java_message_lite.cc b/src/google/protobuf/compiler/java/java_message_lite.cc
index c356f15..cb09997 100644
--- a/src/google/protobuf/compiler/java/java_message_lite.cc
+++ b/src/google/protobuf/compiler/java/java_message_lite.cc
@@ -55,8 +55,6 @@
#include <google/protobuf/stubs/strutil.h>
#include <google/protobuf/stubs/substitute.h>
-
-
namespace google {
namespace protobuf {
namespace compiler {
diff --git a/src/google/protobuf/compiler/java/java_name_resolver.cc b/src/google/protobuf/compiler/java/java_name_resolver.cc
index d07c628..09fedd1 100644
--- a/src/google/protobuf/compiler/java/java_name_resolver.cc
+++ b/src/google/protobuf/compiler/java/java_name_resolver.cc
@@ -33,11 +33,9 @@
#include <map>
#include <string>
-
#include <google/protobuf/compiler/java/java_helpers.h>
#include <google/protobuf/stubs/substitute.h>
-
namespace google {
namespace protobuf {
namespace compiler {
diff --git a/src/google/protobuf/compiler/java/java_primitive_field.cc b/src/google/protobuf/compiler/java/java_primitive_field.cc
index 8b51e79..d06b534 100644
--- a/src/google/protobuf/compiler/java/java_primitive_field.cc
+++ b/src/google/protobuf/compiler/java/java_primitive_field.cc
@@ -46,7 +46,6 @@
#include <google/protobuf/wire_format.h>
#include <google/protobuf/stubs/strutil.h>
-
namespace google {
namespace protobuf {
namespace compiler {
diff --git a/src/google/protobuf/compiler/java/java_primitive_field_lite.cc b/src/google/protobuf/compiler/java/java_primitive_field_lite.cc
index 833be23..918bdb9 100644
--- a/src/google/protobuf/compiler/java/java_primitive_field_lite.cc
+++ b/src/google/protobuf/compiler/java/java_primitive_field_lite.cc
@@ -46,7 +46,6 @@
#include <google/protobuf/wire_format.h>
#include <google/protobuf/stubs/strutil.h>
-
namespace google {
namespace protobuf {
namespace compiler {
diff --git a/src/google/protobuf/compiler/java/java_service.cc b/src/google/protobuf/compiler/java/java_service.cc
index 17d8e70..e30d155 100644
--- a/src/google/protobuf/compiler/java/java_service.cc
+++ b/src/google/protobuf/compiler/java/java_service.cc
@@ -41,7 +41,6 @@
#include <google/protobuf/io/printer.h>
#include <google/protobuf/stubs/strutil.h>
-
namespace google {
namespace protobuf {
namespace compiler {
diff --git a/src/google/protobuf/compiler/java/java_string_field.cc b/src/google/protobuf/compiler/java/java_string_field.cc
index 2a82881..c976885 100644
--- a/src/google/protobuf/compiler/java/java_string_field.cc
+++ b/src/google/protobuf/compiler/java/java_string_field.cc
@@ -47,7 +47,6 @@
#include <google/protobuf/wire_format.h>
#include <google/protobuf/stubs/strutil.h>
-
namespace google {
namespace protobuf {
namespace compiler {
diff --git a/src/google/protobuf/compiler/java/java_string_field_lite.cc b/src/google/protobuf/compiler/java/java_string_field_lite.cc
index 1e856f2..77cea92 100644
--- a/src/google/protobuf/compiler/java/java_string_field_lite.cc
+++ b/src/google/protobuf/compiler/java/java_string_field_lite.cc
@@ -47,7 +47,6 @@
#include <google/protobuf/wire_format.h>
#include <google/protobuf/stubs/strutil.h>
-
namespace google {
namespace protobuf {
namespace compiler {
@@ -295,7 +294,7 @@
printer->Annotate("{", "}", descriptor_);
WriteFieldStringBytesAccessorDocComment(printer, descriptor_, SETTER,
- /* builder */ true);
+ /* builder */ true);
printer->Print(
variables_,
"$deprecation$public Builder ${$set$capitalized_name$Bytes$}$(\n"
@@ -476,7 +475,7 @@
printer->Annotate("{", "}", descriptor_);
WriteFieldStringBytesAccessorDocComment(printer, descriptor_, SETTER,
- /* builder */ true);
+ /* builder */ true);
printer->Print(
variables_,
"$deprecation$public Builder ${$set$capitalized_name$Bytes$}$(\n"
diff --git a/src/google/protobuf/compiler/js/js_generator.cc b/src/google/protobuf/compiler/js/js_generator.cc
index fa7e98e..88c9a0f 100644
--- a/src/google/protobuf/compiler/js/js_generator.cc
+++ b/src/google/protobuf/compiler/js/js_generator.cc
@@ -43,7 +43,6 @@
#include <google/protobuf/stubs/common.h>
#include <google/protobuf/stubs/stringprintf.h>
#include <google/protobuf/stubs/strutil.h>
-
#include <google/protobuf/compiler/scc.h>
#include <google/protobuf/compiler/js/well_known_types_embed.h>
#include <google/protobuf/io/printer.h>
@@ -51,7 +50,6 @@
#include <google/protobuf/descriptor.pb.h>
#include <google/protobuf/descriptor.h>
-
namespace google {
namespace protobuf {
namespace compiler {
@@ -1118,9 +1116,6 @@
JSBinaryReadWriteMethodName(field, /* is_writer = */ true);
}
-std::string JSReturnClause(const FieldDescriptor* desc) {
- return "";
-}
std::string JSTypeTag(const FieldDescriptor* desc) {
switch (desc->type()) {
@@ -1156,10 +1151,6 @@
return "";
}
-std::string JSReturnDoc(const GeneratorOptions& options,
- const FieldDescriptor* desc) {
- return "";
-}
bool HasRepeatedFields(const GeneratorOptions& options,
const Descriptor* desc) {
@@ -1426,11 +1417,6 @@
return false;
}
- if (UseBrokenPresenceSemantics(options, field)) {
- // Proto3 files with broken presence semantics have field presence.
- return true;
- }
-
return field->cpp_type() == FieldDescriptor::CPPTYPE_MESSAGE ||
field->containing_oneof() != NULL ||
field->file()->syntax() == FileDescriptor::SYNTAX_PROTO2;
@@ -2393,7 +2379,7 @@
if (field->file()->syntax() == FileDescriptor::SYNTAX_PROTO3 &&
// Repeated fields get initialized to their default in the constructor
// (why?), so we emit a plain getField() call for them.
- !field->is_repeated() && !UseBrokenPresenceSemantics(options, field)) {
+ !field->is_repeated()) {
// Proto3 puts all defaults (including implicit defaults) in toObject().
// But for proto2 we leave the existing semantics unchanged: unset fields
// without default are unset.
@@ -2677,30 +2663,31 @@
(field->label() == FieldDescriptor::LABEL_REQUIRED ? ", 1" : ""));
printer->Annotate("gettername", field);
printer->Print(
- "/** @param {$optionaltype$} value$returndoc$ */\n"
+ "/**\n"
+ " * @param {$optionaltype$} value\n"
+ " * @return {!$class$} returns this\n"
+ "*/\n"
"$class$.prototype.$settername$ = function(value) {\n"
- " jspb.Message.set$oneoftag$$repeatedtag$WrapperField(",
+ " return jspb.Message.set$oneoftag$$repeatedtag$WrapperField(",
"optionaltype",
JSFieldTypeAnnotation(options, field,
/* is_setter_argument = */ true,
/* force_present = */ false,
/* singular_if_not_packed = */ false),
- "returndoc", JSReturnDoc(options, field), "class",
- GetMessagePath(options, field->containing_type()), "settername",
- "set" + JSGetterName(options, field), "oneoftag",
+ "class", GetMessagePath(options, field->containing_type()),
+ "settername", "set" + JSGetterName(options, field), "oneoftag",
(field->containing_oneof() ? "Oneof" : ""), "repeatedtag",
(field->is_repeated() ? "Repeated" : ""));
printer->Annotate("settername", field);
printer->Print(
- "this, $index$$oneofgroup$, value);$returnvalue$\n"
+ "this, $index$$oneofgroup$, value);\n"
"};\n"
"\n"
"\n",
"index", JSFieldIndex(field), "oneofgroup",
(field->containing_oneof() ? (", " + JSOneofArray(options, field))
- : ""),
- "returnvalue", JSReturnClause(field));
+ : ""));
if (field->is_repeated()) {
GenerateRepeatedMessageHelperMethods(options, printer, field);
@@ -2787,21 +2774,18 @@
GenerateBytesWrapper(options, printer, field, BYTES_U8);
}
- if (untyped) {
- printer->Print(
- "/**\n"
- " * @param {*} value$returndoc$\n"
- " */\n",
- "returndoc", JSReturnDoc(options, field));
- } else {
- printer->Print(
- "/** @param {$optionaltype$} value$returndoc$ */\n", "optionaltype",
- JSFieldTypeAnnotation(options, field,
- /* is_setter_argument = */ true,
- /* force_present = */ false,
- /* singular_if_not_packed = */ false),
- "returndoc", JSReturnDoc(options, field));
- }
+ printer->Print(
+ "/**\n"
+ " * @param {$optionaltype$} value\n"
+ " * @return {!$class$} returns this\n"
+ " */\n",
+ "class", GetMessagePath(options, field->containing_type()),
+ "optionaltype",
+ untyped ? "*"
+ : JSFieldTypeAnnotation(options, field,
+ /* is_setter_argument = */ true,
+ /* force_present = */ false,
+ /* singular_if_not_packed = */ false));
if (field->file()->syntax() == FileDescriptor::SYNTAX_PROTO3 &&
!field->is_repeated() && !field->is_map() &&
@@ -2810,28 +2794,28 @@
// setProto3*Field function.
printer->Print(
"$class$.prototype.$settername$ = function(value) {\n"
- " jspb.Message.setProto3$typetag$Field(this, $index$, "
- "value);$returnvalue$\n"
+ " return jspb.Message.setProto3$typetag$Field(this, $index$, "
+ "value);"
+ "\n"
"};\n"
"\n"
"\n",
"class", GetMessagePath(options, field->containing_type()),
"settername", "set" + JSGetterName(options, field), "typetag",
- JSTypeTag(field), "index", JSFieldIndex(field), "returnvalue",
- JSReturnClause(field));
+ JSTypeTag(field), "index", JSFieldIndex(field));
printer->Annotate("settername", field);
} else {
// Otherwise, use the regular setField function.
printer->Print(
"$class$.prototype.$settername$ = function(value) {\n"
- " jspb.Message.set$oneoftag$Field(this, $index$",
+ " return jspb.Message.set$oneoftag$Field(this, $index$",
"class", GetMessagePath(options, field->containing_type()),
"settername", "set" + JSGetterName(options, field), "oneoftag",
(field->containing_oneof() ? "Oneof" : ""), "index",
JSFieldIndex(field));
printer->Annotate("settername", field);
printer->Print(
- "$oneofgroup$, $type$value$rptvalueinit$$typeclose$);$returnvalue$\n"
+ "$oneofgroup$, $type$value$rptvalueinit$$typeclose$);\n"
"};\n"
"\n"
"\n",
@@ -2840,16 +2824,16 @@
"typeclose", untyped ? ")" : "", "oneofgroup",
(field->containing_oneof() ? (", " + JSOneofArray(options, field))
: ""),
- "returnvalue", JSReturnClause(field), "rptvalueinit",
- (field->is_repeated() ? " || []" : ""));
+ "rptvalueinit", (field->is_repeated() ? " || []" : ""));
}
if (untyped) {
printer->Print(
"/**\n"
- " * Clears the value.$returndoc$\n"
+ " * Clears the value.\n"
+ " * @return {!$class$} returns this\n"
" */\n",
- "returndoc", JSReturnDoc(options, field));
+ "class", GetMessagePath(options, field->containing_type()));
}
if (field->is_repeated()) {
@@ -2863,19 +2847,18 @@
// clang-format off
printer->Print(
"/**\n"
- " * Clears values from the map. The map will be non-null."
- "$returndoc$\n"
+ " * Clears values from the map. The map will be non-null.\n"
+ " * @return {!$class$} returns this\n"
" */\n"
"$class$.prototype.$clearername$ = function() {\n"
- " this.$gettername$().clear();$returnvalue$\n"
+ " this.$gettername$().clear();\n"
+ " return this;"
"};\n"
"\n"
"\n",
- "returndoc", JSReturnDoc(options, field),
"class", GetMessagePath(options, field->containing_type()),
"clearername", "clear" + JSGetterName(options, field),
- "gettername", "get" + JSGetterName(options, field),
- "returnvalue", JSReturnClause(field));
+ "gettername", "get" + JSGetterName(options, field));
// clang-format on
printer->Annotate("clearername", field);
} else if (field->is_repeated() ||
@@ -2885,22 +2868,21 @@
// clang-format off
printer->Print(
"/**\n"
- " * $jsdoc$$returndoc$\n"
+ " * $jsdoc$\n"
+ " * @return {!$class$} returns this\n"
" */\n"
"$class$.prototype.$clearername$ = function() {\n"
- " this.$settername$($clearedvalue$);$returnvalue$\n"
+ " return this.$settername$($clearedvalue$);\n"
"};\n"
"\n"
"\n",
"jsdoc", field->is_repeated()
? "Clears the list making it empty but non-null."
: "Clears the message field making it undefined.",
- "returndoc", JSReturnDoc(options, field),
"class", GetMessagePath(options, field->containing_type()),
"clearername", "clear" + JSGetterName(options, field),
"settername", "set" + JSGetterName(options, field),
- "clearedvalue", (field->is_repeated() ? "[]" : "undefined"),
- "returnvalue", JSReturnClause(field));
+ "clearedvalue", (field->is_repeated() ? "[]" : "undefined"));
// clang-format on
printer->Annotate("clearername", field);
} else if (HasFieldPresence(options, field)) {
@@ -2909,12 +2891,12 @@
// clang-format off
printer->Print(
"/**\n"
- " * Clears the field making it undefined.$returndoc$\n"
+ " * Clears the field making it undefined.\n"
+ " * @return {!$class$} returns this\n"
" */\n"
"$class$.prototype.$clearername$ = function() {\n"
- " jspb.Message.set$maybeoneof$Field(this, "
- "$index$$maybeoneofgroup$, ",
- "returndoc", JSReturnDoc(options, field),
+ " return jspb.Message.set$maybeoneof$Field(this, "
+ "$index$$maybeoneofgroup$, ",
"class", GetMessagePath(options, field->containing_type()),
"clearername", "clear" + JSGetterName(options, field),
"maybeoneof", (field->containing_oneof() ? "Oneof" : ""),
@@ -2925,12 +2907,11 @@
// clang-format on
printer->Annotate("clearername", field);
printer->Print(
- "$clearedvalue$);$returnvalue$\n"
+ "$clearedvalue$);\n"
"};\n"
"\n"
"\n",
- "clearedvalue", (field->is_repeated() ? "[]" : "undefined"),
- "returnvalue", JSReturnClause(field));
+ "clearedvalue", (field->is_repeated() ? "[]" : "undefined"));
}
if (HasFieldPresence(options, field)) {
@@ -2957,10 +2938,12 @@
printer->Print(
"/**\n"
" * @param {$optionaltype$} value\n"
- " * @param {number=} opt_index$returndoc$\n"
+ " * @param {number=} opt_index\n"
+ " * @return {!$class$} returns this\n"
" */\n"
"$class$.prototype.$addername$ = function(value, opt_index) {\n"
- " jspb.Message.addToRepeatedField(this, $index$",
+ " return jspb.Message.addToRepeatedField(this, "
+ "$index$",
"class", GetMessagePath(options, field->containing_type()), "addername",
"add" + JSGetterName(options, field, BYTES_DEFAULT,
/* drop_list = */ true),
@@ -2972,20 +2955,18 @@
/* singular_if_not_packed = */ false,
BYTES_DEFAULT,
/* force_singular = */ true),
- "index", JSFieldIndex(field),
- "returndoc", JSReturnDoc(options, field));
+ "index", JSFieldIndex(field));
printer->Annotate("addername", field);
printer->Print(
"$oneofgroup$, $type$value$rptvalueinit$$typeclose$, "
- "opt_index);$returnvalue$\n"
+ "opt_index);\n"
"};\n"
"\n"
"\n",
"type", untyped ? "/** @type{string|number|boolean|!Uint8Array} */(" : "",
"typeclose", untyped ? ")" : "", "oneofgroup",
(field->containing_oneof() ? (", " + JSOneofArray(options, field)) : ""),
- "rptvalueinit", "",
- "returnvalue", JSReturnClause(field));
+ "rptvalueinit", "");
// clang-format on
}
@@ -3374,12 +3355,21 @@
enumdesc->name());
printer->Annotate("name", enumdesc);
+ std::set<string> used_name;
+ std::vector<int> valid_index;
for (int i = 0; i < enumdesc->value_count(); i++) {
+ if (enumdesc->options().allow_alias() &&
+ !used_name.insert(ToEnumCase(enumdesc->value(i)->name())).second) {
+ continue;
+ }
+ valid_index.push_back(i);
+ }
+ for (auto i : valid_index) {
const EnumValueDescriptor* value = enumdesc->value(i);
printer->Print(" $name$: $value$$comma$\n", "name",
ToEnumCase(value->name()), "value",
StrCat(value->number()), "comma",
- (i == enumdesc->value_count() - 1) ? "" : ",");
+ (i == valid_index.back()) ? "" : ",");
printer->Annotate("name", value);
}
diff --git a/src/google/protobuf/compiler/mock_code_generator.cc b/src/google/protobuf/compiler/mock_code_generator.cc
index 0776064..038e6f5 100644
--- a/src/google/protobuf/compiler/mock_code_generator.cc
+++ b/src/google/protobuf/compiler/mock_code_generator.cc
@@ -39,7 +39,6 @@
#include <google/protobuf/stubs/strutil.h>
-
#include <google/protobuf/stubs/logging.h>
#include <google/protobuf/stubs/common.h>
#include <google/protobuf/testing/file.h>
diff --git a/src/google/protobuf/compiler/objectivec/objectivec_helpers.cc b/src/google/protobuf/compiler/objectivec/objectivec_helpers.cc
index e8d6d9e..206739f 100644
--- a/src/google/protobuf/compiler/objectivec/objectivec_helpers.cc
+++ b/src/google/protobuf/compiler/objectivec/objectivec_helpers.cc
@@ -48,7 +48,7 @@
#include <google/protobuf/io/printer.h>
#include <google/protobuf/io/zero_copy_stream_impl.h>
#include <google/protobuf/io/io_win32.h>
-#include <google/protobuf/stubs/port.h>
+#include <google/protobuf/stubs/common.h>
#include <google/protobuf/stubs/strutil.h>
// NOTE: src/google/protobuf/compiler/plugin.cc makes use of cerr for some
@@ -931,7 +931,7 @@
? location.trailing_comments
: location.leading_comments;
std::vector<string> lines;
- SplitStringAllowEmpty(comments, "\n", &lines);
+ lines = Split(comments, "\n", false);
while (!lines.empty() && lines.back().empty()) {
lines.pop_back();
}
diff --git a/src/google/protobuf/compiler/parser.cc b/src/google/protobuf/compiler/parser.cc
index 1c0efda..152f8f5 100644
--- a/src/google/protobuf/compiler/parser.cc
+++ b/src/google/protobuf/compiler/parser.cc
@@ -38,7 +38,6 @@
#include <limits>
#include <unordered_map>
-
#include <google/protobuf/stubs/hash.h>
#include <google/protobuf/stubs/casts.h>
diff --git a/src/google/protobuf/compiler/parser_unittest.cc b/src/google/protobuf/compiler/parser_unittest.cc
index 43784cb..ccf020b 100644
--- a/src/google/protobuf/compiler/parser_unittest.cc
+++ b/src/google/protobuf/compiler/parser_unittest.cc
@@ -48,7 +48,6 @@
#include <google/protobuf/text_format.h>
#include <google/protobuf/wire_format.h>
#include <google/protobuf/stubs/substitute.h>
-
#include <google/protobuf/stubs/map_util.h>
#include <google/protobuf/testing/googletest.h>
diff --git a/src/google/protobuf/compiler/php/php_generator.cc b/src/google/protobuf/compiler/php/php_generator.cc
index 232db80..a16cbc2 100644
--- a/src/google/protobuf/compiler/php/php_generator.cc
+++ b/src/google/protobuf/compiler/php/php_generator.cc
@@ -1463,7 +1463,7 @@
// HTML-escape them so that they don't accidentally close the doc comment.
comments = EscapePhpdoc(comments);
- std::vector<string> lines = Split(comments, "\n");
+ std::vector<string> lines = Split(comments, "\n", true);
while (!lines.empty() && lines.back().empty()) {
lines.pop_back();
}
diff --git a/src/google/protobuf/compiler/plugin.cc b/src/google/protobuf/compiler/plugin.cc
index ac383f8..7de3985 100644
--- a/src/google/protobuf/compiler/plugin.cc
+++ b/src/google/protobuf/compiler/plugin.cc
@@ -45,9 +45,9 @@
#include <google/protobuf/stubs/common.h>
#include <google/protobuf/compiler/plugin.pb.h>
#include <google/protobuf/compiler/code_generator.h>
-#include <google/protobuf/io/io_win32.h>
#include <google/protobuf/io/zero_copy_stream_impl.h>
#include <google/protobuf/descriptor.h>
+#include <google/protobuf/io/io_win32.h>
namespace google {
diff --git a/src/google/protobuf/compiler/plugin.pb.cc b/src/google/protobuf/compiler/plugin.pb.cc
index dcfaca3..b42254b 100644
--- a/src/google/protobuf/compiler/plugin.pb.cc
+++ b/src/google/protobuf/compiler/plugin.pb.cc
@@ -49,7 +49,7 @@
}
PROTOC_EXPORT ::PROTOBUF_NAMESPACE_ID::internal::SCCInfo<2> scc_info_CodeGeneratorRequest_google_2fprotobuf_2fcompiler_2fplugin_2eproto =
- {{ATOMIC_VAR_INIT(::PROTOBUF_NAMESPACE_ID::internal::SCCInfoBase::kUninitialized), 2, InitDefaultsscc_info_CodeGeneratorRequest_google_2fprotobuf_2fcompiler_2fplugin_2eproto}, {
+ {{ATOMIC_VAR_INIT(::PROTOBUF_NAMESPACE_ID::internal::SCCInfoBase::kUninitialized), 2, 0, InitDefaultsscc_info_CodeGeneratorRequest_google_2fprotobuf_2fcompiler_2fplugin_2eproto}, {
&scc_info_FileDescriptorProto_google_2fprotobuf_2fdescriptor_2eproto.base,
&scc_info_Version_google_2fprotobuf_2fcompiler_2fplugin_2eproto.base,}};
@@ -65,7 +65,7 @@
}
PROTOC_EXPORT ::PROTOBUF_NAMESPACE_ID::internal::SCCInfo<1> scc_info_CodeGeneratorResponse_google_2fprotobuf_2fcompiler_2fplugin_2eproto =
- {{ATOMIC_VAR_INIT(::PROTOBUF_NAMESPACE_ID::internal::SCCInfoBase::kUninitialized), 1, InitDefaultsscc_info_CodeGeneratorResponse_google_2fprotobuf_2fcompiler_2fplugin_2eproto}, {
+ {{ATOMIC_VAR_INIT(::PROTOBUF_NAMESPACE_ID::internal::SCCInfoBase::kUninitialized), 1, 0, InitDefaultsscc_info_CodeGeneratorResponse_google_2fprotobuf_2fcompiler_2fplugin_2eproto}, {
&scc_info_CodeGeneratorResponse_File_google_2fprotobuf_2fcompiler_2fplugin_2eproto.base,}};
static void InitDefaultsscc_info_CodeGeneratorResponse_File_google_2fprotobuf_2fcompiler_2fplugin_2eproto() {
@@ -80,7 +80,7 @@
}
PROTOC_EXPORT ::PROTOBUF_NAMESPACE_ID::internal::SCCInfo<0> scc_info_CodeGeneratorResponse_File_google_2fprotobuf_2fcompiler_2fplugin_2eproto =
- {{ATOMIC_VAR_INIT(::PROTOBUF_NAMESPACE_ID::internal::SCCInfoBase::kUninitialized), 0, InitDefaultsscc_info_CodeGeneratorResponse_File_google_2fprotobuf_2fcompiler_2fplugin_2eproto}, {}};
+ {{ATOMIC_VAR_INIT(::PROTOBUF_NAMESPACE_ID::internal::SCCInfoBase::kUninitialized), 0, 0, InitDefaultsscc_info_CodeGeneratorResponse_File_google_2fprotobuf_2fcompiler_2fplugin_2eproto}, {}};
static void InitDefaultsscc_info_Version_google_2fprotobuf_2fcompiler_2fplugin_2eproto() {
GOOGLE_PROTOBUF_VERIFY_VERSION;
@@ -94,7 +94,7 @@
}
PROTOC_EXPORT ::PROTOBUF_NAMESPACE_ID::internal::SCCInfo<0> scc_info_Version_google_2fprotobuf_2fcompiler_2fplugin_2eproto =
- {{ATOMIC_VAR_INIT(::PROTOBUF_NAMESPACE_ID::internal::SCCInfoBase::kUninitialized), 0, InitDefaultsscc_info_Version_google_2fprotobuf_2fcompiler_2fplugin_2eproto}, {}};
+ {{ATOMIC_VAR_INIT(::PROTOBUF_NAMESPACE_ID::internal::SCCInfoBase::kUninitialized), 0, 0, InitDefaultsscc_info_Version_google_2fprotobuf_2fcompiler_2fplugin_2eproto}, {}};
static ::PROTOBUF_NAMESPACE_ID::Metadata file_level_metadata_google_2fprotobuf_2fcompiler_2fplugin_2eproto[4];
static constexpr ::PROTOBUF_NAMESPACE_ID::EnumDescriptor const** file_level_enum_descriptors_google_2fprotobuf_2fcompiler_2fplugin_2eproto = nullptr;
@@ -235,7 +235,7 @@
_has_bits_(from._has_bits_) {
_internal_metadata_.MergeFrom(from._internal_metadata_);
suffix_.UnsafeSetDefault(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited());
- if (from.has_suffix()) {
+ if (from._internal_has_suffix()) {
suffix_.AssignWithDefault(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(), from.suffix_);
}
::memcpy(&major_, &from.major_,
@@ -325,7 +325,7 @@
// optional string suffix = 4;
case 4:
if (PROTOBUF_PREDICT_TRUE(static_cast<::PROTOBUF_NAMESPACE_ID::uint8>(tag) == 34)) {
- ptr = ::PROTOBUF_NAMESPACE_ID::internal::InlineGreedyStringParserUTF8Verify(mutable_suffix(), ptr, ctx, "google.protobuf.compiler.Version.suffix");
+ ptr = ::PROTOBUF_NAMESPACE_ID::internal::InlineGreedyStringParserUTF8Verify(_internal_mutable_suffix(), ptr, ctx, "google.protobuf.compiler.Version.suffix");
CHK_(ptr);
} else goto handle_unusual;
continue;
@@ -403,9 +403,9 @@
case 4: {
if (static_cast< ::PROTOBUF_NAMESPACE_ID::uint8>(tag) == (34 & 0xFF)) {
DO_(::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::ReadString(
- input, this->mutable_suffix()));
+ input, this->_internal_mutable_suffix()));
::PROTOBUF_NAMESPACE_ID::internal::WireFormat::VerifyUTF8StringNamedField(
- this->suffix().data(), static_cast<int>(this->suffix().length()),
+ this->_internal_suffix().data(), static_cast<int>(this->_internal_suffix().length()),
::PROTOBUF_NAMESPACE_ID::internal::WireFormat::PARSE,
"google.protobuf.compiler.Version.suffix");
} else {
@@ -463,11 +463,11 @@
// optional string suffix = 4;
if (cached_has_bits & 0x00000001u) {
::PROTOBUF_NAMESPACE_ID::internal::WireFormat::VerifyUTF8StringNamedField(
- this->suffix().data(), static_cast<int>(this->suffix().length()),
+ this->_internal_suffix().data(), static_cast<int>(this->_internal_suffix().length()),
::PROTOBUF_NAMESPACE_ID::internal::WireFormat::SERIALIZE,
"google.protobuf.compiler.Version.suffix");
target = stream->WriteStringMaybeAliased(
- 4, this->suffix(), target);
+ 4, this->_internal_suffix(), target);
}
if (PROTOBUF_PREDICT_FALSE(_internal_metadata_.have_unknown_fields())) {
@@ -492,7 +492,7 @@
if (cached_has_bits & 0x00000001u) {
total_size += 1 +
::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::StringSize(
- this->suffix());
+ this->_internal_suffix());
}
// optional int32 major = 1;
@@ -639,7 +639,7 @@
proto_file_(from.proto_file_) {
_internal_metadata_.MergeFrom(from._internal_metadata_);
parameter_.UnsafeSetDefault(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited());
- if (from.has_parameter()) {
+ if (from._internal_has_parameter()) {
parameter_.AssignWithDefault(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(), from.parameter_);
}
if (from.has_compiler_version()) {
@@ -712,16 +712,16 @@
ptr -= 1;
do {
ptr += 1;
- ptr = ::PROTOBUF_NAMESPACE_ID::internal::InlineGreedyStringParserUTF8Verify(add_file_to_generate(), ptr, ctx, "google.protobuf.compiler.CodeGeneratorRequest.file_to_generate");
+ ptr = ::PROTOBUF_NAMESPACE_ID::internal::InlineGreedyStringParserUTF8Verify(_internal_add_file_to_generate(), ptr, ctx, "google.protobuf.compiler.CodeGeneratorRequest.file_to_generate");
CHK_(ptr);
if (!ctx->DataAvailable(ptr)) break;
- } while (::PROTOBUF_NAMESPACE_ID::internal::UnalignedLoad<::PROTOBUF_NAMESPACE_ID::uint8>(ptr) == 10);
+ } while (::PROTOBUF_NAMESPACE_ID::internal::ExpectTag<10>(ptr));
} else goto handle_unusual;
continue;
// optional string parameter = 2;
case 2:
if (PROTOBUF_PREDICT_TRUE(static_cast<::PROTOBUF_NAMESPACE_ID::uint8>(tag) == 18)) {
- ptr = ::PROTOBUF_NAMESPACE_ID::internal::InlineGreedyStringParserUTF8Verify(mutable_parameter(), ptr, ctx, "google.protobuf.compiler.CodeGeneratorRequest.parameter");
+ ptr = ::PROTOBUF_NAMESPACE_ID::internal::InlineGreedyStringParserUTF8Verify(_internal_mutable_parameter(), ptr, ctx, "google.protobuf.compiler.CodeGeneratorRequest.parameter");
CHK_(ptr);
} else goto handle_unusual;
continue;
@@ -741,7 +741,7 @@
ptr = ctx->ParseMessage(add_proto_file(), ptr);
CHK_(ptr);
if (!ctx->DataAvailable(ptr)) break;
- } while (::PROTOBUF_NAMESPACE_ID::internal::UnalignedLoad<::PROTOBUF_NAMESPACE_ID::uint8>(ptr) == 122);
+ } while (::PROTOBUF_NAMESPACE_ID::internal::ExpectTag<122>(ptr));
} else goto handle_unusual;
continue;
default: {
@@ -779,10 +779,10 @@
case 1: {
if (static_cast< ::PROTOBUF_NAMESPACE_ID::uint8>(tag) == (10 & 0xFF)) {
DO_(::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::ReadString(
- input, this->add_file_to_generate()));
+ input, this->_internal_add_file_to_generate()));
::PROTOBUF_NAMESPACE_ID::internal::WireFormat::VerifyUTF8StringNamedField(
- this->file_to_generate(this->file_to_generate_size() - 1).data(),
- static_cast<int>(this->file_to_generate(this->file_to_generate_size() - 1).length()),
+ file_to_generate_.Get(file_to_generate_.size() - 1).data(),
+ static_cast<int>(file_to_generate_.Get(file_to_generate_.size() - 1).length()),
::PROTOBUF_NAMESPACE_ID::internal::WireFormat::PARSE,
"google.protobuf.compiler.CodeGeneratorRequest.file_to_generate");
} else {
@@ -795,9 +795,9 @@
case 2: {
if (static_cast< ::PROTOBUF_NAMESPACE_ID::uint8>(tag) == (18 & 0xFF)) {
DO_(::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::ReadString(
- input, this->mutable_parameter()));
+ input, this->_internal_mutable_parameter()));
::PROTOBUF_NAMESPACE_ID::internal::WireFormat::VerifyUTF8StringNamedField(
- this->parameter().data(), static_cast<int>(this->parameter().length()),
+ this->_internal_parameter().data(), static_cast<int>(this->_internal_parameter().length()),
::PROTOBUF_NAMESPACE_ID::internal::WireFormat::PARSE,
"google.protobuf.compiler.CodeGeneratorRequest.parameter");
} else {
@@ -856,8 +856,8 @@
(void) cached_has_bits;
// repeated string file_to_generate = 1;
- for (auto it = this->file_to_generate().pointer_begin(),
- end = this->file_to_generate().pointer_end(); it < end; ++it) {
+ for (auto it = file_to_generate_.pointer_begin(),
+ end = file_to_generate_.pointer_end(); it < end; ++it) {
const auto& s = **it;
::PROTOBUF_NAMESPACE_ID::internal::WireFormat::VerifyUTF8StringNamedField(
s.data(), static_cast<int>(s.length()),
@@ -870,11 +870,11 @@
// optional string parameter = 2;
if (cached_has_bits & 0x00000001u) {
::PROTOBUF_NAMESPACE_ID::internal::WireFormat::VerifyUTF8StringNamedField(
- this->parameter().data(), static_cast<int>(this->parameter().length()),
+ this->_internal_parameter().data(), static_cast<int>(this->_internal_parameter().length()),
::PROTOBUF_NAMESPACE_ID::internal::WireFormat::SERIALIZE,
"google.protobuf.compiler.CodeGeneratorRequest.parameter");
target = stream->WriteStringMaybeAliased(
- 2, this->parameter(), target);
+ 2, this->_internal_parameter(), target);
}
// optional .google.protobuf.compiler.Version compiler_version = 3;
@@ -886,8 +886,8 @@
}
// repeated .google.protobuf.FileDescriptorProto proto_file = 15;
- for (auto it = this->proto_file().pointer_begin(),
- end = this->proto_file().pointer_end(); it < end; ++it) {
+ for (auto it = this->proto_file_.pointer_begin(),
+ end = this->proto_file_.pointer_end(); it < end; ++it) {
stream->EnsureSpace(&target);
target = ::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::
InternalWriteMessageToArray(15, **it, target, stream);
@@ -911,21 +911,17 @@
// repeated string file_to_generate = 1;
total_size += 1 *
- ::PROTOBUF_NAMESPACE_ID::internal::FromIntSize(this->file_to_generate_size());
- for (int i = 0, n = this->file_to_generate_size(); i < n; i++) {
+ ::PROTOBUF_NAMESPACE_ID::internal::FromIntSize(file_to_generate_.size());
+ for (int i = 0, n = file_to_generate_.size(); i < n; i++) {
total_size += ::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::StringSize(
- this->file_to_generate(i));
+ file_to_generate_.Get(i));
}
// repeated .google.protobuf.FileDescriptorProto proto_file = 15;
- {
- unsigned int count = static_cast<unsigned int>(this->proto_file_size());
- total_size += 1UL * count;
- for (unsigned int i = 0; i < count; i++) {
- total_size +=
- ::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::MessageSize(
- this->proto_file(static_cast<int>(i)));
- }
+ total_size += 1UL * this->proto_file_size();
+ for (const auto& msg : this->proto_file_) {
+ total_size +=
+ ::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::MessageSize(msg);
}
cached_has_bits = _has_bits_[0];
@@ -934,7 +930,7 @@
if (cached_has_bits & 0x00000001u) {
total_size += 1 +
::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::StringSize(
- this->parameter());
+ this->_internal_parameter());
}
// optional .google.protobuf.compiler.Version compiler_version = 3;
@@ -1013,8 +1009,8 @@
using std::swap;
_internal_metadata_.Swap(&other->_internal_metadata_);
swap(_has_bits_[0], other->_has_bits_[0]);
- file_to_generate_.InternalSwap(CastToBase(&other->file_to_generate_));
- CastToBase(&proto_file_)->InternalSwap(CastToBase(&other->proto_file_));
+ file_to_generate_.InternalSwap(&other->file_to_generate_);
+ proto_file_.InternalSwap(&other->proto_file_);
parameter_.Swap(&other->parameter_, &::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(),
GetArenaNoVirtual());
swap(compiler_version_, other->compiler_version_);
@@ -1054,15 +1050,15 @@
_has_bits_(from._has_bits_) {
_internal_metadata_.MergeFrom(from._internal_metadata_);
name_.UnsafeSetDefault(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited());
- if (from.has_name()) {
+ if (from._internal_has_name()) {
name_.AssignWithDefault(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(), from.name_);
}
insertion_point_.UnsafeSetDefault(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited());
- if (from.has_insertion_point()) {
+ if (from._internal_has_insertion_point()) {
insertion_point_.AssignWithDefault(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(), from.insertion_point_);
}
content_.UnsafeSetDefault(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited());
- if (from.has_content()) {
+ if (from._internal_has_content()) {
content_.AssignWithDefault(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(), from.content_);
}
// @@protoc_insertion_point(copy_constructor:google.protobuf.compiler.CodeGeneratorResponse.File)
@@ -1129,21 +1125,21 @@
// optional string name = 1;
case 1:
if (PROTOBUF_PREDICT_TRUE(static_cast<::PROTOBUF_NAMESPACE_ID::uint8>(tag) == 10)) {
- ptr = ::PROTOBUF_NAMESPACE_ID::internal::InlineGreedyStringParserUTF8Verify(mutable_name(), ptr, ctx, "google.protobuf.compiler.CodeGeneratorResponse.File.name");
+ ptr = ::PROTOBUF_NAMESPACE_ID::internal::InlineGreedyStringParserUTF8Verify(_internal_mutable_name(), ptr, ctx, "google.protobuf.compiler.CodeGeneratorResponse.File.name");
CHK_(ptr);
} else goto handle_unusual;
continue;
// optional string insertion_point = 2;
case 2:
if (PROTOBUF_PREDICT_TRUE(static_cast<::PROTOBUF_NAMESPACE_ID::uint8>(tag) == 18)) {
- ptr = ::PROTOBUF_NAMESPACE_ID::internal::InlineGreedyStringParserUTF8Verify(mutable_insertion_point(), ptr, ctx, "google.protobuf.compiler.CodeGeneratorResponse.File.insertion_point");
+ ptr = ::PROTOBUF_NAMESPACE_ID::internal::InlineGreedyStringParserUTF8Verify(_internal_mutable_insertion_point(), ptr, ctx, "google.protobuf.compiler.CodeGeneratorResponse.File.insertion_point");
CHK_(ptr);
} else goto handle_unusual;
continue;
// optional string content = 15;
case 15:
if (PROTOBUF_PREDICT_TRUE(static_cast<::PROTOBUF_NAMESPACE_ID::uint8>(tag) == 122)) {
- ptr = ::PROTOBUF_NAMESPACE_ID::internal::InlineGreedyStringParserUTF8Verify(mutable_content(), ptr, ctx, "google.protobuf.compiler.CodeGeneratorResponse.File.content");
+ ptr = ::PROTOBUF_NAMESPACE_ID::internal::InlineGreedyStringParserUTF8Verify(_internal_mutable_content(), ptr, ctx, "google.protobuf.compiler.CodeGeneratorResponse.File.content");
CHK_(ptr);
} else goto handle_unusual;
continue;
@@ -1182,9 +1178,9 @@
case 1: {
if (static_cast< ::PROTOBUF_NAMESPACE_ID::uint8>(tag) == (10 & 0xFF)) {
DO_(::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::ReadString(
- input, this->mutable_name()));
+ input, this->_internal_mutable_name()));
::PROTOBUF_NAMESPACE_ID::internal::WireFormat::VerifyUTF8StringNamedField(
- this->name().data(), static_cast<int>(this->name().length()),
+ this->_internal_name().data(), static_cast<int>(this->_internal_name().length()),
::PROTOBUF_NAMESPACE_ID::internal::WireFormat::PARSE,
"google.protobuf.compiler.CodeGeneratorResponse.File.name");
} else {
@@ -1197,9 +1193,9 @@
case 2: {
if (static_cast< ::PROTOBUF_NAMESPACE_ID::uint8>(tag) == (18 & 0xFF)) {
DO_(::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::ReadString(
- input, this->mutable_insertion_point()));
+ input, this->_internal_mutable_insertion_point()));
::PROTOBUF_NAMESPACE_ID::internal::WireFormat::VerifyUTF8StringNamedField(
- this->insertion_point().data(), static_cast<int>(this->insertion_point().length()),
+ this->_internal_insertion_point().data(), static_cast<int>(this->_internal_insertion_point().length()),
::PROTOBUF_NAMESPACE_ID::internal::WireFormat::PARSE,
"google.protobuf.compiler.CodeGeneratorResponse.File.insertion_point");
} else {
@@ -1212,9 +1208,9 @@
case 15: {
if (static_cast< ::PROTOBUF_NAMESPACE_ID::uint8>(tag) == (122 & 0xFF)) {
DO_(::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::ReadString(
- input, this->mutable_content()));
+ input, this->_internal_mutable_content()));
::PROTOBUF_NAMESPACE_ID::internal::WireFormat::VerifyUTF8StringNamedField(
- this->content().data(), static_cast<int>(this->content().length()),
+ this->_internal_content().data(), static_cast<int>(this->_internal_content().length()),
::PROTOBUF_NAMESPACE_ID::internal::WireFormat::PARSE,
"google.protobuf.compiler.CodeGeneratorResponse.File.content");
} else {
@@ -1254,31 +1250,31 @@
// optional string name = 1;
if (cached_has_bits & 0x00000001u) {
::PROTOBUF_NAMESPACE_ID::internal::WireFormat::VerifyUTF8StringNamedField(
- this->name().data(), static_cast<int>(this->name().length()),
+ this->_internal_name().data(), static_cast<int>(this->_internal_name().length()),
::PROTOBUF_NAMESPACE_ID::internal::WireFormat::SERIALIZE,
"google.protobuf.compiler.CodeGeneratorResponse.File.name");
target = stream->WriteStringMaybeAliased(
- 1, this->name(), target);
+ 1, this->_internal_name(), target);
}
// optional string insertion_point = 2;
if (cached_has_bits & 0x00000002u) {
::PROTOBUF_NAMESPACE_ID::internal::WireFormat::VerifyUTF8StringNamedField(
- this->insertion_point().data(), static_cast<int>(this->insertion_point().length()),
+ this->_internal_insertion_point().data(), static_cast<int>(this->_internal_insertion_point().length()),
::PROTOBUF_NAMESPACE_ID::internal::WireFormat::SERIALIZE,
"google.protobuf.compiler.CodeGeneratorResponse.File.insertion_point");
target = stream->WriteStringMaybeAliased(
- 2, this->insertion_point(), target);
+ 2, this->_internal_insertion_point(), target);
}
// optional string content = 15;
if (cached_has_bits & 0x00000004u) {
::PROTOBUF_NAMESPACE_ID::internal::WireFormat::VerifyUTF8StringNamedField(
- this->content().data(), static_cast<int>(this->content().length()),
+ this->_internal_content().data(), static_cast<int>(this->_internal_content().length()),
::PROTOBUF_NAMESPACE_ID::internal::WireFormat::SERIALIZE,
"google.protobuf.compiler.CodeGeneratorResponse.File.content");
target = stream->WriteStringMaybeAliased(
- 15, this->content(), target);
+ 15, this->_internal_content(), target);
}
if (PROTOBUF_PREDICT_FALSE(_internal_metadata_.have_unknown_fields())) {
@@ -1303,21 +1299,21 @@
if (cached_has_bits & 0x00000001u) {
total_size += 1 +
::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::StringSize(
- this->name());
+ this->_internal_name());
}
// optional string insertion_point = 2;
if (cached_has_bits & 0x00000002u) {
total_size += 1 +
::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::StringSize(
- this->insertion_point());
+ this->_internal_insertion_point());
}
// optional string content = 15;
if (cached_has_bits & 0x00000004u) {
total_size += 1 +
::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::StringSize(
- this->content());
+ this->_internal_content());
}
}
@@ -1428,7 +1424,7 @@
file_(from.file_) {
_internal_metadata_.MergeFrom(from._internal_metadata_);
error_.UnsafeSetDefault(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited());
- if (from.has_error()) {
+ if (from._internal_has_error()) {
error_.AssignWithDefault(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(), from.error_);
}
// @@protoc_insertion_point(copy_constructor:google.protobuf.compiler.CodeGeneratorResponse)
@@ -1484,7 +1480,7 @@
// optional string error = 1;
case 1:
if (PROTOBUF_PREDICT_TRUE(static_cast<::PROTOBUF_NAMESPACE_ID::uint8>(tag) == 10)) {
- ptr = ::PROTOBUF_NAMESPACE_ID::internal::InlineGreedyStringParserUTF8Verify(mutable_error(), ptr, ctx, "google.protobuf.compiler.CodeGeneratorResponse.error");
+ ptr = ::PROTOBUF_NAMESPACE_ID::internal::InlineGreedyStringParserUTF8Verify(_internal_mutable_error(), ptr, ctx, "google.protobuf.compiler.CodeGeneratorResponse.error");
CHK_(ptr);
} else goto handle_unusual;
continue;
@@ -1497,7 +1493,7 @@
ptr = ctx->ParseMessage(add_file(), ptr);
CHK_(ptr);
if (!ctx->DataAvailable(ptr)) break;
- } while (::PROTOBUF_NAMESPACE_ID::internal::UnalignedLoad<::PROTOBUF_NAMESPACE_ID::uint8>(ptr) == 122);
+ } while (::PROTOBUF_NAMESPACE_ID::internal::ExpectTag<122>(ptr));
} else goto handle_unusual;
continue;
default: {
@@ -1535,9 +1531,9 @@
case 1: {
if (static_cast< ::PROTOBUF_NAMESPACE_ID::uint8>(tag) == (10 & 0xFF)) {
DO_(::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::ReadString(
- input, this->mutable_error()));
+ input, this->_internal_mutable_error()));
::PROTOBUF_NAMESPACE_ID::internal::WireFormat::VerifyUTF8StringNamedField(
- this->error().data(), static_cast<int>(this->error().length()),
+ this->_internal_error().data(), static_cast<int>(this->_internal_error().length()),
::PROTOBUF_NAMESPACE_ID::internal::WireFormat::PARSE,
"google.protobuf.compiler.CodeGeneratorResponse.error");
} else {
@@ -1588,16 +1584,16 @@
// optional string error = 1;
if (cached_has_bits & 0x00000001u) {
::PROTOBUF_NAMESPACE_ID::internal::WireFormat::VerifyUTF8StringNamedField(
- this->error().data(), static_cast<int>(this->error().length()),
+ this->_internal_error().data(), static_cast<int>(this->_internal_error().length()),
::PROTOBUF_NAMESPACE_ID::internal::WireFormat::SERIALIZE,
"google.protobuf.compiler.CodeGeneratorResponse.error");
target = stream->WriteStringMaybeAliased(
- 1, this->error(), target);
+ 1, this->_internal_error(), target);
}
// repeated .google.protobuf.compiler.CodeGeneratorResponse.File file = 15;
- for (auto it = this->file().pointer_begin(),
- end = this->file().pointer_end(); it < end; ++it) {
+ for (auto it = this->file_.pointer_begin(),
+ end = this->file_.pointer_end(); it < end; ++it) {
stream->EnsureSpace(&target);
target = ::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::
InternalWriteMessageToArray(15, **it, target, stream);
@@ -1620,14 +1616,10 @@
(void) cached_has_bits;
// repeated .google.protobuf.compiler.CodeGeneratorResponse.File file = 15;
- {
- unsigned int count = static_cast<unsigned int>(this->file_size());
- total_size += 1UL * count;
- for (unsigned int i = 0; i < count; i++) {
- total_size +=
- ::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::MessageSize(
- this->file(static_cast<int>(i)));
- }
+ total_size += 1UL * this->file_size();
+ for (const auto& msg : this->file_) {
+ total_size +=
+ ::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::MessageSize(msg);
}
// optional string error = 1;
@@ -1635,7 +1627,7 @@
if (cached_has_bits & 0x00000001u) {
total_size += 1 +
::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::StringSize(
- this->error());
+ this->_internal_error());
}
if (PROTOBUF_PREDICT_FALSE(_internal_metadata_.have_unknown_fields())) {
@@ -1698,7 +1690,7 @@
using std::swap;
_internal_metadata_.Swap(&other->_internal_metadata_);
swap(_has_bits_[0], other->_has_bits_[0]);
- CastToBase(&file_)->InternalSwap(CastToBase(&other->file_));
+ file_.InternalSwap(&other->file_);
error_.Swap(&other->error_, &::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(),
GetArenaNoVirtual());
}
diff --git a/src/google/protobuf/compiler/plugin.pb.h b/src/google/protobuf/compiler/plugin.pb.h
index 5055df2..511abee 100644
--- a/src/google/protobuf/compiler/plugin.pb.h
+++ b/src/google/protobuf/compiler/plugin.pb.h
@@ -213,6 +213,9 @@
};
// optional string suffix = 4;
bool has_suffix() const;
+ private:
+ bool _internal_has_suffix() const;
+ public:
void clear_suffix();
const std::string& suffix() const;
void set_suffix(const std::string& value);
@@ -222,21 +225,35 @@
std::string* mutable_suffix();
std::string* release_suffix();
void set_allocated_suffix(std::string* suffix);
+ private:
+ const std::string& _internal_suffix() const;
+ void _internal_set_suffix(const std::string& value);
+ std::string* _internal_mutable_suffix();
+ public:
// optional int32 major = 1;
bool has_major() const;
+ private:
+ bool _internal_has_major() const;
+ public:
void clear_major();
::PROTOBUF_NAMESPACE_ID::int32 major() const;
void set_major(::PROTOBUF_NAMESPACE_ID::int32 value);
// optional int32 minor = 2;
bool has_minor() const;
+ private:
+ bool _internal_has_minor() const;
+ public:
void clear_minor();
::PROTOBUF_NAMESPACE_ID::int32 minor() const;
void set_minor(::PROTOBUF_NAMESPACE_ID::int32 value);
// optional int32 patch = 3;
bool has_patch() const;
+ private:
+ bool _internal_has_patch() const;
+ public:
void clear_patch();
::PROTOBUF_NAMESPACE_ID::int32 patch() const;
void set_patch(::PROTOBUF_NAMESPACE_ID::int32 value);
@@ -395,6 +412,9 @@
void add_file_to_generate(const char* value, size_t size);
const ::PROTOBUF_NAMESPACE_ID::RepeatedPtrField<std::string>& file_to_generate() const;
::PROTOBUF_NAMESPACE_ID::RepeatedPtrField<std::string>* mutable_file_to_generate();
+ private:
+ std::string* _internal_add_file_to_generate();
+ public:
// repeated .google.protobuf.FileDescriptorProto proto_file = 15;
int proto_file_size() const;
@@ -409,6 +429,9 @@
// optional string parameter = 2;
bool has_parameter() const;
+ private:
+ bool _internal_has_parameter() const;
+ public:
void clear_parameter();
const std::string& parameter() const;
void set_parameter(const std::string& value);
@@ -418,9 +441,17 @@
std::string* mutable_parameter();
std::string* release_parameter();
void set_allocated_parameter(std::string* parameter);
+ private:
+ const std::string& _internal_parameter() const;
+ void _internal_set_parameter(const std::string& value);
+ std::string* _internal_mutable_parameter();
+ public:
// optional .google.protobuf.compiler.Version compiler_version = 3;
bool has_compiler_version() const;
+ private:
+ bool _internal_has_compiler_version() const;
+ public:
void clear_compiler_version();
const PROTOBUF_NAMESPACE_ID::compiler::Version& compiler_version() const;
PROTOBUF_NAMESPACE_ID::compiler::Version* release_compiler_version();
@@ -566,6 +597,9 @@
};
// optional string name = 1;
bool has_name() const;
+ private:
+ bool _internal_has_name() const;
+ public:
void clear_name();
const std::string& name() const;
void set_name(const std::string& value);
@@ -575,9 +609,17 @@
std::string* mutable_name();
std::string* release_name();
void set_allocated_name(std::string* name);
+ private:
+ const std::string& _internal_name() const;
+ void _internal_set_name(const std::string& value);
+ std::string* _internal_mutable_name();
+ public:
// optional string insertion_point = 2;
bool has_insertion_point() const;
+ private:
+ bool _internal_has_insertion_point() const;
+ public:
void clear_insertion_point();
const std::string& insertion_point() const;
void set_insertion_point(const std::string& value);
@@ -587,9 +629,17 @@
std::string* mutable_insertion_point();
std::string* release_insertion_point();
void set_allocated_insertion_point(std::string* insertion_point);
+ private:
+ const std::string& _internal_insertion_point() const;
+ void _internal_set_insertion_point(const std::string& value);
+ std::string* _internal_mutable_insertion_point();
+ public:
// optional string content = 15;
bool has_content() const;
+ private:
+ bool _internal_has_content() const;
+ public:
void clear_content();
const std::string& content() const;
void set_content(const std::string& value);
@@ -599,6 +649,11 @@
std::string* mutable_content();
std::string* release_content();
void set_allocated_content(std::string* content);
+ private:
+ const std::string& _internal_content() const;
+ void _internal_set_content(const std::string& value);
+ std::string* _internal_mutable_content();
+ public:
// @@protoc_insertion_point(class_scope:google.protobuf.compiler.CodeGeneratorResponse.File)
private:
@@ -750,6 +805,9 @@
// optional string error = 1;
bool has_error() const;
+ private:
+ bool _internal_has_error() const;
+ public:
void clear_error();
const std::string& error() const;
void set_error(const std::string& value);
@@ -759,6 +817,11 @@
std::string* mutable_error();
std::string* release_error();
void set_allocated_error(std::string* error);
+ private:
+ const std::string& _internal_error() const;
+ void _internal_set_error(const std::string& value);
+ std::string* _internal_mutable_error();
+ public:
// @@protoc_insertion_point(class_scope:google.protobuf.compiler.CodeGeneratorResponse)
private:
@@ -783,9 +846,12 @@
// Version
// optional int32 major = 1;
-inline bool Version::has_major() const {
+inline bool Version::_internal_has_major() const {
return (_has_bits_[0] & 0x00000002u) != 0;
}
+inline bool Version::has_major() const {
+ return _internal_has_major();
+}
inline void Version::clear_major() {
major_ = 0;
_has_bits_[0] &= ~0x00000002u;
@@ -801,9 +867,12 @@
}
// optional int32 minor = 2;
-inline bool Version::has_minor() const {
+inline bool Version::_internal_has_minor() const {
return (_has_bits_[0] & 0x00000004u) != 0;
}
+inline bool Version::has_minor() const {
+ return _internal_has_minor();
+}
inline void Version::clear_minor() {
minor_ = 0;
_has_bits_[0] &= ~0x00000004u;
@@ -819,9 +888,12 @@
}
// optional int32 patch = 3;
-inline bool Version::has_patch() const {
+inline bool Version::_internal_has_patch() const {
return (_has_bits_[0] & 0x00000008u) != 0;
}
+inline bool Version::has_patch() const {
+ return _internal_has_patch();
+}
inline void Version::clear_patch() {
patch_ = 0;
_has_bits_[0] &= ~0x00000008u;
@@ -837,21 +909,34 @@
}
// optional string suffix = 4;
-inline bool Version::has_suffix() const {
+inline bool Version::_internal_has_suffix() const {
return (_has_bits_[0] & 0x00000001u) != 0;
}
+inline bool Version::has_suffix() const {
+ return _internal_has_suffix();
+}
inline void Version::clear_suffix() {
suffix_.ClearToEmptyNoArena(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited());
_has_bits_[0] &= ~0x00000001u;
}
inline const std::string& Version::suffix() const {
// @@protoc_insertion_point(field_get:google.protobuf.compiler.Version.suffix)
- return suffix_.GetNoArena();
+ return _internal_suffix();
}
inline void Version::set_suffix(const std::string& value) {
+ _internal_set_suffix(value);
+ // @@protoc_insertion_point(field_set:google.protobuf.compiler.Version.suffix)
+}
+inline std::string* Version::mutable_suffix() {
+ // @@protoc_insertion_point(field_mutable:google.protobuf.compiler.Version.suffix)
+ return _internal_mutable_suffix();
+}
+inline const std::string& Version::_internal_suffix() const {
+ return suffix_.GetNoArena();
+}
+inline void Version::_internal_set_suffix(const std::string& value) {
_has_bits_[0] |= 0x00000001u;
suffix_.SetNoArena(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(), value);
- // @@protoc_insertion_point(field_set:google.protobuf.compiler.Version.suffix)
}
inline void Version::set_suffix(std::string&& value) {
_has_bits_[0] |= 0x00000001u;
@@ -871,9 +956,8 @@
::std::string(reinterpret_cast<const char*>(value), size));
// @@protoc_insertion_point(field_set_pointer:google.protobuf.compiler.Version.suffix)
}
-inline std::string* Version::mutable_suffix() {
+inline std::string* Version::_internal_mutable_suffix() {
_has_bits_[0] |= 0x00000001u;
- // @@protoc_insertion_point(field_mutable:google.protobuf.compiler.Version.suffix)
return suffix_.MutableNoArena(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited());
}
inline std::string* Version::release_suffix() {
@@ -905,6 +989,10 @@
inline void CodeGeneratorRequest::clear_file_to_generate() {
file_to_generate_.Clear();
}
+inline std::string* CodeGeneratorRequest::add_file_to_generate() {
+ // @@protoc_insertion_point(field_add_mutable:google.protobuf.compiler.CodeGeneratorRequest.file_to_generate)
+ return _internal_add_file_to_generate();
+}
inline const std::string& CodeGeneratorRequest::file_to_generate(int index) const {
// @@protoc_insertion_point(field_get:google.protobuf.compiler.CodeGeneratorRequest.file_to_generate)
return file_to_generate_.Get(index);
@@ -931,8 +1019,7 @@
reinterpret_cast<const char*>(value), size);
// @@protoc_insertion_point(field_set_pointer:google.protobuf.compiler.CodeGeneratorRequest.file_to_generate)
}
-inline std::string* CodeGeneratorRequest::add_file_to_generate() {
- // @@protoc_insertion_point(field_add_mutable:google.protobuf.compiler.CodeGeneratorRequest.file_to_generate)
+inline std::string* CodeGeneratorRequest::_internal_add_file_to_generate() {
return file_to_generate_.Add();
}
inline void CodeGeneratorRequest::add_file_to_generate(const std::string& value) {
@@ -964,21 +1051,34 @@
}
// optional string parameter = 2;
-inline bool CodeGeneratorRequest::has_parameter() const {
+inline bool CodeGeneratorRequest::_internal_has_parameter() const {
return (_has_bits_[0] & 0x00000001u) != 0;
}
+inline bool CodeGeneratorRequest::has_parameter() const {
+ return _internal_has_parameter();
+}
inline void CodeGeneratorRequest::clear_parameter() {
parameter_.ClearToEmptyNoArena(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited());
_has_bits_[0] &= ~0x00000001u;
}
inline const std::string& CodeGeneratorRequest::parameter() const {
// @@protoc_insertion_point(field_get:google.protobuf.compiler.CodeGeneratorRequest.parameter)
- return parameter_.GetNoArena();
+ return _internal_parameter();
}
inline void CodeGeneratorRequest::set_parameter(const std::string& value) {
+ _internal_set_parameter(value);
+ // @@protoc_insertion_point(field_set:google.protobuf.compiler.CodeGeneratorRequest.parameter)
+}
+inline std::string* CodeGeneratorRequest::mutable_parameter() {
+ // @@protoc_insertion_point(field_mutable:google.protobuf.compiler.CodeGeneratorRequest.parameter)
+ return _internal_mutable_parameter();
+}
+inline const std::string& CodeGeneratorRequest::_internal_parameter() const {
+ return parameter_.GetNoArena();
+}
+inline void CodeGeneratorRequest::_internal_set_parameter(const std::string& value) {
_has_bits_[0] |= 0x00000001u;
parameter_.SetNoArena(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(), value);
- // @@protoc_insertion_point(field_set:google.protobuf.compiler.CodeGeneratorRequest.parameter)
}
inline void CodeGeneratorRequest::set_parameter(std::string&& value) {
_has_bits_[0] |= 0x00000001u;
@@ -998,9 +1098,8 @@
::std::string(reinterpret_cast<const char*>(value), size));
// @@protoc_insertion_point(field_set_pointer:google.protobuf.compiler.CodeGeneratorRequest.parameter)
}
-inline std::string* CodeGeneratorRequest::mutable_parameter() {
+inline std::string* CodeGeneratorRequest::_internal_mutable_parameter() {
_has_bits_[0] |= 0x00000001u;
- // @@protoc_insertion_point(field_mutable:google.protobuf.compiler.CodeGeneratorRequest.parameter)
return parameter_.MutableNoArena(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited());
}
inline std::string* CodeGeneratorRequest::release_parameter() {
@@ -1049,9 +1148,12 @@
}
// optional .google.protobuf.compiler.Version compiler_version = 3;
-inline bool CodeGeneratorRequest::has_compiler_version() const {
+inline bool CodeGeneratorRequest::_internal_has_compiler_version() const {
return (_has_bits_[0] & 0x00000002u) != 0;
}
+inline bool CodeGeneratorRequest::has_compiler_version() const {
+ return _internal_has_compiler_version();
+}
inline void CodeGeneratorRequest::clear_compiler_version() {
if (compiler_version_ != nullptr) compiler_version_->Clear();
_has_bits_[0] &= ~0x00000002u;
@@ -1102,21 +1204,34 @@
// CodeGeneratorResponse_File
// optional string name = 1;
-inline bool CodeGeneratorResponse_File::has_name() const {
+inline bool CodeGeneratorResponse_File::_internal_has_name() const {
return (_has_bits_[0] & 0x00000001u) != 0;
}
+inline bool CodeGeneratorResponse_File::has_name() const {
+ return _internal_has_name();
+}
inline void CodeGeneratorResponse_File::clear_name() {
name_.ClearToEmptyNoArena(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited());
_has_bits_[0] &= ~0x00000001u;
}
inline const std::string& CodeGeneratorResponse_File::name() const {
// @@protoc_insertion_point(field_get:google.protobuf.compiler.CodeGeneratorResponse.File.name)
- return name_.GetNoArena();
+ return _internal_name();
}
inline void CodeGeneratorResponse_File::set_name(const std::string& value) {
+ _internal_set_name(value);
+ // @@protoc_insertion_point(field_set:google.protobuf.compiler.CodeGeneratorResponse.File.name)
+}
+inline std::string* CodeGeneratorResponse_File::mutable_name() {
+ // @@protoc_insertion_point(field_mutable:google.protobuf.compiler.CodeGeneratorResponse.File.name)
+ return _internal_mutable_name();
+}
+inline const std::string& CodeGeneratorResponse_File::_internal_name() const {
+ return name_.GetNoArena();
+}
+inline void CodeGeneratorResponse_File::_internal_set_name(const std::string& value) {
_has_bits_[0] |= 0x00000001u;
name_.SetNoArena(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(), value);
- // @@protoc_insertion_point(field_set:google.protobuf.compiler.CodeGeneratorResponse.File.name)
}
inline void CodeGeneratorResponse_File::set_name(std::string&& value) {
_has_bits_[0] |= 0x00000001u;
@@ -1136,9 +1251,8 @@
::std::string(reinterpret_cast<const char*>(value), size));
// @@protoc_insertion_point(field_set_pointer:google.protobuf.compiler.CodeGeneratorResponse.File.name)
}
-inline std::string* CodeGeneratorResponse_File::mutable_name() {
+inline std::string* CodeGeneratorResponse_File::_internal_mutable_name() {
_has_bits_[0] |= 0x00000001u;
- // @@protoc_insertion_point(field_mutable:google.protobuf.compiler.CodeGeneratorResponse.File.name)
return name_.MutableNoArena(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited());
}
inline std::string* CodeGeneratorResponse_File::release_name() {
@@ -1160,21 +1274,34 @@
}
// optional string insertion_point = 2;
-inline bool CodeGeneratorResponse_File::has_insertion_point() const {
+inline bool CodeGeneratorResponse_File::_internal_has_insertion_point() const {
return (_has_bits_[0] & 0x00000002u) != 0;
}
+inline bool CodeGeneratorResponse_File::has_insertion_point() const {
+ return _internal_has_insertion_point();
+}
inline void CodeGeneratorResponse_File::clear_insertion_point() {
insertion_point_.ClearToEmptyNoArena(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited());
_has_bits_[0] &= ~0x00000002u;
}
inline const std::string& CodeGeneratorResponse_File::insertion_point() const {
// @@protoc_insertion_point(field_get:google.protobuf.compiler.CodeGeneratorResponse.File.insertion_point)
- return insertion_point_.GetNoArena();
+ return _internal_insertion_point();
}
inline void CodeGeneratorResponse_File::set_insertion_point(const std::string& value) {
+ _internal_set_insertion_point(value);
+ // @@protoc_insertion_point(field_set:google.protobuf.compiler.CodeGeneratorResponse.File.insertion_point)
+}
+inline std::string* CodeGeneratorResponse_File::mutable_insertion_point() {
+ // @@protoc_insertion_point(field_mutable:google.protobuf.compiler.CodeGeneratorResponse.File.insertion_point)
+ return _internal_mutable_insertion_point();
+}
+inline const std::string& CodeGeneratorResponse_File::_internal_insertion_point() const {
+ return insertion_point_.GetNoArena();
+}
+inline void CodeGeneratorResponse_File::_internal_set_insertion_point(const std::string& value) {
_has_bits_[0] |= 0x00000002u;
insertion_point_.SetNoArena(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(), value);
- // @@protoc_insertion_point(field_set:google.protobuf.compiler.CodeGeneratorResponse.File.insertion_point)
}
inline void CodeGeneratorResponse_File::set_insertion_point(std::string&& value) {
_has_bits_[0] |= 0x00000002u;
@@ -1194,9 +1321,8 @@
::std::string(reinterpret_cast<const char*>(value), size));
// @@protoc_insertion_point(field_set_pointer:google.protobuf.compiler.CodeGeneratorResponse.File.insertion_point)
}
-inline std::string* CodeGeneratorResponse_File::mutable_insertion_point() {
+inline std::string* CodeGeneratorResponse_File::_internal_mutable_insertion_point() {
_has_bits_[0] |= 0x00000002u;
- // @@protoc_insertion_point(field_mutable:google.protobuf.compiler.CodeGeneratorResponse.File.insertion_point)
return insertion_point_.MutableNoArena(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited());
}
inline std::string* CodeGeneratorResponse_File::release_insertion_point() {
@@ -1218,21 +1344,34 @@
}
// optional string content = 15;
-inline bool CodeGeneratorResponse_File::has_content() const {
+inline bool CodeGeneratorResponse_File::_internal_has_content() const {
return (_has_bits_[0] & 0x00000004u) != 0;
}
+inline bool CodeGeneratorResponse_File::has_content() const {
+ return _internal_has_content();
+}
inline void CodeGeneratorResponse_File::clear_content() {
content_.ClearToEmptyNoArena(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited());
_has_bits_[0] &= ~0x00000004u;
}
inline const std::string& CodeGeneratorResponse_File::content() const {
// @@protoc_insertion_point(field_get:google.protobuf.compiler.CodeGeneratorResponse.File.content)
- return content_.GetNoArena();
+ return _internal_content();
}
inline void CodeGeneratorResponse_File::set_content(const std::string& value) {
+ _internal_set_content(value);
+ // @@protoc_insertion_point(field_set:google.protobuf.compiler.CodeGeneratorResponse.File.content)
+}
+inline std::string* CodeGeneratorResponse_File::mutable_content() {
+ // @@protoc_insertion_point(field_mutable:google.protobuf.compiler.CodeGeneratorResponse.File.content)
+ return _internal_mutable_content();
+}
+inline const std::string& CodeGeneratorResponse_File::_internal_content() const {
+ return content_.GetNoArena();
+}
+inline void CodeGeneratorResponse_File::_internal_set_content(const std::string& value) {
_has_bits_[0] |= 0x00000004u;
content_.SetNoArena(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(), value);
- // @@protoc_insertion_point(field_set:google.protobuf.compiler.CodeGeneratorResponse.File.content)
}
inline void CodeGeneratorResponse_File::set_content(std::string&& value) {
_has_bits_[0] |= 0x00000004u;
@@ -1252,9 +1391,8 @@
::std::string(reinterpret_cast<const char*>(value), size));
// @@protoc_insertion_point(field_set_pointer:google.protobuf.compiler.CodeGeneratorResponse.File.content)
}
-inline std::string* CodeGeneratorResponse_File::mutable_content() {
+inline std::string* CodeGeneratorResponse_File::_internal_mutable_content() {
_has_bits_[0] |= 0x00000004u;
- // @@protoc_insertion_point(field_mutable:google.protobuf.compiler.CodeGeneratorResponse.File.content)
return content_.MutableNoArena(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited());
}
inline std::string* CodeGeneratorResponse_File::release_content() {
@@ -1280,21 +1418,34 @@
// CodeGeneratorResponse
// optional string error = 1;
-inline bool CodeGeneratorResponse::has_error() const {
+inline bool CodeGeneratorResponse::_internal_has_error() const {
return (_has_bits_[0] & 0x00000001u) != 0;
}
+inline bool CodeGeneratorResponse::has_error() const {
+ return _internal_has_error();
+}
inline void CodeGeneratorResponse::clear_error() {
error_.ClearToEmptyNoArena(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited());
_has_bits_[0] &= ~0x00000001u;
}
inline const std::string& CodeGeneratorResponse::error() const {
// @@protoc_insertion_point(field_get:google.protobuf.compiler.CodeGeneratorResponse.error)
- return error_.GetNoArena();
+ return _internal_error();
}
inline void CodeGeneratorResponse::set_error(const std::string& value) {
+ _internal_set_error(value);
+ // @@protoc_insertion_point(field_set:google.protobuf.compiler.CodeGeneratorResponse.error)
+}
+inline std::string* CodeGeneratorResponse::mutable_error() {
+ // @@protoc_insertion_point(field_mutable:google.protobuf.compiler.CodeGeneratorResponse.error)
+ return _internal_mutable_error();
+}
+inline const std::string& CodeGeneratorResponse::_internal_error() const {
+ return error_.GetNoArena();
+}
+inline void CodeGeneratorResponse::_internal_set_error(const std::string& value) {
_has_bits_[0] |= 0x00000001u;
error_.SetNoArena(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(), value);
- // @@protoc_insertion_point(field_set:google.protobuf.compiler.CodeGeneratorResponse.error)
}
inline void CodeGeneratorResponse::set_error(std::string&& value) {
_has_bits_[0] |= 0x00000001u;
@@ -1314,9 +1465,8 @@
::std::string(reinterpret_cast<const char*>(value), size));
// @@protoc_insertion_point(field_set_pointer:google.protobuf.compiler.CodeGeneratorResponse.error)
}
-inline std::string* CodeGeneratorResponse::mutable_error() {
+inline std::string* CodeGeneratorResponse::_internal_mutable_error() {
_has_bits_[0] |= 0x00000001u;
- // @@protoc_insertion_point(field_mutable:google.protobuf.compiler.CodeGeneratorResponse.error)
return error_.MutableNoArena(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited());
}
inline std::string* CodeGeneratorResponse::release_error() {
diff --git a/src/google/protobuf/compiler/python/python_generator.cc b/src/google/protobuf/compiler/python/python_generator.cc
index ec0704a..cddad3e 100644
--- a/src/google/protobuf/compiler/python/python_generator.cc
+++ b/src/google/protobuf/compiler/python/python_generator.cc
@@ -64,8 +64,6 @@
#include <google/protobuf/stubs/strutil.h>
#include <google/protobuf/stubs/substitute.h>
-
-
namespace google {
namespace protobuf {
namespace compiler {
diff --git a/src/google/protobuf/descriptor.cc b/src/google/protobuf/descriptor.cc
index 5bc64f1..df25ac9 100644
--- a/src/google/protobuf/descriptor.cc
+++ b/src/google/protobuf/descriptor.cc
@@ -32,6 +32,8 @@
// Based on original Protocol Buffers design by
// Sanjay Ghemawat, Jeff Dean, and others.
+#include <google/protobuf/descriptor.h>
+
#include <algorithm>
#include <functional>
#include <limits>
@@ -48,11 +50,9 @@
#include <google/protobuf/stubs/stringprintf.h>
#include <google/protobuf/stubs/strutil.h>
#include <google/protobuf/descriptor.pb.h>
-#include <google/protobuf/io/strtod.h>
#include <google/protobuf/io/coded_stream.h>
#include <google/protobuf/io/tokenizer.h>
#include <google/protobuf/io/zero_copy_stream_impl.h>
-#include <google/protobuf/descriptor.h>
#include <google/protobuf/descriptor_database.h>
#include <google/protobuf/dynamic_message.h>
#include <google/protobuf/generated_message_util.h>
@@ -61,9 +61,7 @@
#include <google/protobuf/wire_format.h>
#include <google/protobuf/stubs/substitute.h>
#include <google/protobuf/stubs/casts.h>
-
-
-
+#include <google/protobuf/io/strtod.h>
#include <google/protobuf/stubs/map_util.h>
#include <google/protobuf/stubs/stl_util.h>
#include <google/protobuf/stubs/hash.h>
@@ -4696,7 +4694,7 @@
// `ErrorCollector` interface to extend them to handle the new
// error location type properly.
DescriptorPool::ErrorCollector::TYPE,
- "Message extensions cannot have required fields.");
+ "The extension " + result->full_name() + " cannot be required.");
}
// Some of these may be filled in when cross-linking.
diff --git a/src/google/protobuf/descriptor.pb.cc b/src/google/protobuf/descriptor.pb.cc
index 8feecb8..092be42 100644
--- a/src/google/protobuf/descriptor.pb.cc
+++ b/src/google/protobuf/descriptor.pb.cc
@@ -161,7 +161,7 @@
}
PROTOBUF_EXPORT ::PROTOBUF_NAMESPACE_ID::internal::SCCInfo<6> scc_info_DescriptorProto_google_2fprotobuf_2fdescriptor_2eproto =
- {{ATOMIC_VAR_INIT(::PROTOBUF_NAMESPACE_ID::internal::SCCInfoBase::kUninitialized), 6, InitDefaultsscc_info_DescriptorProto_google_2fprotobuf_2fdescriptor_2eproto}, {
+ {{ATOMIC_VAR_INIT(::PROTOBUF_NAMESPACE_ID::internal::SCCInfoBase::kUninitialized), 6, 0, InitDefaultsscc_info_DescriptorProto_google_2fprotobuf_2fdescriptor_2eproto}, {
&scc_info_FieldDescriptorProto_google_2fprotobuf_2fdescriptor_2eproto.base,
&scc_info_EnumDescriptorProto_google_2fprotobuf_2fdescriptor_2eproto.base,
&scc_info_DescriptorProto_ExtensionRange_google_2fprotobuf_2fdescriptor_2eproto.base,
@@ -181,7 +181,7 @@
}
PROTOBUF_EXPORT ::PROTOBUF_NAMESPACE_ID::internal::SCCInfo<1> scc_info_DescriptorProto_ExtensionRange_google_2fprotobuf_2fdescriptor_2eproto =
- {{ATOMIC_VAR_INIT(::PROTOBUF_NAMESPACE_ID::internal::SCCInfoBase::kUninitialized), 1, InitDefaultsscc_info_DescriptorProto_ExtensionRange_google_2fprotobuf_2fdescriptor_2eproto}, {
+ {{ATOMIC_VAR_INIT(::PROTOBUF_NAMESPACE_ID::internal::SCCInfoBase::kUninitialized), 1, 0, InitDefaultsscc_info_DescriptorProto_ExtensionRange_google_2fprotobuf_2fdescriptor_2eproto}, {
&scc_info_ExtensionRangeOptions_google_2fprotobuf_2fdescriptor_2eproto.base,}};
static void InitDefaultsscc_info_DescriptorProto_ReservedRange_google_2fprotobuf_2fdescriptor_2eproto() {
@@ -196,7 +196,7 @@
}
PROTOBUF_EXPORT ::PROTOBUF_NAMESPACE_ID::internal::SCCInfo<0> scc_info_DescriptorProto_ReservedRange_google_2fprotobuf_2fdescriptor_2eproto =
- {{ATOMIC_VAR_INIT(::PROTOBUF_NAMESPACE_ID::internal::SCCInfoBase::kUninitialized), 0, InitDefaultsscc_info_DescriptorProto_ReservedRange_google_2fprotobuf_2fdescriptor_2eproto}, {}};
+ {{ATOMIC_VAR_INIT(::PROTOBUF_NAMESPACE_ID::internal::SCCInfoBase::kUninitialized), 0, 0, InitDefaultsscc_info_DescriptorProto_ReservedRange_google_2fprotobuf_2fdescriptor_2eproto}, {}};
static void InitDefaultsscc_info_EnumDescriptorProto_google_2fprotobuf_2fdescriptor_2eproto() {
GOOGLE_PROTOBUF_VERIFY_VERSION;
@@ -210,7 +210,7 @@
}
PROTOBUF_EXPORT ::PROTOBUF_NAMESPACE_ID::internal::SCCInfo<3> scc_info_EnumDescriptorProto_google_2fprotobuf_2fdescriptor_2eproto =
- {{ATOMIC_VAR_INIT(::PROTOBUF_NAMESPACE_ID::internal::SCCInfoBase::kUninitialized), 3, InitDefaultsscc_info_EnumDescriptorProto_google_2fprotobuf_2fdescriptor_2eproto}, {
+ {{ATOMIC_VAR_INIT(::PROTOBUF_NAMESPACE_ID::internal::SCCInfoBase::kUninitialized), 3, 0, InitDefaultsscc_info_EnumDescriptorProto_google_2fprotobuf_2fdescriptor_2eproto}, {
&scc_info_EnumValueDescriptorProto_google_2fprotobuf_2fdescriptor_2eproto.base,
&scc_info_EnumOptions_google_2fprotobuf_2fdescriptor_2eproto.base,
&scc_info_EnumDescriptorProto_EnumReservedRange_google_2fprotobuf_2fdescriptor_2eproto.base,}};
@@ -227,7 +227,7 @@
}
PROTOBUF_EXPORT ::PROTOBUF_NAMESPACE_ID::internal::SCCInfo<0> scc_info_EnumDescriptorProto_EnumReservedRange_google_2fprotobuf_2fdescriptor_2eproto =
- {{ATOMIC_VAR_INIT(::PROTOBUF_NAMESPACE_ID::internal::SCCInfoBase::kUninitialized), 0, InitDefaultsscc_info_EnumDescriptorProto_EnumReservedRange_google_2fprotobuf_2fdescriptor_2eproto}, {}};
+ {{ATOMIC_VAR_INIT(::PROTOBUF_NAMESPACE_ID::internal::SCCInfoBase::kUninitialized), 0, 0, InitDefaultsscc_info_EnumDescriptorProto_EnumReservedRange_google_2fprotobuf_2fdescriptor_2eproto}, {}};
static void InitDefaultsscc_info_EnumOptions_google_2fprotobuf_2fdescriptor_2eproto() {
GOOGLE_PROTOBUF_VERIFY_VERSION;
@@ -241,7 +241,7 @@
}
PROTOBUF_EXPORT ::PROTOBUF_NAMESPACE_ID::internal::SCCInfo<1> scc_info_EnumOptions_google_2fprotobuf_2fdescriptor_2eproto =
- {{ATOMIC_VAR_INIT(::PROTOBUF_NAMESPACE_ID::internal::SCCInfoBase::kUninitialized), 1, InitDefaultsscc_info_EnumOptions_google_2fprotobuf_2fdescriptor_2eproto}, {
+ {{ATOMIC_VAR_INIT(::PROTOBUF_NAMESPACE_ID::internal::SCCInfoBase::kUninitialized), 1, 0, InitDefaultsscc_info_EnumOptions_google_2fprotobuf_2fdescriptor_2eproto}, {
&scc_info_UninterpretedOption_google_2fprotobuf_2fdescriptor_2eproto.base,}};
static void InitDefaultsscc_info_EnumValueDescriptorProto_google_2fprotobuf_2fdescriptor_2eproto() {
@@ -256,7 +256,7 @@
}
PROTOBUF_EXPORT ::PROTOBUF_NAMESPACE_ID::internal::SCCInfo<1> scc_info_EnumValueDescriptorProto_google_2fprotobuf_2fdescriptor_2eproto =
- {{ATOMIC_VAR_INIT(::PROTOBUF_NAMESPACE_ID::internal::SCCInfoBase::kUninitialized), 1, InitDefaultsscc_info_EnumValueDescriptorProto_google_2fprotobuf_2fdescriptor_2eproto}, {
+ {{ATOMIC_VAR_INIT(::PROTOBUF_NAMESPACE_ID::internal::SCCInfoBase::kUninitialized), 1, 0, InitDefaultsscc_info_EnumValueDescriptorProto_google_2fprotobuf_2fdescriptor_2eproto}, {
&scc_info_EnumValueOptions_google_2fprotobuf_2fdescriptor_2eproto.base,}};
static void InitDefaultsscc_info_EnumValueOptions_google_2fprotobuf_2fdescriptor_2eproto() {
@@ -271,7 +271,7 @@
}
PROTOBUF_EXPORT ::PROTOBUF_NAMESPACE_ID::internal::SCCInfo<1> scc_info_EnumValueOptions_google_2fprotobuf_2fdescriptor_2eproto =
- {{ATOMIC_VAR_INIT(::PROTOBUF_NAMESPACE_ID::internal::SCCInfoBase::kUninitialized), 1, InitDefaultsscc_info_EnumValueOptions_google_2fprotobuf_2fdescriptor_2eproto}, {
+ {{ATOMIC_VAR_INIT(::PROTOBUF_NAMESPACE_ID::internal::SCCInfoBase::kUninitialized), 1, 0, InitDefaultsscc_info_EnumValueOptions_google_2fprotobuf_2fdescriptor_2eproto}, {
&scc_info_UninterpretedOption_google_2fprotobuf_2fdescriptor_2eproto.base,}};
static void InitDefaultsscc_info_ExtensionRangeOptions_google_2fprotobuf_2fdescriptor_2eproto() {
@@ -286,7 +286,7 @@
}
PROTOBUF_EXPORT ::PROTOBUF_NAMESPACE_ID::internal::SCCInfo<1> scc_info_ExtensionRangeOptions_google_2fprotobuf_2fdescriptor_2eproto =
- {{ATOMIC_VAR_INIT(::PROTOBUF_NAMESPACE_ID::internal::SCCInfoBase::kUninitialized), 1, InitDefaultsscc_info_ExtensionRangeOptions_google_2fprotobuf_2fdescriptor_2eproto}, {
+ {{ATOMIC_VAR_INIT(::PROTOBUF_NAMESPACE_ID::internal::SCCInfoBase::kUninitialized), 1, 0, InitDefaultsscc_info_ExtensionRangeOptions_google_2fprotobuf_2fdescriptor_2eproto}, {
&scc_info_UninterpretedOption_google_2fprotobuf_2fdescriptor_2eproto.base,}};
static void InitDefaultsscc_info_FieldDescriptorProto_google_2fprotobuf_2fdescriptor_2eproto() {
@@ -301,7 +301,7 @@
}
PROTOBUF_EXPORT ::PROTOBUF_NAMESPACE_ID::internal::SCCInfo<1> scc_info_FieldDescriptorProto_google_2fprotobuf_2fdescriptor_2eproto =
- {{ATOMIC_VAR_INIT(::PROTOBUF_NAMESPACE_ID::internal::SCCInfoBase::kUninitialized), 1, InitDefaultsscc_info_FieldDescriptorProto_google_2fprotobuf_2fdescriptor_2eproto}, {
+ {{ATOMIC_VAR_INIT(::PROTOBUF_NAMESPACE_ID::internal::SCCInfoBase::kUninitialized), 1, 0, InitDefaultsscc_info_FieldDescriptorProto_google_2fprotobuf_2fdescriptor_2eproto}, {
&scc_info_FieldOptions_google_2fprotobuf_2fdescriptor_2eproto.base,}};
static void InitDefaultsscc_info_FieldOptions_google_2fprotobuf_2fdescriptor_2eproto() {
@@ -316,7 +316,7 @@
}
PROTOBUF_EXPORT ::PROTOBUF_NAMESPACE_ID::internal::SCCInfo<1> scc_info_FieldOptions_google_2fprotobuf_2fdescriptor_2eproto =
- {{ATOMIC_VAR_INIT(::PROTOBUF_NAMESPACE_ID::internal::SCCInfoBase::kUninitialized), 1, InitDefaultsscc_info_FieldOptions_google_2fprotobuf_2fdescriptor_2eproto}, {
+ {{ATOMIC_VAR_INIT(::PROTOBUF_NAMESPACE_ID::internal::SCCInfoBase::kUninitialized), 1, 0, InitDefaultsscc_info_FieldOptions_google_2fprotobuf_2fdescriptor_2eproto}, {
&scc_info_UninterpretedOption_google_2fprotobuf_2fdescriptor_2eproto.base,}};
static void InitDefaultsscc_info_FileDescriptorProto_google_2fprotobuf_2fdescriptor_2eproto() {
@@ -331,7 +331,7 @@
}
PROTOBUF_EXPORT ::PROTOBUF_NAMESPACE_ID::internal::SCCInfo<6> scc_info_FileDescriptorProto_google_2fprotobuf_2fdescriptor_2eproto =
- {{ATOMIC_VAR_INIT(::PROTOBUF_NAMESPACE_ID::internal::SCCInfoBase::kUninitialized), 6, InitDefaultsscc_info_FileDescriptorProto_google_2fprotobuf_2fdescriptor_2eproto}, {
+ {{ATOMIC_VAR_INIT(::PROTOBUF_NAMESPACE_ID::internal::SCCInfoBase::kUninitialized), 6, 0, InitDefaultsscc_info_FileDescriptorProto_google_2fprotobuf_2fdescriptor_2eproto}, {
&scc_info_DescriptorProto_google_2fprotobuf_2fdescriptor_2eproto.base,
&scc_info_EnumDescriptorProto_google_2fprotobuf_2fdescriptor_2eproto.base,
&scc_info_ServiceDescriptorProto_google_2fprotobuf_2fdescriptor_2eproto.base,
@@ -351,7 +351,7 @@
}
PROTOBUF_EXPORT ::PROTOBUF_NAMESPACE_ID::internal::SCCInfo<1> scc_info_FileDescriptorSet_google_2fprotobuf_2fdescriptor_2eproto =
- {{ATOMIC_VAR_INIT(::PROTOBUF_NAMESPACE_ID::internal::SCCInfoBase::kUninitialized), 1, InitDefaultsscc_info_FileDescriptorSet_google_2fprotobuf_2fdescriptor_2eproto}, {
+ {{ATOMIC_VAR_INIT(::PROTOBUF_NAMESPACE_ID::internal::SCCInfoBase::kUninitialized), 1, 0, InitDefaultsscc_info_FileDescriptorSet_google_2fprotobuf_2fdescriptor_2eproto}, {
&scc_info_FileDescriptorProto_google_2fprotobuf_2fdescriptor_2eproto.base,}};
static void InitDefaultsscc_info_FileOptions_google_2fprotobuf_2fdescriptor_2eproto() {
@@ -366,7 +366,7 @@
}
PROTOBUF_EXPORT ::PROTOBUF_NAMESPACE_ID::internal::SCCInfo<1> scc_info_FileOptions_google_2fprotobuf_2fdescriptor_2eproto =
- {{ATOMIC_VAR_INIT(::PROTOBUF_NAMESPACE_ID::internal::SCCInfoBase::kUninitialized), 1, InitDefaultsscc_info_FileOptions_google_2fprotobuf_2fdescriptor_2eproto}, {
+ {{ATOMIC_VAR_INIT(::PROTOBUF_NAMESPACE_ID::internal::SCCInfoBase::kUninitialized), 1, 0, InitDefaultsscc_info_FileOptions_google_2fprotobuf_2fdescriptor_2eproto}, {
&scc_info_UninterpretedOption_google_2fprotobuf_2fdescriptor_2eproto.base,}};
static void InitDefaultsscc_info_GeneratedCodeInfo_google_2fprotobuf_2fdescriptor_2eproto() {
@@ -381,7 +381,7 @@
}
PROTOBUF_EXPORT ::PROTOBUF_NAMESPACE_ID::internal::SCCInfo<1> scc_info_GeneratedCodeInfo_google_2fprotobuf_2fdescriptor_2eproto =
- {{ATOMIC_VAR_INIT(::PROTOBUF_NAMESPACE_ID::internal::SCCInfoBase::kUninitialized), 1, InitDefaultsscc_info_GeneratedCodeInfo_google_2fprotobuf_2fdescriptor_2eproto}, {
+ {{ATOMIC_VAR_INIT(::PROTOBUF_NAMESPACE_ID::internal::SCCInfoBase::kUninitialized), 1, 0, InitDefaultsscc_info_GeneratedCodeInfo_google_2fprotobuf_2fdescriptor_2eproto}, {
&scc_info_GeneratedCodeInfo_Annotation_google_2fprotobuf_2fdescriptor_2eproto.base,}};
static void InitDefaultsscc_info_GeneratedCodeInfo_Annotation_google_2fprotobuf_2fdescriptor_2eproto() {
@@ -396,7 +396,7 @@
}
PROTOBUF_EXPORT ::PROTOBUF_NAMESPACE_ID::internal::SCCInfo<0> scc_info_GeneratedCodeInfo_Annotation_google_2fprotobuf_2fdescriptor_2eproto =
- {{ATOMIC_VAR_INIT(::PROTOBUF_NAMESPACE_ID::internal::SCCInfoBase::kUninitialized), 0, InitDefaultsscc_info_GeneratedCodeInfo_Annotation_google_2fprotobuf_2fdescriptor_2eproto}, {}};
+ {{ATOMIC_VAR_INIT(::PROTOBUF_NAMESPACE_ID::internal::SCCInfoBase::kUninitialized), 0, 0, InitDefaultsscc_info_GeneratedCodeInfo_Annotation_google_2fprotobuf_2fdescriptor_2eproto}, {}};
static void InitDefaultsscc_info_MessageOptions_google_2fprotobuf_2fdescriptor_2eproto() {
GOOGLE_PROTOBUF_VERIFY_VERSION;
@@ -410,7 +410,7 @@
}
PROTOBUF_EXPORT ::PROTOBUF_NAMESPACE_ID::internal::SCCInfo<1> scc_info_MessageOptions_google_2fprotobuf_2fdescriptor_2eproto =
- {{ATOMIC_VAR_INIT(::PROTOBUF_NAMESPACE_ID::internal::SCCInfoBase::kUninitialized), 1, InitDefaultsscc_info_MessageOptions_google_2fprotobuf_2fdescriptor_2eproto}, {
+ {{ATOMIC_VAR_INIT(::PROTOBUF_NAMESPACE_ID::internal::SCCInfoBase::kUninitialized), 1, 0, InitDefaultsscc_info_MessageOptions_google_2fprotobuf_2fdescriptor_2eproto}, {
&scc_info_UninterpretedOption_google_2fprotobuf_2fdescriptor_2eproto.base,}};
static void InitDefaultsscc_info_MethodDescriptorProto_google_2fprotobuf_2fdescriptor_2eproto() {
@@ -425,7 +425,7 @@
}
PROTOBUF_EXPORT ::PROTOBUF_NAMESPACE_ID::internal::SCCInfo<1> scc_info_MethodDescriptorProto_google_2fprotobuf_2fdescriptor_2eproto =
- {{ATOMIC_VAR_INIT(::PROTOBUF_NAMESPACE_ID::internal::SCCInfoBase::kUninitialized), 1, InitDefaultsscc_info_MethodDescriptorProto_google_2fprotobuf_2fdescriptor_2eproto}, {
+ {{ATOMIC_VAR_INIT(::PROTOBUF_NAMESPACE_ID::internal::SCCInfoBase::kUninitialized), 1, 0, InitDefaultsscc_info_MethodDescriptorProto_google_2fprotobuf_2fdescriptor_2eproto}, {
&scc_info_MethodOptions_google_2fprotobuf_2fdescriptor_2eproto.base,}};
static void InitDefaultsscc_info_MethodOptions_google_2fprotobuf_2fdescriptor_2eproto() {
@@ -440,7 +440,7 @@
}
PROTOBUF_EXPORT ::PROTOBUF_NAMESPACE_ID::internal::SCCInfo<1> scc_info_MethodOptions_google_2fprotobuf_2fdescriptor_2eproto =
- {{ATOMIC_VAR_INIT(::PROTOBUF_NAMESPACE_ID::internal::SCCInfoBase::kUninitialized), 1, InitDefaultsscc_info_MethodOptions_google_2fprotobuf_2fdescriptor_2eproto}, {
+ {{ATOMIC_VAR_INIT(::PROTOBUF_NAMESPACE_ID::internal::SCCInfoBase::kUninitialized), 1, 0, InitDefaultsscc_info_MethodOptions_google_2fprotobuf_2fdescriptor_2eproto}, {
&scc_info_UninterpretedOption_google_2fprotobuf_2fdescriptor_2eproto.base,}};
static void InitDefaultsscc_info_OneofDescriptorProto_google_2fprotobuf_2fdescriptor_2eproto() {
@@ -455,7 +455,7 @@
}
PROTOBUF_EXPORT ::PROTOBUF_NAMESPACE_ID::internal::SCCInfo<1> scc_info_OneofDescriptorProto_google_2fprotobuf_2fdescriptor_2eproto =
- {{ATOMIC_VAR_INIT(::PROTOBUF_NAMESPACE_ID::internal::SCCInfoBase::kUninitialized), 1, InitDefaultsscc_info_OneofDescriptorProto_google_2fprotobuf_2fdescriptor_2eproto}, {
+ {{ATOMIC_VAR_INIT(::PROTOBUF_NAMESPACE_ID::internal::SCCInfoBase::kUninitialized), 1, 0, InitDefaultsscc_info_OneofDescriptorProto_google_2fprotobuf_2fdescriptor_2eproto}, {
&scc_info_OneofOptions_google_2fprotobuf_2fdescriptor_2eproto.base,}};
static void InitDefaultsscc_info_OneofOptions_google_2fprotobuf_2fdescriptor_2eproto() {
@@ -470,7 +470,7 @@
}
PROTOBUF_EXPORT ::PROTOBUF_NAMESPACE_ID::internal::SCCInfo<1> scc_info_OneofOptions_google_2fprotobuf_2fdescriptor_2eproto =
- {{ATOMIC_VAR_INIT(::PROTOBUF_NAMESPACE_ID::internal::SCCInfoBase::kUninitialized), 1, InitDefaultsscc_info_OneofOptions_google_2fprotobuf_2fdescriptor_2eproto}, {
+ {{ATOMIC_VAR_INIT(::PROTOBUF_NAMESPACE_ID::internal::SCCInfoBase::kUninitialized), 1, 0, InitDefaultsscc_info_OneofOptions_google_2fprotobuf_2fdescriptor_2eproto}, {
&scc_info_UninterpretedOption_google_2fprotobuf_2fdescriptor_2eproto.base,}};
static void InitDefaultsscc_info_ServiceDescriptorProto_google_2fprotobuf_2fdescriptor_2eproto() {
@@ -485,7 +485,7 @@
}
PROTOBUF_EXPORT ::PROTOBUF_NAMESPACE_ID::internal::SCCInfo<2> scc_info_ServiceDescriptorProto_google_2fprotobuf_2fdescriptor_2eproto =
- {{ATOMIC_VAR_INIT(::PROTOBUF_NAMESPACE_ID::internal::SCCInfoBase::kUninitialized), 2, InitDefaultsscc_info_ServiceDescriptorProto_google_2fprotobuf_2fdescriptor_2eproto}, {
+ {{ATOMIC_VAR_INIT(::PROTOBUF_NAMESPACE_ID::internal::SCCInfoBase::kUninitialized), 2, 0, InitDefaultsscc_info_ServiceDescriptorProto_google_2fprotobuf_2fdescriptor_2eproto}, {
&scc_info_MethodDescriptorProto_google_2fprotobuf_2fdescriptor_2eproto.base,
&scc_info_ServiceOptions_google_2fprotobuf_2fdescriptor_2eproto.base,}};
@@ -501,7 +501,7 @@
}
PROTOBUF_EXPORT ::PROTOBUF_NAMESPACE_ID::internal::SCCInfo<1> scc_info_ServiceOptions_google_2fprotobuf_2fdescriptor_2eproto =
- {{ATOMIC_VAR_INIT(::PROTOBUF_NAMESPACE_ID::internal::SCCInfoBase::kUninitialized), 1, InitDefaultsscc_info_ServiceOptions_google_2fprotobuf_2fdescriptor_2eproto}, {
+ {{ATOMIC_VAR_INIT(::PROTOBUF_NAMESPACE_ID::internal::SCCInfoBase::kUninitialized), 1, 0, InitDefaultsscc_info_ServiceOptions_google_2fprotobuf_2fdescriptor_2eproto}, {
&scc_info_UninterpretedOption_google_2fprotobuf_2fdescriptor_2eproto.base,}};
static void InitDefaultsscc_info_SourceCodeInfo_google_2fprotobuf_2fdescriptor_2eproto() {
@@ -516,7 +516,7 @@
}
PROTOBUF_EXPORT ::PROTOBUF_NAMESPACE_ID::internal::SCCInfo<1> scc_info_SourceCodeInfo_google_2fprotobuf_2fdescriptor_2eproto =
- {{ATOMIC_VAR_INIT(::PROTOBUF_NAMESPACE_ID::internal::SCCInfoBase::kUninitialized), 1, InitDefaultsscc_info_SourceCodeInfo_google_2fprotobuf_2fdescriptor_2eproto}, {
+ {{ATOMIC_VAR_INIT(::PROTOBUF_NAMESPACE_ID::internal::SCCInfoBase::kUninitialized), 1, 0, InitDefaultsscc_info_SourceCodeInfo_google_2fprotobuf_2fdescriptor_2eproto}, {
&scc_info_SourceCodeInfo_Location_google_2fprotobuf_2fdescriptor_2eproto.base,}};
static void InitDefaultsscc_info_SourceCodeInfo_Location_google_2fprotobuf_2fdescriptor_2eproto() {
@@ -531,7 +531,7 @@
}
PROTOBUF_EXPORT ::PROTOBUF_NAMESPACE_ID::internal::SCCInfo<0> scc_info_SourceCodeInfo_Location_google_2fprotobuf_2fdescriptor_2eproto =
- {{ATOMIC_VAR_INIT(::PROTOBUF_NAMESPACE_ID::internal::SCCInfoBase::kUninitialized), 0, InitDefaultsscc_info_SourceCodeInfo_Location_google_2fprotobuf_2fdescriptor_2eproto}, {}};
+ {{ATOMIC_VAR_INIT(::PROTOBUF_NAMESPACE_ID::internal::SCCInfoBase::kUninitialized), 0, 0, InitDefaultsscc_info_SourceCodeInfo_Location_google_2fprotobuf_2fdescriptor_2eproto}, {}};
static void InitDefaultsscc_info_UninterpretedOption_google_2fprotobuf_2fdescriptor_2eproto() {
GOOGLE_PROTOBUF_VERIFY_VERSION;
@@ -545,7 +545,7 @@
}
PROTOBUF_EXPORT ::PROTOBUF_NAMESPACE_ID::internal::SCCInfo<1> scc_info_UninterpretedOption_google_2fprotobuf_2fdescriptor_2eproto =
- {{ATOMIC_VAR_INIT(::PROTOBUF_NAMESPACE_ID::internal::SCCInfoBase::kUninitialized), 1, InitDefaultsscc_info_UninterpretedOption_google_2fprotobuf_2fdescriptor_2eproto}, {
+ {{ATOMIC_VAR_INIT(::PROTOBUF_NAMESPACE_ID::internal::SCCInfoBase::kUninitialized), 1, 0, InitDefaultsscc_info_UninterpretedOption_google_2fprotobuf_2fdescriptor_2eproto}, {
&scc_info_UninterpretedOption_NamePart_google_2fprotobuf_2fdescriptor_2eproto.base,}};
static void InitDefaultsscc_info_UninterpretedOption_NamePart_google_2fprotobuf_2fdescriptor_2eproto() {
@@ -560,7 +560,7 @@
}
PROTOBUF_EXPORT ::PROTOBUF_NAMESPACE_ID::internal::SCCInfo<0> scc_info_UninterpretedOption_NamePart_google_2fprotobuf_2fdescriptor_2eproto =
- {{ATOMIC_VAR_INIT(::PROTOBUF_NAMESPACE_ID::internal::SCCInfoBase::kUninitialized), 0, InitDefaultsscc_info_UninterpretedOption_NamePart_google_2fprotobuf_2fdescriptor_2eproto}, {}};
+ {{ATOMIC_VAR_INIT(::PROTOBUF_NAMESPACE_ID::internal::SCCInfoBase::kUninitialized), 0, 0, InitDefaultsscc_info_UninterpretedOption_NamePart_google_2fprotobuf_2fdescriptor_2eproto}, {}};
static ::PROTOBUF_NAMESPACE_ID::Metadata file_level_metadata_google_2fprotobuf_2fdescriptor_2eproto[27];
static const ::PROTOBUF_NAMESPACE_ID::EnumDescriptor* file_level_enum_descriptors_google_2fprotobuf_2fdescriptor_2eproto[6];
@@ -1464,7 +1464,7 @@
ptr = ctx->ParseMessage(add_file(), ptr);
CHK_(ptr);
if (!ctx->DataAvailable(ptr)) break;
- } while (::PROTOBUF_NAMESPACE_ID::internal::UnalignedLoad<::PROTOBUF_NAMESPACE_ID::uint8>(ptr) == 10);
+ } while (::PROTOBUF_NAMESPACE_ID::internal::ExpectTag<10>(ptr));
} else goto handle_unusual;
continue;
default: {
@@ -1536,8 +1536,8 @@
(void) cached_has_bits;
// repeated .google.protobuf.FileDescriptorProto file = 1;
- for (auto it = this->file().pointer_begin(),
- end = this->file().pointer_end(); it < end; ++it) {
+ for (auto it = this->file_.pointer_begin(),
+ end = this->file_.pointer_end(); it < end; ++it) {
stream->EnsureSpace(&target);
target = ::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::
InternalWriteMessageToArray(1, **it, target, stream);
@@ -1560,14 +1560,10 @@
(void) cached_has_bits;
// repeated .google.protobuf.FileDescriptorProto file = 1;
- {
- unsigned int count = static_cast<unsigned int>(this->file_size());
- total_size += 1UL * count;
- for (unsigned int i = 0; i < count; i++) {
- total_size +=
- ::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::MessageSize(
- this->file(static_cast<int>(i)));
- }
+ total_size += 1UL * this->file_size();
+ for (const auto& msg : this->file_) {
+ total_size +=
+ ::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::MessageSize(msg);
}
if (PROTOBUF_PREDICT_FALSE(_internal_metadata_.have_unknown_fields())) {
@@ -1627,7 +1623,7 @@
using std::swap;
_internal_metadata_.Swap(&other->_internal_metadata_);
swap(_has_bits_[0], other->_has_bits_[0]);
- CastToBase(&file_)->InternalSwap(CastToBase(&other->file_));
+ file_.InternalSwap(&other->file_);
}
::PROTOBUF_NAMESPACE_ID::Metadata FileDescriptorSet::GetMetadata() const {
@@ -1731,18 +1727,18 @@
weak_dependency_(from.weak_dependency_) {
_internal_metadata_.MergeFrom(from._internal_metadata_);
name_.UnsafeSetDefault(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited());
- if (from.has_name()) {
- name_.Set(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(), from.name(),
+ if (from._internal_has_name()) {
+ name_.Set(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(), from._internal_name(),
GetArenaNoVirtual());
}
package_.UnsafeSetDefault(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited());
- if (from.has_package()) {
- package_.Set(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(), from.package(),
+ if (from._internal_has_package()) {
+ package_.Set(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(), from._internal_package(),
GetArenaNoVirtual());
}
syntax_.UnsafeSetDefault(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited());
- if (from.has_syntax()) {
- syntax_.Set(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(), from.syntax(),
+ if (from._internal_has_syntax()) {
+ syntax_.Set(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(), from._internal_syntax(),
GetArenaNoVirtual());
}
if (from.has_options()) {
@@ -1847,14 +1843,14 @@
// optional string name = 1;
case 1:
if (PROTOBUF_PREDICT_TRUE(static_cast<::PROTOBUF_NAMESPACE_ID::uint8>(tag) == 10)) {
- ptr = ::PROTOBUF_NAMESPACE_ID::internal::InlineGreedyStringParserUTF8Verify(mutable_name(), ptr, ctx, "google.protobuf.FileDescriptorProto.name");
+ ptr = ::PROTOBUF_NAMESPACE_ID::internal::InlineGreedyStringParserUTF8Verify(_internal_mutable_name(), ptr, ctx, "google.protobuf.FileDescriptorProto.name");
CHK_(ptr);
} else goto handle_unusual;
continue;
// optional string package = 2;
case 2:
if (PROTOBUF_PREDICT_TRUE(static_cast<::PROTOBUF_NAMESPACE_ID::uint8>(tag) == 18)) {
- ptr = ::PROTOBUF_NAMESPACE_ID::internal::InlineGreedyStringParserUTF8Verify(mutable_package(), ptr, ctx, "google.protobuf.FileDescriptorProto.package");
+ ptr = ::PROTOBUF_NAMESPACE_ID::internal::InlineGreedyStringParserUTF8Verify(_internal_mutable_package(), ptr, ctx, "google.protobuf.FileDescriptorProto.package");
CHK_(ptr);
} else goto handle_unusual;
continue;
@@ -1864,10 +1860,10 @@
ptr -= 1;
do {
ptr += 1;
- ptr = ::PROTOBUF_NAMESPACE_ID::internal::InlineGreedyStringParserUTF8Verify(add_dependency(), ptr, ctx, "google.protobuf.FileDescriptorProto.dependency");
+ ptr = ::PROTOBUF_NAMESPACE_ID::internal::InlineGreedyStringParserUTF8Verify(_internal_add_dependency(), ptr, ctx, "google.protobuf.FileDescriptorProto.dependency");
CHK_(ptr);
if (!ctx->DataAvailable(ptr)) break;
- } while (::PROTOBUF_NAMESPACE_ID::internal::UnalignedLoad<::PROTOBUF_NAMESPACE_ID::uint8>(ptr) == 26);
+ } while (::PROTOBUF_NAMESPACE_ID::internal::ExpectTag<26>(ptr));
} else goto handle_unusual;
continue;
// repeated .google.protobuf.DescriptorProto message_type = 4;
@@ -1879,7 +1875,7 @@
ptr = ctx->ParseMessage(add_message_type(), ptr);
CHK_(ptr);
if (!ctx->DataAvailable(ptr)) break;
- } while (::PROTOBUF_NAMESPACE_ID::internal::UnalignedLoad<::PROTOBUF_NAMESPACE_ID::uint8>(ptr) == 34);
+ } while (::PROTOBUF_NAMESPACE_ID::internal::ExpectTag<34>(ptr));
} else goto handle_unusual;
continue;
// repeated .google.protobuf.EnumDescriptorProto enum_type = 5;
@@ -1891,7 +1887,7 @@
ptr = ctx->ParseMessage(add_enum_type(), ptr);
CHK_(ptr);
if (!ctx->DataAvailable(ptr)) break;
- } while (::PROTOBUF_NAMESPACE_ID::internal::UnalignedLoad<::PROTOBUF_NAMESPACE_ID::uint8>(ptr) == 42);
+ } while (::PROTOBUF_NAMESPACE_ID::internal::ExpectTag<42>(ptr));
} else goto handle_unusual;
continue;
// repeated .google.protobuf.ServiceDescriptorProto service = 6;
@@ -1903,7 +1899,7 @@
ptr = ctx->ParseMessage(add_service(), ptr);
CHK_(ptr);
if (!ctx->DataAvailable(ptr)) break;
- } while (::PROTOBUF_NAMESPACE_ID::internal::UnalignedLoad<::PROTOBUF_NAMESPACE_ID::uint8>(ptr) == 50);
+ } while (::PROTOBUF_NAMESPACE_ID::internal::ExpectTag<50>(ptr));
} else goto handle_unusual;
continue;
// repeated .google.protobuf.FieldDescriptorProto extension = 7;
@@ -1915,7 +1911,7 @@
ptr = ctx->ParseMessage(add_extension(), ptr);
CHK_(ptr);
if (!ctx->DataAvailable(ptr)) break;
- } while (::PROTOBUF_NAMESPACE_ID::internal::UnalignedLoad<::PROTOBUF_NAMESPACE_ID::uint8>(ptr) == 58);
+ } while (::PROTOBUF_NAMESPACE_ID::internal::ExpectTag<58>(ptr));
} else goto handle_unusual;
continue;
// optional .google.protobuf.FileOptions options = 8;
@@ -1941,7 +1937,7 @@
add_public_dependency(::PROTOBUF_NAMESPACE_ID::internal::ReadVarint(&ptr));
CHK_(ptr);
if (!ctx->DataAvailable(ptr)) break;
- } while (::PROTOBUF_NAMESPACE_ID::internal::UnalignedLoad<::PROTOBUF_NAMESPACE_ID::uint8>(ptr) == 80);
+ } while (::PROTOBUF_NAMESPACE_ID::internal::ExpectTag<80>(ptr));
} else if (static_cast<::PROTOBUF_NAMESPACE_ID::uint8>(tag) == 82) {
ptr = ::PROTOBUF_NAMESPACE_ID::internal::PackedInt32Parser(mutable_public_dependency(), ptr, ctx);
CHK_(ptr);
@@ -1956,7 +1952,7 @@
add_weak_dependency(::PROTOBUF_NAMESPACE_ID::internal::ReadVarint(&ptr));
CHK_(ptr);
if (!ctx->DataAvailable(ptr)) break;
- } while (::PROTOBUF_NAMESPACE_ID::internal::UnalignedLoad<::PROTOBUF_NAMESPACE_ID::uint8>(ptr) == 88);
+ } while (::PROTOBUF_NAMESPACE_ID::internal::ExpectTag<88>(ptr));
} else if (static_cast<::PROTOBUF_NAMESPACE_ID::uint8>(tag) == 90) {
ptr = ::PROTOBUF_NAMESPACE_ID::internal::PackedInt32Parser(mutable_weak_dependency(), ptr, ctx);
CHK_(ptr);
@@ -1965,7 +1961,7 @@
// optional string syntax = 12;
case 12:
if (PROTOBUF_PREDICT_TRUE(static_cast<::PROTOBUF_NAMESPACE_ID::uint8>(tag) == 98)) {
- ptr = ::PROTOBUF_NAMESPACE_ID::internal::InlineGreedyStringParserUTF8Verify(mutable_syntax(), ptr, ctx, "google.protobuf.FileDescriptorProto.syntax");
+ ptr = ::PROTOBUF_NAMESPACE_ID::internal::InlineGreedyStringParserUTF8Verify(_internal_mutable_syntax(), ptr, ctx, "google.protobuf.FileDescriptorProto.syntax");
CHK_(ptr);
} else goto handle_unusual;
continue;
@@ -2004,9 +2000,9 @@
case 1: {
if (static_cast< ::PROTOBUF_NAMESPACE_ID::uint8>(tag) == (10 & 0xFF)) {
DO_(::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::ReadString(
- input, this->mutable_name()));
+ input, this->_internal_mutable_name()));
::PROTOBUF_NAMESPACE_ID::internal::WireFormat::VerifyUTF8StringNamedField(
- this->name().data(), static_cast<int>(this->name().length()),
+ this->_internal_name().data(), static_cast<int>(this->_internal_name().length()),
::PROTOBUF_NAMESPACE_ID::internal::WireFormat::PARSE,
"google.protobuf.FileDescriptorProto.name");
} else {
@@ -2019,9 +2015,9 @@
case 2: {
if (static_cast< ::PROTOBUF_NAMESPACE_ID::uint8>(tag) == (18 & 0xFF)) {
DO_(::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::ReadString(
- input, this->mutable_package()));
+ input, this->_internal_mutable_package()));
::PROTOBUF_NAMESPACE_ID::internal::WireFormat::VerifyUTF8StringNamedField(
- this->package().data(), static_cast<int>(this->package().length()),
+ this->_internal_package().data(), static_cast<int>(this->_internal_package().length()),
::PROTOBUF_NAMESPACE_ID::internal::WireFormat::PARSE,
"google.protobuf.FileDescriptorProto.package");
} else {
@@ -2034,10 +2030,10 @@
case 3: {
if (static_cast< ::PROTOBUF_NAMESPACE_ID::uint8>(tag) == (26 & 0xFF)) {
DO_(::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::ReadString(
- input, this->add_dependency()));
+ input, this->_internal_add_dependency()));
::PROTOBUF_NAMESPACE_ID::internal::WireFormat::VerifyUTF8StringNamedField(
- this->dependency(this->dependency_size() - 1).data(),
- static_cast<int>(this->dependency(this->dependency_size() - 1).length()),
+ dependency_.Get(dependency_.size() - 1).data(),
+ static_cast<int>(dependency_.Get(dependency_.size() - 1).length()),
::PROTOBUF_NAMESPACE_ID::internal::WireFormat::PARSE,
"google.protobuf.FileDescriptorProto.dependency");
} else {
@@ -2148,9 +2144,9 @@
case 12: {
if (static_cast< ::PROTOBUF_NAMESPACE_ID::uint8>(tag) == (98 & 0xFF)) {
DO_(::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::ReadString(
- input, this->mutable_syntax()));
+ input, this->_internal_mutable_syntax()));
::PROTOBUF_NAMESPACE_ID::internal::WireFormat::VerifyUTF8StringNamedField(
- this->syntax().data(), static_cast<int>(this->syntax().length()),
+ this->_internal_syntax().data(), static_cast<int>(this->_internal_syntax().length()),
::PROTOBUF_NAMESPACE_ID::internal::WireFormat::PARSE,
"google.protobuf.FileDescriptorProto.syntax");
} else {
@@ -2190,26 +2186,26 @@
// optional string name = 1;
if (cached_has_bits & 0x00000001u) {
::PROTOBUF_NAMESPACE_ID::internal::WireFormat::VerifyUTF8StringNamedField(
- this->name().data(), static_cast<int>(this->name().length()),
+ this->_internal_name().data(), static_cast<int>(this->_internal_name().length()),
::PROTOBUF_NAMESPACE_ID::internal::WireFormat::SERIALIZE,
"google.protobuf.FileDescriptorProto.name");
target = stream->WriteStringMaybeAliased(
- 1, this->name(), target);
+ 1, this->_internal_name(), target);
}
// optional string package = 2;
if (cached_has_bits & 0x00000002u) {
::PROTOBUF_NAMESPACE_ID::internal::WireFormat::VerifyUTF8StringNamedField(
- this->package().data(), static_cast<int>(this->package().length()),
+ this->_internal_package().data(), static_cast<int>(this->_internal_package().length()),
::PROTOBUF_NAMESPACE_ID::internal::WireFormat::SERIALIZE,
"google.protobuf.FileDescriptorProto.package");
target = stream->WriteStringMaybeAliased(
- 2, this->package(), target);
+ 2, this->_internal_package(), target);
}
// repeated string dependency = 3;
- for (auto it = this->dependency().pointer_begin(),
- end = this->dependency().pointer_end(); it < end; ++it) {
+ for (auto it = dependency_.pointer_begin(),
+ end = dependency_.pointer_end(); it < end; ++it) {
const auto& s = **it;
::PROTOBUF_NAMESPACE_ID::internal::WireFormat::VerifyUTF8StringNamedField(
s.data(), static_cast<int>(s.length()),
@@ -2219,32 +2215,32 @@
}
// repeated .google.protobuf.DescriptorProto message_type = 4;
- for (auto it = this->message_type().pointer_begin(),
- end = this->message_type().pointer_end(); it < end; ++it) {
+ for (auto it = this->message_type_.pointer_begin(),
+ end = this->message_type_.pointer_end(); it < end; ++it) {
stream->EnsureSpace(&target);
target = ::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::
InternalWriteMessageToArray(4, **it, target, stream);
}
// repeated .google.protobuf.EnumDescriptorProto enum_type = 5;
- for (auto it = this->enum_type().pointer_begin(),
- end = this->enum_type().pointer_end(); it < end; ++it) {
+ for (auto it = this->enum_type_.pointer_begin(),
+ end = this->enum_type_.pointer_end(); it < end; ++it) {
stream->EnsureSpace(&target);
target = ::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::
InternalWriteMessageToArray(5, **it, target, stream);
}
// repeated .google.protobuf.ServiceDescriptorProto service = 6;
- for (auto it = this->service().pointer_begin(),
- end = this->service().pointer_end(); it < end; ++it) {
+ for (auto it = this->service_.pointer_begin(),
+ end = this->service_.pointer_end(); it < end; ++it) {
stream->EnsureSpace(&target);
target = ::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::
InternalWriteMessageToArray(6, **it, target, stream);
}
// repeated .google.protobuf.FieldDescriptorProto extension = 7;
- for (auto it = this->extension().pointer_begin(),
- end = this->extension().pointer_end(); it < end; ++it) {
+ for (auto it = this->extension_.pointer_begin(),
+ end = this->extension_.pointer_end(); it < end; ++it) {
stream->EnsureSpace(&target);
target = ::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::
InternalWriteMessageToArray(7, **it, target, stream);
@@ -2281,11 +2277,11 @@
// optional string syntax = 12;
if (cached_has_bits & 0x00000004u) {
::PROTOBUF_NAMESPACE_ID::internal::WireFormat::VerifyUTF8StringNamedField(
- this->syntax().data(), static_cast<int>(this->syntax().length()),
+ this->_internal_syntax().data(), static_cast<int>(this->_internal_syntax().length()),
::PROTOBUF_NAMESPACE_ID::internal::WireFormat::SERIALIZE,
"google.protobuf.FileDescriptorProto.syntax");
target = stream->WriteStringMaybeAliased(
- 12, this->syntax(), target);
+ 12, this->_internal_syntax(), target);
}
if (PROTOBUF_PREDICT_FALSE(_internal_metadata_.have_unknown_fields())) {
@@ -2306,54 +2302,38 @@
// repeated string dependency = 3;
total_size += 1 *
- ::PROTOBUF_NAMESPACE_ID::internal::FromIntSize(this->dependency_size());
- for (int i = 0, n = this->dependency_size(); i < n; i++) {
+ ::PROTOBUF_NAMESPACE_ID::internal::FromIntSize(dependency_.size());
+ for (int i = 0, n = dependency_.size(); i < n; i++) {
total_size += ::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::StringSize(
- this->dependency(i));
+ dependency_.Get(i));
}
// repeated .google.protobuf.DescriptorProto message_type = 4;
- {
- unsigned int count = static_cast<unsigned int>(this->message_type_size());
- total_size += 1UL * count;
- for (unsigned int i = 0; i < count; i++) {
- total_size +=
- ::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::MessageSize(
- this->message_type(static_cast<int>(i)));
- }
+ total_size += 1UL * this->message_type_size();
+ for (const auto& msg : this->message_type_) {
+ total_size +=
+ ::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::MessageSize(msg);
}
// repeated .google.protobuf.EnumDescriptorProto enum_type = 5;
- {
- unsigned int count = static_cast<unsigned int>(this->enum_type_size());
- total_size += 1UL * count;
- for (unsigned int i = 0; i < count; i++) {
- total_size +=
- ::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::MessageSize(
- this->enum_type(static_cast<int>(i)));
- }
+ total_size += 1UL * this->enum_type_size();
+ for (const auto& msg : this->enum_type_) {
+ total_size +=
+ ::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::MessageSize(msg);
}
// repeated .google.protobuf.ServiceDescriptorProto service = 6;
- {
- unsigned int count = static_cast<unsigned int>(this->service_size());
- total_size += 1UL * count;
- for (unsigned int i = 0; i < count; i++) {
- total_size +=
- ::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::MessageSize(
- this->service(static_cast<int>(i)));
- }
+ total_size += 1UL * this->service_size();
+ for (const auto& msg : this->service_) {
+ total_size +=
+ ::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::MessageSize(msg);
}
// repeated .google.protobuf.FieldDescriptorProto extension = 7;
- {
- unsigned int count = static_cast<unsigned int>(this->extension_size());
- total_size += 1UL * count;
- for (unsigned int i = 0; i < count; i++) {
- total_size +=
- ::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::MessageSize(
- this->extension(static_cast<int>(i)));
- }
+ total_size += 1UL * this->extension_size();
+ for (const auto& msg : this->extension_) {
+ total_size +=
+ ::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::MessageSize(msg);
}
// repeated int32 public_dependency = 10;
@@ -2380,21 +2360,21 @@
if (cached_has_bits & 0x00000001u) {
total_size += 1 +
::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::StringSize(
- this->name());
+ this->_internal_name());
}
// optional string package = 2;
if (cached_has_bits & 0x00000002u) {
total_size += 1 +
::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::StringSize(
- this->package());
+ this->_internal_package());
}
// optional string syntax = 12;
if (cached_has_bits & 0x00000004u) {
total_size += 1 +
::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::StringSize(
- this->syntax());
+ this->_internal_syntax());
}
// optional .google.protobuf.FileOptions options = 8;
@@ -2453,13 +2433,13 @@
cached_has_bits = from._has_bits_[0];
if (cached_has_bits & 0x0000001fu) {
if (cached_has_bits & 0x00000001u) {
- set_name(from.name());
+ _internal_set_name(from._internal_name());
}
if (cached_has_bits & 0x00000002u) {
- set_package(from.package());
+ _internal_set_package(from._internal_package());
}
if (cached_has_bits & 0x00000004u) {
- set_syntax(from.syntax());
+ _internal_set_syntax(from._internal_syntax());
}
if (cached_has_bits & 0x00000008u) {
mutable_options()->PROTOBUF_NAMESPACE_ID::FileOptions::MergeFrom(from.options());
@@ -2499,11 +2479,11 @@
using std::swap;
_internal_metadata_.Swap(&other->_internal_metadata_);
swap(_has_bits_[0], other->_has_bits_[0]);
- dependency_.InternalSwap(CastToBase(&other->dependency_));
- CastToBase(&message_type_)->InternalSwap(CastToBase(&other->message_type_));
- CastToBase(&enum_type_)->InternalSwap(CastToBase(&other->enum_type_));
- CastToBase(&service_)->InternalSwap(CastToBase(&other->service_));
- CastToBase(&extension_)->InternalSwap(CastToBase(&other->extension_));
+ dependency_.InternalSwap(&other->dependency_);
+ message_type_.InternalSwap(&other->message_type_);
+ enum_type_.InternalSwap(&other->enum_type_);
+ service_.InternalSwap(&other->service_);
+ extension_.InternalSwap(&other->extension_);
public_dependency_.InternalSwap(&other->public_dependency_);
weak_dependency_.InternalSwap(&other->weak_dependency_);
name_.Swap(&other->name_, &::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(),
@@ -3292,8 +3272,8 @@
reserved_name_(from.reserved_name_) {
_internal_metadata_.MergeFrom(from._internal_metadata_);
name_.UnsafeSetDefault(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited());
- if (from.has_name()) {
- name_.Set(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(), from.name(),
+ if (from._internal_has_name()) {
+ name_.Set(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(), from._internal_name(),
GetArenaNoVirtual());
}
if (from.has_options()) {
@@ -3377,7 +3357,7 @@
// optional string name = 1;
case 1:
if (PROTOBUF_PREDICT_TRUE(static_cast<::PROTOBUF_NAMESPACE_ID::uint8>(tag) == 10)) {
- ptr = ::PROTOBUF_NAMESPACE_ID::internal::InlineGreedyStringParserUTF8Verify(mutable_name(), ptr, ctx, "google.protobuf.DescriptorProto.name");
+ ptr = ::PROTOBUF_NAMESPACE_ID::internal::InlineGreedyStringParserUTF8Verify(_internal_mutable_name(), ptr, ctx, "google.protobuf.DescriptorProto.name");
CHK_(ptr);
} else goto handle_unusual;
continue;
@@ -3390,7 +3370,7 @@
ptr = ctx->ParseMessage(add_field(), ptr);
CHK_(ptr);
if (!ctx->DataAvailable(ptr)) break;
- } while (::PROTOBUF_NAMESPACE_ID::internal::UnalignedLoad<::PROTOBUF_NAMESPACE_ID::uint8>(ptr) == 18);
+ } while (::PROTOBUF_NAMESPACE_ID::internal::ExpectTag<18>(ptr));
} else goto handle_unusual;
continue;
// repeated .google.protobuf.DescriptorProto nested_type = 3;
@@ -3402,7 +3382,7 @@
ptr = ctx->ParseMessage(add_nested_type(), ptr);
CHK_(ptr);
if (!ctx->DataAvailable(ptr)) break;
- } while (::PROTOBUF_NAMESPACE_ID::internal::UnalignedLoad<::PROTOBUF_NAMESPACE_ID::uint8>(ptr) == 26);
+ } while (::PROTOBUF_NAMESPACE_ID::internal::ExpectTag<26>(ptr));
} else goto handle_unusual;
continue;
// repeated .google.protobuf.EnumDescriptorProto enum_type = 4;
@@ -3414,7 +3394,7 @@
ptr = ctx->ParseMessage(add_enum_type(), ptr);
CHK_(ptr);
if (!ctx->DataAvailable(ptr)) break;
- } while (::PROTOBUF_NAMESPACE_ID::internal::UnalignedLoad<::PROTOBUF_NAMESPACE_ID::uint8>(ptr) == 34);
+ } while (::PROTOBUF_NAMESPACE_ID::internal::ExpectTag<34>(ptr));
} else goto handle_unusual;
continue;
// repeated .google.protobuf.DescriptorProto.ExtensionRange extension_range = 5;
@@ -3426,7 +3406,7 @@
ptr = ctx->ParseMessage(add_extension_range(), ptr);
CHK_(ptr);
if (!ctx->DataAvailable(ptr)) break;
- } while (::PROTOBUF_NAMESPACE_ID::internal::UnalignedLoad<::PROTOBUF_NAMESPACE_ID::uint8>(ptr) == 42);
+ } while (::PROTOBUF_NAMESPACE_ID::internal::ExpectTag<42>(ptr));
} else goto handle_unusual;
continue;
// repeated .google.protobuf.FieldDescriptorProto extension = 6;
@@ -3438,7 +3418,7 @@
ptr = ctx->ParseMessage(add_extension(), ptr);
CHK_(ptr);
if (!ctx->DataAvailable(ptr)) break;
- } while (::PROTOBUF_NAMESPACE_ID::internal::UnalignedLoad<::PROTOBUF_NAMESPACE_ID::uint8>(ptr) == 50);
+ } while (::PROTOBUF_NAMESPACE_ID::internal::ExpectTag<50>(ptr));
} else goto handle_unusual;
continue;
// optional .google.protobuf.MessageOptions options = 7;
@@ -3457,7 +3437,7 @@
ptr = ctx->ParseMessage(add_oneof_decl(), ptr);
CHK_(ptr);
if (!ctx->DataAvailable(ptr)) break;
- } while (::PROTOBUF_NAMESPACE_ID::internal::UnalignedLoad<::PROTOBUF_NAMESPACE_ID::uint8>(ptr) == 66);
+ } while (::PROTOBUF_NAMESPACE_ID::internal::ExpectTag<66>(ptr));
} else goto handle_unusual;
continue;
// repeated .google.protobuf.DescriptorProto.ReservedRange reserved_range = 9;
@@ -3469,7 +3449,7 @@
ptr = ctx->ParseMessage(add_reserved_range(), ptr);
CHK_(ptr);
if (!ctx->DataAvailable(ptr)) break;
- } while (::PROTOBUF_NAMESPACE_ID::internal::UnalignedLoad<::PROTOBUF_NAMESPACE_ID::uint8>(ptr) == 74);
+ } while (::PROTOBUF_NAMESPACE_ID::internal::ExpectTag<74>(ptr));
} else goto handle_unusual;
continue;
// repeated string reserved_name = 10;
@@ -3478,10 +3458,10 @@
ptr -= 1;
do {
ptr += 1;
- ptr = ::PROTOBUF_NAMESPACE_ID::internal::InlineGreedyStringParserUTF8Verify(add_reserved_name(), ptr, ctx, "google.protobuf.DescriptorProto.reserved_name");
+ ptr = ::PROTOBUF_NAMESPACE_ID::internal::InlineGreedyStringParserUTF8Verify(_internal_add_reserved_name(), ptr, ctx, "google.protobuf.DescriptorProto.reserved_name");
CHK_(ptr);
if (!ctx->DataAvailable(ptr)) break;
- } while (::PROTOBUF_NAMESPACE_ID::internal::UnalignedLoad<::PROTOBUF_NAMESPACE_ID::uint8>(ptr) == 82);
+ } while (::PROTOBUF_NAMESPACE_ID::internal::ExpectTag<82>(ptr));
} else goto handle_unusual;
continue;
default: {
@@ -3519,9 +3499,9 @@
case 1: {
if (static_cast< ::PROTOBUF_NAMESPACE_ID::uint8>(tag) == (10 & 0xFF)) {
DO_(::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::ReadString(
- input, this->mutable_name()));
+ input, this->_internal_mutable_name()));
::PROTOBUF_NAMESPACE_ID::internal::WireFormat::VerifyUTF8StringNamedField(
- this->name().data(), static_cast<int>(this->name().length()),
+ this->_internal_name().data(), static_cast<int>(this->_internal_name().length()),
::PROTOBUF_NAMESPACE_ID::internal::WireFormat::PARSE,
"google.protobuf.DescriptorProto.name");
} else {
@@ -3622,10 +3602,10 @@
case 10: {
if (static_cast< ::PROTOBUF_NAMESPACE_ID::uint8>(tag) == (82 & 0xFF)) {
DO_(::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::ReadString(
- input, this->add_reserved_name()));
+ input, this->_internal_add_reserved_name()));
::PROTOBUF_NAMESPACE_ID::internal::WireFormat::VerifyUTF8StringNamedField(
- this->reserved_name(this->reserved_name_size() - 1).data(),
- static_cast<int>(this->reserved_name(this->reserved_name_size() - 1).length()),
+ reserved_name_.Get(reserved_name_.size() - 1).data(),
+ static_cast<int>(reserved_name_.Get(reserved_name_.size() - 1).length()),
::PROTOBUF_NAMESPACE_ID::internal::WireFormat::PARSE,
"google.protobuf.DescriptorProto.reserved_name");
} else {
@@ -3665,48 +3645,48 @@
// optional string name = 1;
if (cached_has_bits & 0x00000001u) {
::PROTOBUF_NAMESPACE_ID::internal::WireFormat::VerifyUTF8StringNamedField(
- this->name().data(), static_cast<int>(this->name().length()),
+ this->_internal_name().data(), static_cast<int>(this->_internal_name().length()),
::PROTOBUF_NAMESPACE_ID::internal::WireFormat::SERIALIZE,
"google.protobuf.DescriptorProto.name");
target = stream->WriteStringMaybeAliased(
- 1, this->name(), target);
+ 1, this->_internal_name(), target);
}
// repeated .google.protobuf.FieldDescriptorProto field = 2;
- for (auto it = this->field().pointer_begin(),
- end = this->field().pointer_end(); it < end; ++it) {
+ for (auto it = this->field_.pointer_begin(),
+ end = this->field_.pointer_end(); it < end; ++it) {
stream->EnsureSpace(&target);
target = ::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::
InternalWriteMessageToArray(2, **it, target, stream);
}
// repeated .google.protobuf.DescriptorProto nested_type = 3;
- for (auto it = this->nested_type().pointer_begin(),
- end = this->nested_type().pointer_end(); it < end; ++it) {
+ for (auto it = this->nested_type_.pointer_begin(),
+ end = this->nested_type_.pointer_end(); it < end; ++it) {
stream->EnsureSpace(&target);
target = ::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::
InternalWriteMessageToArray(3, **it, target, stream);
}
// repeated .google.protobuf.EnumDescriptorProto enum_type = 4;
- for (auto it = this->enum_type().pointer_begin(),
- end = this->enum_type().pointer_end(); it < end; ++it) {
+ for (auto it = this->enum_type_.pointer_begin(),
+ end = this->enum_type_.pointer_end(); it < end; ++it) {
stream->EnsureSpace(&target);
target = ::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::
InternalWriteMessageToArray(4, **it, target, stream);
}
// repeated .google.protobuf.DescriptorProto.ExtensionRange extension_range = 5;
- for (auto it = this->extension_range().pointer_begin(),
- end = this->extension_range().pointer_end(); it < end; ++it) {
+ for (auto it = this->extension_range_.pointer_begin(),
+ end = this->extension_range_.pointer_end(); it < end; ++it) {
stream->EnsureSpace(&target);
target = ::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::
InternalWriteMessageToArray(5, **it, target, stream);
}
// repeated .google.protobuf.FieldDescriptorProto extension = 6;
- for (auto it = this->extension().pointer_begin(),
- end = this->extension().pointer_end(); it < end; ++it) {
+ for (auto it = this->extension_.pointer_begin(),
+ end = this->extension_.pointer_end(); it < end; ++it) {
stream->EnsureSpace(&target);
target = ::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::
InternalWriteMessageToArray(6, **it, target, stream);
@@ -3721,24 +3701,24 @@
}
// repeated .google.protobuf.OneofDescriptorProto oneof_decl = 8;
- for (auto it = this->oneof_decl().pointer_begin(),
- end = this->oneof_decl().pointer_end(); it < end; ++it) {
+ for (auto it = this->oneof_decl_.pointer_begin(),
+ end = this->oneof_decl_.pointer_end(); it < end; ++it) {
stream->EnsureSpace(&target);
target = ::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::
InternalWriteMessageToArray(8, **it, target, stream);
}
// repeated .google.protobuf.DescriptorProto.ReservedRange reserved_range = 9;
- for (auto it = this->reserved_range().pointer_begin(),
- end = this->reserved_range().pointer_end(); it < end; ++it) {
+ for (auto it = this->reserved_range_.pointer_begin(),
+ end = this->reserved_range_.pointer_end(); it < end; ++it) {
stream->EnsureSpace(&target);
target = ::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::
InternalWriteMessageToArray(9, **it, target, stream);
}
// repeated string reserved_name = 10;
- for (auto it = this->reserved_name().pointer_begin(),
- end = this->reserved_name().pointer_end(); it < end; ++it) {
+ for (auto it = reserved_name_.pointer_begin(),
+ end = reserved_name_.pointer_end(); it < end; ++it) {
const auto& s = **it;
::PROTOBUF_NAMESPACE_ID::internal::WireFormat::VerifyUTF8StringNamedField(
s.data(), static_cast<int>(s.length()),
@@ -3764,88 +3744,60 @@
(void) cached_has_bits;
// repeated .google.protobuf.FieldDescriptorProto field = 2;
- {
- unsigned int count = static_cast<unsigned int>(this->field_size());
- total_size += 1UL * count;
- for (unsigned int i = 0; i < count; i++) {
- total_size +=
- ::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::MessageSize(
- this->field(static_cast<int>(i)));
- }
+ total_size += 1UL * this->field_size();
+ for (const auto& msg : this->field_) {
+ total_size +=
+ ::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::MessageSize(msg);
}
// repeated .google.protobuf.DescriptorProto nested_type = 3;
- {
- unsigned int count = static_cast<unsigned int>(this->nested_type_size());
- total_size += 1UL * count;
- for (unsigned int i = 0; i < count; i++) {
- total_size +=
- ::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::MessageSize(
- this->nested_type(static_cast<int>(i)));
- }
+ total_size += 1UL * this->nested_type_size();
+ for (const auto& msg : this->nested_type_) {
+ total_size +=
+ ::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::MessageSize(msg);
}
// repeated .google.protobuf.EnumDescriptorProto enum_type = 4;
- {
- unsigned int count = static_cast<unsigned int>(this->enum_type_size());
- total_size += 1UL * count;
- for (unsigned int i = 0; i < count; i++) {
- total_size +=
- ::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::MessageSize(
- this->enum_type(static_cast<int>(i)));
- }
+ total_size += 1UL * this->enum_type_size();
+ for (const auto& msg : this->enum_type_) {
+ total_size +=
+ ::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::MessageSize(msg);
}
// repeated .google.protobuf.DescriptorProto.ExtensionRange extension_range = 5;
- {
- unsigned int count = static_cast<unsigned int>(this->extension_range_size());
- total_size += 1UL * count;
- for (unsigned int i = 0; i < count; i++) {
- total_size +=
- ::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::MessageSize(
- this->extension_range(static_cast<int>(i)));
- }
+ total_size += 1UL * this->extension_range_size();
+ for (const auto& msg : this->extension_range_) {
+ total_size +=
+ ::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::MessageSize(msg);
}
// repeated .google.protobuf.FieldDescriptorProto extension = 6;
- {
- unsigned int count = static_cast<unsigned int>(this->extension_size());
- total_size += 1UL * count;
- for (unsigned int i = 0; i < count; i++) {
- total_size +=
- ::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::MessageSize(
- this->extension(static_cast<int>(i)));
- }
+ total_size += 1UL * this->extension_size();
+ for (const auto& msg : this->extension_) {
+ total_size +=
+ ::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::MessageSize(msg);
}
// repeated .google.protobuf.OneofDescriptorProto oneof_decl = 8;
- {
- unsigned int count = static_cast<unsigned int>(this->oneof_decl_size());
- total_size += 1UL * count;
- for (unsigned int i = 0; i < count; i++) {
- total_size +=
- ::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::MessageSize(
- this->oneof_decl(static_cast<int>(i)));
- }
+ total_size += 1UL * this->oneof_decl_size();
+ for (const auto& msg : this->oneof_decl_) {
+ total_size +=
+ ::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::MessageSize(msg);
}
// repeated .google.protobuf.DescriptorProto.ReservedRange reserved_range = 9;
- {
- unsigned int count = static_cast<unsigned int>(this->reserved_range_size());
- total_size += 1UL * count;
- for (unsigned int i = 0; i < count; i++) {
- total_size +=
- ::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::MessageSize(
- this->reserved_range(static_cast<int>(i)));
- }
+ total_size += 1UL * this->reserved_range_size();
+ for (const auto& msg : this->reserved_range_) {
+ total_size +=
+ ::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::MessageSize(msg);
}
// repeated string reserved_name = 10;
total_size += 1 *
- ::PROTOBUF_NAMESPACE_ID::internal::FromIntSize(this->reserved_name_size());
- for (int i = 0, n = this->reserved_name_size(); i < n; i++) {
+ ::PROTOBUF_NAMESPACE_ID::internal::FromIntSize(reserved_name_.size());
+ for (int i = 0, n = reserved_name_.size(); i < n; i++) {
total_size += ::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::StringSize(
- this->reserved_name(i));
+ reserved_name_.Get(i));
}
cached_has_bits = _has_bits_[0];
@@ -3854,7 +3806,7 @@
if (cached_has_bits & 0x00000001u) {
total_size += 1 +
::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::StringSize(
- this->name());
+ this->_internal_name());
}
// optional .google.protobuf.MessageOptions options = 7;
@@ -3907,7 +3859,7 @@
cached_has_bits = from._has_bits_[0];
if (cached_has_bits & 0x00000003u) {
if (cached_has_bits & 0x00000001u) {
- set_name(from.name());
+ _internal_set_name(from._internal_name());
}
if (cached_has_bits & 0x00000002u) {
mutable_options()->PROTOBUF_NAMESPACE_ID::MessageOptions::MergeFrom(from.options());
@@ -3946,14 +3898,14 @@
using std::swap;
_internal_metadata_.Swap(&other->_internal_metadata_);
swap(_has_bits_[0], other->_has_bits_[0]);
- CastToBase(&field_)->InternalSwap(CastToBase(&other->field_));
- CastToBase(&nested_type_)->InternalSwap(CastToBase(&other->nested_type_));
- CastToBase(&enum_type_)->InternalSwap(CastToBase(&other->enum_type_));
- CastToBase(&extension_range_)->InternalSwap(CastToBase(&other->extension_range_));
- CastToBase(&extension_)->InternalSwap(CastToBase(&other->extension_));
- CastToBase(&oneof_decl_)->InternalSwap(CastToBase(&other->oneof_decl_));
- CastToBase(&reserved_range_)->InternalSwap(CastToBase(&other->reserved_range_));
- reserved_name_.InternalSwap(CastToBase(&other->reserved_name_));
+ field_.InternalSwap(&other->field_);
+ nested_type_.InternalSwap(&other->nested_type_);
+ enum_type_.InternalSwap(&other->enum_type_);
+ extension_range_.InternalSwap(&other->extension_range_);
+ extension_.InternalSwap(&other->extension_);
+ oneof_decl_.InternalSwap(&other->oneof_decl_);
+ reserved_range_.InternalSwap(&other->reserved_range_);
+ reserved_name_.InternalSwap(&other->reserved_name_);
name_.Swap(&other->name_, &::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(),
GetArenaNoVirtual());
swap(options_, other->options_);
@@ -4055,7 +4007,7 @@
ptr = ctx->ParseMessage(add_uninterpreted_option(), ptr);
CHK_(ptr);
if (!ctx->DataAvailable(ptr)) break;
- } while (::PROTOBUF_NAMESPACE_ID::internal::UnalignedLoad<::PROTOBUF_NAMESPACE_ID::uint16>(ptr) == 16058);
+ } while (::PROTOBUF_NAMESPACE_ID::internal::ExpectTag<7994>(ptr));
} else goto handle_unusual;
continue;
default: {
@@ -4139,8 +4091,8 @@
(void) cached_has_bits;
// repeated .google.protobuf.UninterpretedOption uninterpreted_option = 999;
- for (auto it = this->uninterpreted_option().pointer_begin(),
- end = this->uninterpreted_option().pointer_end(); it < end; ++it) {
+ for (auto it = this->uninterpreted_option_.pointer_begin(),
+ end = this->uninterpreted_option_.pointer_end(); it < end; ++it) {
stream->EnsureSpace(&target);
target = ::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::
InternalWriteMessageToArray(999, **it, target, stream);
@@ -4169,14 +4121,10 @@
(void) cached_has_bits;
// repeated .google.protobuf.UninterpretedOption uninterpreted_option = 999;
- {
- unsigned int count = static_cast<unsigned int>(this->uninterpreted_option_size());
- total_size += 2UL * count;
- for (unsigned int i = 0; i < count; i++) {
- total_size +=
- ::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::MessageSize(
- this->uninterpreted_option(static_cast<int>(i)));
- }
+ total_size += 2UL * this->uninterpreted_option_size();
+ for (const auto& msg : this->uninterpreted_option_) {
+ total_size +=
+ ::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::MessageSize(msg);
}
if (PROTOBUF_PREDICT_FALSE(_internal_metadata_.have_unknown_fields())) {
@@ -4242,7 +4190,7 @@
_extensions_.Swap(&other->_extensions_);
_internal_metadata_.Swap(&other->_internal_metadata_);
swap(_has_bits_[0], other->_has_bits_[0]);
- CastToBase(&uninterpreted_option_)->InternalSwap(CastToBase(&other->uninterpreted_option_));
+ uninterpreted_option_.InternalSwap(&other->uninterpreted_option_);
}
::PROTOBUF_NAMESPACE_ID::Metadata ExtensionRangeOptions::GetMetadata() const {
@@ -4327,28 +4275,28 @@
_has_bits_(from._has_bits_) {
_internal_metadata_.MergeFrom(from._internal_metadata_);
name_.UnsafeSetDefault(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited());
- if (from.has_name()) {
- name_.Set(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(), from.name(),
+ if (from._internal_has_name()) {
+ name_.Set(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(), from._internal_name(),
GetArenaNoVirtual());
}
extendee_.UnsafeSetDefault(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited());
- if (from.has_extendee()) {
- extendee_.Set(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(), from.extendee(),
+ if (from._internal_has_extendee()) {
+ extendee_.Set(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(), from._internal_extendee(),
GetArenaNoVirtual());
}
type_name_.UnsafeSetDefault(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited());
- if (from.has_type_name()) {
- type_name_.Set(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(), from.type_name(),
+ if (from._internal_has_type_name()) {
+ type_name_.Set(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(), from._internal_type_name(),
GetArenaNoVirtual());
}
default_value_.UnsafeSetDefault(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited());
- if (from.has_default_value()) {
- default_value_.Set(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(), from.default_value(),
+ if (from._internal_has_default_value()) {
+ default_value_.Set(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(), from._internal_default_value(),
GetArenaNoVirtual());
}
json_name_.UnsafeSetDefault(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited());
- if (from.has_json_name()) {
- json_name_.Set(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(), from.json_name(),
+ if (from._internal_has_json_name()) {
+ json_name_.Set(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(), from._internal_json_name(),
GetArenaNoVirtual());
}
if (from.has_options()) {
@@ -4460,14 +4408,14 @@
// optional string name = 1;
case 1:
if (PROTOBUF_PREDICT_TRUE(static_cast<::PROTOBUF_NAMESPACE_ID::uint8>(tag) == 10)) {
- ptr = ::PROTOBUF_NAMESPACE_ID::internal::InlineGreedyStringParserUTF8Verify(mutable_name(), ptr, ctx, "google.protobuf.FieldDescriptorProto.name");
+ ptr = ::PROTOBUF_NAMESPACE_ID::internal::InlineGreedyStringParserUTF8Verify(_internal_mutable_name(), ptr, ctx, "google.protobuf.FieldDescriptorProto.name");
CHK_(ptr);
} else goto handle_unusual;
continue;
// optional string extendee = 2;
case 2:
if (PROTOBUF_PREDICT_TRUE(static_cast<::PROTOBUF_NAMESPACE_ID::uint8>(tag) == 18)) {
- ptr = ::PROTOBUF_NAMESPACE_ID::internal::InlineGreedyStringParserUTF8Verify(mutable_extendee(), ptr, ctx, "google.protobuf.FieldDescriptorProto.extendee");
+ ptr = ::PROTOBUF_NAMESPACE_ID::internal::InlineGreedyStringParserUTF8Verify(_internal_mutable_extendee(), ptr, ctx, "google.protobuf.FieldDescriptorProto.extendee");
CHK_(ptr);
} else goto handle_unusual;
continue;
@@ -4506,14 +4454,14 @@
// optional string type_name = 6;
case 6:
if (PROTOBUF_PREDICT_TRUE(static_cast<::PROTOBUF_NAMESPACE_ID::uint8>(tag) == 50)) {
- ptr = ::PROTOBUF_NAMESPACE_ID::internal::InlineGreedyStringParserUTF8Verify(mutable_type_name(), ptr, ctx, "google.protobuf.FieldDescriptorProto.type_name");
+ ptr = ::PROTOBUF_NAMESPACE_ID::internal::InlineGreedyStringParserUTF8Verify(_internal_mutable_type_name(), ptr, ctx, "google.protobuf.FieldDescriptorProto.type_name");
CHK_(ptr);
} else goto handle_unusual;
continue;
// optional string default_value = 7;
case 7:
if (PROTOBUF_PREDICT_TRUE(static_cast<::PROTOBUF_NAMESPACE_ID::uint8>(tag) == 58)) {
- ptr = ::PROTOBUF_NAMESPACE_ID::internal::InlineGreedyStringParserUTF8Verify(mutable_default_value(), ptr, ctx, "google.protobuf.FieldDescriptorProto.default_value");
+ ptr = ::PROTOBUF_NAMESPACE_ID::internal::InlineGreedyStringParserUTF8Verify(_internal_mutable_default_value(), ptr, ctx, "google.protobuf.FieldDescriptorProto.default_value");
CHK_(ptr);
} else goto handle_unusual;
continue;
@@ -4535,7 +4483,7 @@
// optional string json_name = 10;
case 10:
if (PROTOBUF_PREDICT_TRUE(static_cast<::PROTOBUF_NAMESPACE_ID::uint8>(tag) == 82)) {
- ptr = ::PROTOBUF_NAMESPACE_ID::internal::InlineGreedyStringParserUTF8Verify(mutable_json_name(), ptr, ctx, "google.protobuf.FieldDescriptorProto.json_name");
+ ptr = ::PROTOBUF_NAMESPACE_ID::internal::InlineGreedyStringParserUTF8Verify(_internal_mutable_json_name(), ptr, ctx, "google.protobuf.FieldDescriptorProto.json_name");
CHK_(ptr);
} else goto handle_unusual;
continue;
@@ -4574,9 +4522,9 @@
case 1: {
if (static_cast< ::PROTOBUF_NAMESPACE_ID::uint8>(tag) == (10 & 0xFF)) {
DO_(::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::ReadString(
- input, this->mutable_name()));
+ input, this->_internal_mutable_name()));
::PROTOBUF_NAMESPACE_ID::internal::WireFormat::VerifyUTF8StringNamedField(
- this->name().data(), static_cast<int>(this->name().length()),
+ this->_internal_name().data(), static_cast<int>(this->_internal_name().length()),
::PROTOBUF_NAMESPACE_ID::internal::WireFormat::PARSE,
"google.protobuf.FieldDescriptorProto.name");
} else {
@@ -4589,9 +4537,9 @@
case 2: {
if (static_cast< ::PROTOBUF_NAMESPACE_ID::uint8>(tag) == (18 & 0xFF)) {
DO_(::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::ReadString(
- input, this->mutable_extendee()));
+ input, this->_internal_mutable_extendee()));
::PROTOBUF_NAMESPACE_ID::internal::WireFormat::VerifyUTF8StringNamedField(
- this->extendee().data(), static_cast<int>(this->extendee().length()),
+ this->_internal_extendee().data(), static_cast<int>(this->_internal_extendee().length()),
::PROTOBUF_NAMESPACE_ID::internal::WireFormat::PARSE,
"google.protobuf.FieldDescriptorProto.extendee");
} else {
@@ -4655,9 +4603,9 @@
case 6: {
if (static_cast< ::PROTOBUF_NAMESPACE_ID::uint8>(tag) == (50 & 0xFF)) {
DO_(::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::ReadString(
- input, this->mutable_type_name()));
+ input, this->_internal_mutable_type_name()));
::PROTOBUF_NAMESPACE_ID::internal::WireFormat::VerifyUTF8StringNamedField(
- this->type_name().data(), static_cast<int>(this->type_name().length()),
+ this->_internal_type_name().data(), static_cast<int>(this->_internal_type_name().length()),
::PROTOBUF_NAMESPACE_ID::internal::WireFormat::PARSE,
"google.protobuf.FieldDescriptorProto.type_name");
} else {
@@ -4670,9 +4618,9 @@
case 7: {
if (static_cast< ::PROTOBUF_NAMESPACE_ID::uint8>(tag) == (58 & 0xFF)) {
DO_(::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::ReadString(
- input, this->mutable_default_value()));
+ input, this->_internal_mutable_default_value()));
::PROTOBUF_NAMESPACE_ID::internal::WireFormat::VerifyUTF8StringNamedField(
- this->default_value().data(), static_cast<int>(this->default_value().length()),
+ this->_internal_default_value().data(), static_cast<int>(this->_internal_default_value().length()),
::PROTOBUF_NAMESPACE_ID::internal::WireFormat::PARSE,
"google.protobuf.FieldDescriptorProto.default_value");
} else {
@@ -4709,9 +4657,9 @@
case 10: {
if (static_cast< ::PROTOBUF_NAMESPACE_ID::uint8>(tag) == (82 & 0xFF)) {
DO_(::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::ReadString(
- input, this->mutable_json_name()));
+ input, this->_internal_mutable_json_name()));
::PROTOBUF_NAMESPACE_ID::internal::WireFormat::VerifyUTF8StringNamedField(
- this->json_name().data(), static_cast<int>(this->json_name().length()),
+ this->_internal_json_name().data(), static_cast<int>(this->_internal_json_name().length()),
::PROTOBUF_NAMESPACE_ID::internal::WireFormat::PARSE,
"google.protobuf.FieldDescriptorProto.json_name");
} else {
@@ -4751,21 +4699,21 @@
// optional string name = 1;
if (cached_has_bits & 0x00000001u) {
::PROTOBUF_NAMESPACE_ID::internal::WireFormat::VerifyUTF8StringNamedField(
- this->name().data(), static_cast<int>(this->name().length()),
+ this->_internal_name().data(), static_cast<int>(this->_internal_name().length()),
::PROTOBUF_NAMESPACE_ID::internal::WireFormat::SERIALIZE,
"google.protobuf.FieldDescriptorProto.name");
target = stream->WriteStringMaybeAliased(
- 1, this->name(), target);
+ 1, this->_internal_name(), target);
}
// optional string extendee = 2;
if (cached_has_bits & 0x00000002u) {
::PROTOBUF_NAMESPACE_ID::internal::WireFormat::VerifyUTF8StringNamedField(
- this->extendee().data(), static_cast<int>(this->extendee().length()),
+ this->_internal_extendee().data(), static_cast<int>(this->_internal_extendee().length()),
::PROTOBUF_NAMESPACE_ID::internal::WireFormat::SERIALIZE,
"google.protobuf.FieldDescriptorProto.extendee");
target = stream->WriteStringMaybeAliased(
- 2, this->extendee(), target);
+ 2, this->_internal_extendee(), target);
}
// optional int32 number = 3;
@@ -4791,21 +4739,21 @@
// optional string type_name = 6;
if (cached_has_bits & 0x00000004u) {
::PROTOBUF_NAMESPACE_ID::internal::WireFormat::VerifyUTF8StringNamedField(
- this->type_name().data(), static_cast<int>(this->type_name().length()),
+ this->_internal_type_name().data(), static_cast<int>(this->_internal_type_name().length()),
::PROTOBUF_NAMESPACE_ID::internal::WireFormat::SERIALIZE,
"google.protobuf.FieldDescriptorProto.type_name");
target = stream->WriteStringMaybeAliased(
- 6, this->type_name(), target);
+ 6, this->_internal_type_name(), target);
}
// optional string default_value = 7;
if (cached_has_bits & 0x00000008u) {
::PROTOBUF_NAMESPACE_ID::internal::WireFormat::VerifyUTF8StringNamedField(
- this->default_value().data(), static_cast<int>(this->default_value().length()),
+ this->_internal_default_value().data(), static_cast<int>(this->_internal_default_value().length()),
::PROTOBUF_NAMESPACE_ID::internal::WireFormat::SERIALIZE,
"google.protobuf.FieldDescriptorProto.default_value");
target = stream->WriteStringMaybeAliased(
- 7, this->default_value(), target);
+ 7, this->_internal_default_value(), target);
}
// optional .google.protobuf.FieldOptions options = 8;
@@ -4825,11 +4773,11 @@
// optional string json_name = 10;
if (cached_has_bits & 0x00000010u) {
::PROTOBUF_NAMESPACE_ID::internal::WireFormat::VerifyUTF8StringNamedField(
- this->json_name().data(), static_cast<int>(this->json_name().length()),
+ this->_internal_json_name().data(), static_cast<int>(this->_internal_json_name().length()),
::PROTOBUF_NAMESPACE_ID::internal::WireFormat::SERIALIZE,
"google.protobuf.FieldDescriptorProto.json_name");
target = stream->WriteStringMaybeAliased(
- 10, this->json_name(), target);
+ 10, this->_internal_json_name(), target);
}
if (PROTOBUF_PREDICT_FALSE(_internal_metadata_.have_unknown_fields())) {
@@ -4854,35 +4802,35 @@
if (cached_has_bits & 0x00000001u) {
total_size += 1 +
::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::StringSize(
- this->name());
+ this->_internal_name());
}
// optional string extendee = 2;
if (cached_has_bits & 0x00000002u) {
total_size += 1 +
::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::StringSize(
- this->extendee());
+ this->_internal_extendee());
}
// optional string type_name = 6;
if (cached_has_bits & 0x00000004u) {
total_size += 1 +
::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::StringSize(
- this->type_name());
+ this->_internal_type_name());
}
// optional string default_value = 7;
if (cached_has_bits & 0x00000008u) {
total_size += 1 +
::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::StringSize(
- this->default_value());
+ this->_internal_default_value());
}
// optional string json_name = 10;
if (cached_has_bits & 0x00000010u) {
total_size += 1 +
::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::StringSize(
- this->json_name());
+ this->_internal_json_name());
}
// optional .google.protobuf.FieldOptions options = 8;
@@ -4955,19 +4903,19 @@
cached_has_bits = from._has_bits_[0];
if (cached_has_bits & 0x000000ffu) {
if (cached_has_bits & 0x00000001u) {
- set_name(from.name());
+ _internal_set_name(from._internal_name());
}
if (cached_has_bits & 0x00000002u) {
- set_extendee(from.extendee());
+ _internal_set_extendee(from._internal_extendee());
}
if (cached_has_bits & 0x00000004u) {
- set_type_name(from.type_name());
+ _internal_set_type_name(from._internal_type_name());
}
if (cached_has_bits & 0x00000008u) {
- set_default_value(from.default_value());
+ _internal_set_default_value(from._internal_default_value());
}
if (cached_has_bits & 0x00000010u) {
- set_json_name(from.json_name());
+ _internal_set_json_name(from._internal_json_name());
}
if (cached_has_bits & 0x00000020u) {
mutable_options()->PROTOBUF_NAMESPACE_ID::FieldOptions::MergeFrom(from.options());
@@ -5091,8 +5039,8 @@
_has_bits_(from._has_bits_) {
_internal_metadata_.MergeFrom(from._internal_metadata_);
name_.UnsafeSetDefault(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited());
- if (from.has_name()) {
- name_.Set(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(), from.name(),
+ if (from._internal_has_name()) {
+ name_.Set(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(), from._internal_name(),
GetArenaNoVirtual());
}
if (from.has_options()) {
@@ -5168,7 +5116,7 @@
// optional string name = 1;
case 1:
if (PROTOBUF_PREDICT_TRUE(static_cast<::PROTOBUF_NAMESPACE_ID::uint8>(tag) == 10)) {
- ptr = ::PROTOBUF_NAMESPACE_ID::internal::InlineGreedyStringParserUTF8Verify(mutable_name(), ptr, ctx, "google.protobuf.OneofDescriptorProto.name");
+ ptr = ::PROTOBUF_NAMESPACE_ID::internal::InlineGreedyStringParserUTF8Verify(_internal_mutable_name(), ptr, ctx, "google.protobuf.OneofDescriptorProto.name");
CHK_(ptr);
} else goto handle_unusual;
continue;
@@ -5214,9 +5162,9 @@
case 1: {
if (static_cast< ::PROTOBUF_NAMESPACE_ID::uint8>(tag) == (10 & 0xFF)) {
DO_(::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::ReadString(
- input, this->mutable_name()));
+ input, this->_internal_mutable_name()));
::PROTOBUF_NAMESPACE_ID::internal::WireFormat::VerifyUTF8StringNamedField(
- this->name().data(), static_cast<int>(this->name().length()),
+ this->_internal_name().data(), static_cast<int>(this->_internal_name().length()),
::PROTOBUF_NAMESPACE_ID::internal::WireFormat::PARSE,
"google.protobuf.OneofDescriptorProto.name");
} else {
@@ -5267,11 +5215,11 @@
// optional string name = 1;
if (cached_has_bits & 0x00000001u) {
::PROTOBUF_NAMESPACE_ID::internal::WireFormat::VerifyUTF8StringNamedField(
- this->name().data(), static_cast<int>(this->name().length()),
+ this->_internal_name().data(), static_cast<int>(this->_internal_name().length()),
::PROTOBUF_NAMESPACE_ID::internal::WireFormat::SERIALIZE,
"google.protobuf.OneofDescriptorProto.name");
target = stream->WriteStringMaybeAliased(
- 1, this->name(), target);
+ 1, this->_internal_name(), target);
}
// optional .google.protobuf.OneofOptions options = 2;
@@ -5304,7 +5252,7 @@
if (cached_has_bits & 0x00000001u) {
total_size += 1 +
::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::StringSize(
- this->name());
+ this->_internal_name());
}
// optional .google.protobuf.OneofOptions options = 2;
@@ -5349,7 +5297,7 @@
cached_has_bits = from._has_bits_[0];
if (cached_has_bits & 0x00000003u) {
if (cached_has_bits & 0x00000001u) {
- set_name(from.name());
+ _internal_set_name(from._internal_name());
}
if (cached_has_bits & 0x00000002u) {
mutable_options()->PROTOBUF_NAMESPACE_ID::OneofOptions::MergeFrom(from.options());
@@ -5765,8 +5713,8 @@
reserved_name_(from.reserved_name_) {
_internal_metadata_.MergeFrom(from._internal_metadata_);
name_.UnsafeSetDefault(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited());
- if (from.has_name()) {
- name_.Set(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(), from.name(),
+ if (from._internal_has_name()) {
+ name_.Set(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(), from._internal_name(),
GetArenaNoVirtual());
}
if (from.has_options()) {
@@ -5845,7 +5793,7 @@
// optional string name = 1;
case 1:
if (PROTOBUF_PREDICT_TRUE(static_cast<::PROTOBUF_NAMESPACE_ID::uint8>(tag) == 10)) {
- ptr = ::PROTOBUF_NAMESPACE_ID::internal::InlineGreedyStringParserUTF8Verify(mutable_name(), ptr, ctx, "google.protobuf.EnumDescriptorProto.name");
+ ptr = ::PROTOBUF_NAMESPACE_ID::internal::InlineGreedyStringParserUTF8Verify(_internal_mutable_name(), ptr, ctx, "google.protobuf.EnumDescriptorProto.name");
CHK_(ptr);
} else goto handle_unusual;
continue;
@@ -5858,7 +5806,7 @@
ptr = ctx->ParseMessage(add_value(), ptr);
CHK_(ptr);
if (!ctx->DataAvailable(ptr)) break;
- } while (::PROTOBUF_NAMESPACE_ID::internal::UnalignedLoad<::PROTOBUF_NAMESPACE_ID::uint8>(ptr) == 18);
+ } while (::PROTOBUF_NAMESPACE_ID::internal::ExpectTag<18>(ptr));
} else goto handle_unusual;
continue;
// optional .google.protobuf.EnumOptions options = 3;
@@ -5877,7 +5825,7 @@
ptr = ctx->ParseMessage(add_reserved_range(), ptr);
CHK_(ptr);
if (!ctx->DataAvailable(ptr)) break;
- } while (::PROTOBUF_NAMESPACE_ID::internal::UnalignedLoad<::PROTOBUF_NAMESPACE_ID::uint8>(ptr) == 34);
+ } while (::PROTOBUF_NAMESPACE_ID::internal::ExpectTag<34>(ptr));
} else goto handle_unusual;
continue;
// repeated string reserved_name = 5;
@@ -5886,10 +5834,10 @@
ptr -= 1;
do {
ptr += 1;
- ptr = ::PROTOBUF_NAMESPACE_ID::internal::InlineGreedyStringParserUTF8Verify(add_reserved_name(), ptr, ctx, "google.protobuf.EnumDescriptorProto.reserved_name");
+ ptr = ::PROTOBUF_NAMESPACE_ID::internal::InlineGreedyStringParserUTF8Verify(_internal_add_reserved_name(), ptr, ctx, "google.protobuf.EnumDescriptorProto.reserved_name");
CHK_(ptr);
if (!ctx->DataAvailable(ptr)) break;
- } while (::PROTOBUF_NAMESPACE_ID::internal::UnalignedLoad<::PROTOBUF_NAMESPACE_ID::uint8>(ptr) == 42);
+ } while (::PROTOBUF_NAMESPACE_ID::internal::ExpectTag<42>(ptr));
} else goto handle_unusual;
continue;
default: {
@@ -5927,9 +5875,9 @@
case 1: {
if (static_cast< ::PROTOBUF_NAMESPACE_ID::uint8>(tag) == (10 & 0xFF)) {
DO_(::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::ReadString(
- input, this->mutable_name()));
+ input, this->_internal_mutable_name()));
::PROTOBUF_NAMESPACE_ID::internal::WireFormat::VerifyUTF8StringNamedField(
- this->name().data(), static_cast<int>(this->name().length()),
+ this->_internal_name().data(), static_cast<int>(this->_internal_name().length()),
::PROTOBUF_NAMESPACE_ID::internal::WireFormat::PARSE,
"google.protobuf.EnumDescriptorProto.name");
} else {
@@ -5975,10 +5923,10 @@
case 5: {
if (static_cast< ::PROTOBUF_NAMESPACE_ID::uint8>(tag) == (42 & 0xFF)) {
DO_(::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::ReadString(
- input, this->add_reserved_name()));
+ input, this->_internal_add_reserved_name()));
::PROTOBUF_NAMESPACE_ID::internal::WireFormat::VerifyUTF8StringNamedField(
- this->reserved_name(this->reserved_name_size() - 1).data(),
- static_cast<int>(this->reserved_name(this->reserved_name_size() - 1).length()),
+ reserved_name_.Get(reserved_name_.size() - 1).data(),
+ static_cast<int>(reserved_name_.Get(reserved_name_.size() - 1).length()),
::PROTOBUF_NAMESPACE_ID::internal::WireFormat::PARSE,
"google.protobuf.EnumDescriptorProto.reserved_name");
} else {
@@ -6018,16 +5966,16 @@
// optional string name = 1;
if (cached_has_bits & 0x00000001u) {
::PROTOBUF_NAMESPACE_ID::internal::WireFormat::VerifyUTF8StringNamedField(
- this->name().data(), static_cast<int>(this->name().length()),
+ this->_internal_name().data(), static_cast<int>(this->_internal_name().length()),
::PROTOBUF_NAMESPACE_ID::internal::WireFormat::SERIALIZE,
"google.protobuf.EnumDescriptorProto.name");
target = stream->WriteStringMaybeAliased(
- 1, this->name(), target);
+ 1, this->_internal_name(), target);
}
// repeated .google.protobuf.EnumValueDescriptorProto value = 2;
- for (auto it = this->value().pointer_begin(),
- end = this->value().pointer_end(); it < end; ++it) {
+ for (auto it = this->value_.pointer_begin(),
+ end = this->value_.pointer_end(); it < end; ++it) {
stream->EnsureSpace(&target);
target = ::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::
InternalWriteMessageToArray(2, **it, target, stream);
@@ -6042,16 +5990,16 @@
}
// repeated .google.protobuf.EnumDescriptorProto.EnumReservedRange reserved_range = 4;
- for (auto it = this->reserved_range().pointer_begin(),
- end = this->reserved_range().pointer_end(); it < end; ++it) {
+ for (auto it = this->reserved_range_.pointer_begin(),
+ end = this->reserved_range_.pointer_end(); it < end; ++it) {
stream->EnsureSpace(&target);
target = ::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::
InternalWriteMessageToArray(4, **it, target, stream);
}
// repeated string reserved_name = 5;
- for (auto it = this->reserved_name().pointer_begin(),
- end = this->reserved_name().pointer_end(); it < end; ++it) {
+ for (auto it = reserved_name_.pointer_begin(),
+ end = reserved_name_.pointer_end(); it < end; ++it) {
const auto& s = **it;
::PROTOBUF_NAMESPACE_ID::internal::WireFormat::VerifyUTF8StringNamedField(
s.data(), static_cast<int>(s.length()),
@@ -6077,33 +6025,25 @@
(void) cached_has_bits;
// repeated .google.protobuf.EnumValueDescriptorProto value = 2;
- {
- unsigned int count = static_cast<unsigned int>(this->value_size());
- total_size += 1UL * count;
- for (unsigned int i = 0; i < count; i++) {
- total_size +=
- ::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::MessageSize(
- this->value(static_cast<int>(i)));
- }
+ total_size += 1UL * this->value_size();
+ for (const auto& msg : this->value_) {
+ total_size +=
+ ::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::MessageSize(msg);
}
// repeated .google.protobuf.EnumDescriptorProto.EnumReservedRange reserved_range = 4;
- {
- unsigned int count = static_cast<unsigned int>(this->reserved_range_size());
- total_size += 1UL * count;
- for (unsigned int i = 0; i < count; i++) {
- total_size +=
- ::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::MessageSize(
- this->reserved_range(static_cast<int>(i)));
- }
+ total_size += 1UL * this->reserved_range_size();
+ for (const auto& msg : this->reserved_range_) {
+ total_size +=
+ ::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::MessageSize(msg);
}
// repeated string reserved_name = 5;
total_size += 1 *
- ::PROTOBUF_NAMESPACE_ID::internal::FromIntSize(this->reserved_name_size());
- for (int i = 0, n = this->reserved_name_size(); i < n; i++) {
+ ::PROTOBUF_NAMESPACE_ID::internal::FromIntSize(reserved_name_.size());
+ for (int i = 0, n = reserved_name_.size(); i < n; i++) {
total_size += ::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::StringSize(
- this->reserved_name(i));
+ reserved_name_.Get(i));
}
cached_has_bits = _has_bits_[0];
@@ -6112,7 +6052,7 @@
if (cached_has_bits & 0x00000001u) {
total_size += 1 +
::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::StringSize(
- this->name());
+ this->_internal_name());
}
// optional .google.protobuf.EnumOptions options = 3;
@@ -6160,7 +6100,7 @@
cached_has_bits = from._has_bits_[0];
if (cached_has_bits & 0x00000003u) {
if (cached_has_bits & 0x00000001u) {
- set_name(from.name());
+ _internal_set_name(from._internal_name());
}
if (cached_has_bits & 0x00000002u) {
mutable_options()->PROTOBUF_NAMESPACE_ID::EnumOptions::MergeFrom(from.options());
@@ -6194,9 +6134,9 @@
using std::swap;
_internal_metadata_.Swap(&other->_internal_metadata_);
swap(_has_bits_[0], other->_has_bits_[0]);
- CastToBase(&value_)->InternalSwap(CastToBase(&other->value_));
- CastToBase(&reserved_range_)->InternalSwap(CastToBase(&other->reserved_range_));
- reserved_name_.InternalSwap(CastToBase(&other->reserved_name_));
+ value_.InternalSwap(&other->value_);
+ reserved_range_.InternalSwap(&other->reserved_range_);
+ reserved_name_.InternalSwap(&other->reserved_name_);
name_.Swap(&other->name_, &::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(),
GetArenaNoVirtual());
swap(options_, other->options_);
@@ -6263,8 +6203,8 @@
_has_bits_(from._has_bits_) {
_internal_metadata_.MergeFrom(from._internal_metadata_);
name_.UnsafeSetDefault(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited());
- if (from.has_name()) {
- name_.Set(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(), from.name(),
+ if (from._internal_has_name()) {
+ name_.Set(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(), from._internal_name(),
GetArenaNoVirtual());
}
if (from.has_options()) {
@@ -6344,7 +6284,7 @@
// optional string name = 1;
case 1:
if (PROTOBUF_PREDICT_TRUE(static_cast<::PROTOBUF_NAMESPACE_ID::uint8>(tag) == 10)) {
- ptr = ::PROTOBUF_NAMESPACE_ID::internal::InlineGreedyStringParserUTF8Verify(mutable_name(), ptr, ctx, "google.protobuf.EnumValueDescriptorProto.name");
+ ptr = ::PROTOBUF_NAMESPACE_ID::internal::InlineGreedyStringParserUTF8Verify(_internal_mutable_name(), ptr, ctx, "google.protobuf.EnumValueDescriptorProto.name");
CHK_(ptr);
} else goto handle_unusual;
continue;
@@ -6398,9 +6338,9 @@
case 1: {
if (static_cast< ::PROTOBUF_NAMESPACE_ID::uint8>(tag) == (10 & 0xFF)) {
DO_(::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::ReadString(
- input, this->mutable_name()));
+ input, this->_internal_mutable_name()));
::PROTOBUF_NAMESPACE_ID::internal::WireFormat::VerifyUTF8StringNamedField(
- this->name().data(), static_cast<int>(this->name().length()),
+ this->_internal_name().data(), static_cast<int>(this->_internal_name().length()),
::PROTOBUF_NAMESPACE_ID::internal::WireFormat::PARSE,
"google.protobuf.EnumValueDescriptorProto.name");
} else {
@@ -6464,11 +6404,11 @@
// optional string name = 1;
if (cached_has_bits & 0x00000001u) {
::PROTOBUF_NAMESPACE_ID::internal::WireFormat::VerifyUTF8StringNamedField(
- this->name().data(), static_cast<int>(this->name().length()),
+ this->_internal_name().data(), static_cast<int>(this->_internal_name().length()),
::PROTOBUF_NAMESPACE_ID::internal::WireFormat::SERIALIZE,
"google.protobuf.EnumValueDescriptorProto.name");
target = stream->WriteStringMaybeAliased(
- 1, this->name(), target);
+ 1, this->_internal_name(), target);
}
// optional int32 number = 2;
@@ -6507,7 +6447,7 @@
if (cached_has_bits & 0x00000001u) {
total_size += 1 +
::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::StringSize(
- this->name());
+ this->_internal_name());
}
// optional .google.protobuf.EnumValueOptions options = 3;
@@ -6559,7 +6499,7 @@
cached_has_bits = from._has_bits_[0];
if (cached_has_bits & 0x00000007u) {
if (cached_has_bits & 0x00000001u) {
- set_name(from.name());
+ _internal_set_name(from._internal_name());
}
if (cached_has_bits & 0x00000002u) {
mutable_options()->PROTOBUF_NAMESPACE_ID::EnumValueOptions::MergeFrom(from.options());
@@ -6662,8 +6602,8 @@
method_(from.method_) {
_internal_metadata_.MergeFrom(from._internal_metadata_);
name_.UnsafeSetDefault(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited());
- if (from.has_name()) {
- name_.Set(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(), from.name(),
+ if (from._internal_has_name()) {
+ name_.Set(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(), from._internal_name(),
GetArenaNoVirtual());
}
if (from.has_options()) {
@@ -6740,7 +6680,7 @@
// optional string name = 1;
case 1:
if (PROTOBUF_PREDICT_TRUE(static_cast<::PROTOBUF_NAMESPACE_ID::uint8>(tag) == 10)) {
- ptr = ::PROTOBUF_NAMESPACE_ID::internal::InlineGreedyStringParserUTF8Verify(mutable_name(), ptr, ctx, "google.protobuf.ServiceDescriptorProto.name");
+ ptr = ::PROTOBUF_NAMESPACE_ID::internal::InlineGreedyStringParserUTF8Verify(_internal_mutable_name(), ptr, ctx, "google.protobuf.ServiceDescriptorProto.name");
CHK_(ptr);
} else goto handle_unusual;
continue;
@@ -6753,7 +6693,7 @@
ptr = ctx->ParseMessage(add_method(), ptr);
CHK_(ptr);
if (!ctx->DataAvailable(ptr)) break;
- } while (::PROTOBUF_NAMESPACE_ID::internal::UnalignedLoad<::PROTOBUF_NAMESPACE_ID::uint8>(ptr) == 18);
+ } while (::PROTOBUF_NAMESPACE_ID::internal::ExpectTag<18>(ptr));
} else goto handle_unusual;
continue;
// optional .google.protobuf.ServiceOptions options = 3;
@@ -6798,9 +6738,9 @@
case 1: {
if (static_cast< ::PROTOBUF_NAMESPACE_ID::uint8>(tag) == (10 & 0xFF)) {
DO_(::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::ReadString(
- input, this->mutable_name()));
+ input, this->_internal_mutable_name()));
::PROTOBUF_NAMESPACE_ID::internal::WireFormat::VerifyUTF8StringNamedField(
- this->name().data(), static_cast<int>(this->name().length()),
+ this->_internal_name().data(), static_cast<int>(this->_internal_name().length()),
::PROTOBUF_NAMESPACE_ID::internal::WireFormat::PARSE,
"google.protobuf.ServiceDescriptorProto.name");
} else {
@@ -6862,16 +6802,16 @@
// optional string name = 1;
if (cached_has_bits & 0x00000001u) {
::PROTOBUF_NAMESPACE_ID::internal::WireFormat::VerifyUTF8StringNamedField(
- this->name().data(), static_cast<int>(this->name().length()),
+ this->_internal_name().data(), static_cast<int>(this->_internal_name().length()),
::PROTOBUF_NAMESPACE_ID::internal::WireFormat::SERIALIZE,
"google.protobuf.ServiceDescriptorProto.name");
target = stream->WriteStringMaybeAliased(
- 1, this->name(), target);
+ 1, this->_internal_name(), target);
}
// repeated .google.protobuf.MethodDescriptorProto method = 2;
- for (auto it = this->method().pointer_begin(),
- end = this->method().pointer_end(); it < end; ++it) {
+ for (auto it = this->method_.pointer_begin(),
+ end = this->method_.pointer_end(); it < end; ++it) {
stream->EnsureSpace(&target);
target = ::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::
InternalWriteMessageToArray(2, **it, target, stream);
@@ -6902,14 +6842,10 @@
(void) cached_has_bits;
// repeated .google.protobuf.MethodDescriptorProto method = 2;
- {
- unsigned int count = static_cast<unsigned int>(this->method_size());
- total_size += 1UL * count;
- for (unsigned int i = 0; i < count; i++) {
- total_size +=
- ::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::MessageSize(
- this->method(static_cast<int>(i)));
- }
+ total_size += 1UL * this->method_size();
+ for (const auto& msg : this->method_) {
+ total_size +=
+ ::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::MessageSize(msg);
}
cached_has_bits = _has_bits_[0];
@@ -6918,7 +6854,7 @@
if (cached_has_bits & 0x00000001u) {
total_size += 1 +
::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::StringSize(
- this->name());
+ this->_internal_name());
}
// optional .google.protobuf.ServiceOptions options = 3;
@@ -6964,7 +6900,7 @@
cached_has_bits = from._has_bits_[0];
if (cached_has_bits & 0x00000003u) {
if (cached_has_bits & 0x00000001u) {
- set_name(from.name());
+ _internal_set_name(from._internal_name());
}
if (cached_has_bits & 0x00000002u) {
mutable_options()->PROTOBUF_NAMESPACE_ID::ServiceOptions::MergeFrom(from.options());
@@ -6998,7 +6934,7 @@
using std::swap;
_internal_metadata_.Swap(&other->_internal_metadata_);
swap(_has_bits_[0], other->_has_bits_[0]);
- CastToBase(&method_)->InternalSwap(CastToBase(&other->method_));
+ method_.InternalSwap(&other->method_);
name_.Swap(&other->name_, &::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(),
GetArenaNoVirtual());
swap(options_, other->options_);
@@ -7074,18 +7010,18 @@
_has_bits_(from._has_bits_) {
_internal_metadata_.MergeFrom(from._internal_metadata_);
name_.UnsafeSetDefault(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited());
- if (from.has_name()) {
- name_.Set(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(), from.name(),
+ if (from._internal_has_name()) {
+ name_.Set(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(), from._internal_name(),
GetArenaNoVirtual());
}
input_type_.UnsafeSetDefault(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited());
- if (from.has_input_type()) {
- input_type_.Set(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(), from.input_type(),
+ if (from._internal_has_input_type()) {
+ input_type_.Set(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(), from._internal_input_type(),
GetArenaNoVirtual());
}
output_type_.UnsafeSetDefault(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited());
- if (from.has_output_type()) {
- output_type_.Set(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(), from.output_type(),
+ if (from._internal_has_output_type()) {
+ output_type_.Set(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(), from._internal_output_type(),
GetArenaNoVirtual());
}
if (from.has_options()) {
@@ -7179,21 +7115,21 @@
// optional string name = 1;
case 1:
if (PROTOBUF_PREDICT_TRUE(static_cast<::PROTOBUF_NAMESPACE_ID::uint8>(tag) == 10)) {
- ptr = ::PROTOBUF_NAMESPACE_ID::internal::InlineGreedyStringParserUTF8Verify(mutable_name(), ptr, ctx, "google.protobuf.MethodDescriptorProto.name");
+ ptr = ::PROTOBUF_NAMESPACE_ID::internal::InlineGreedyStringParserUTF8Verify(_internal_mutable_name(), ptr, ctx, "google.protobuf.MethodDescriptorProto.name");
CHK_(ptr);
} else goto handle_unusual;
continue;
// optional string input_type = 2;
case 2:
if (PROTOBUF_PREDICT_TRUE(static_cast<::PROTOBUF_NAMESPACE_ID::uint8>(tag) == 18)) {
- ptr = ::PROTOBUF_NAMESPACE_ID::internal::InlineGreedyStringParserUTF8Verify(mutable_input_type(), ptr, ctx, "google.protobuf.MethodDescriptorProto.input_type");
+ ptr = ::PROTOBUF_NAMESPACE_ID::internal::InlineGreedyStringParserUTF8Verify(_internal_mutable_input_type(), ptr, ctx, "google.protobuf.MethodDescriptorProto.input_type");
CHK_(ptr);
} else goto handle_unusual;
continue;
// optional string output_type = 3;
case 3:
if (PROTOBUF_PREDICT_TRUE(static_cast<::PROTOBUF_NAMESPACE_ID::uint8>(tag) == 26)) {
- ptr = ::PROTOBUF_NAMESPACE_ID::internal::InlineGreedyStringParserUTF8Verify(mutable_output_type(), ptr, ctx, "google.protobuf.MethodDescriptorProto.output_type");
+ ptr = ::PROTOBUF_NAMESPACE_ID::internal::InlineGreedyStringParserUTF8Verify(_internal_mutable_output_type(), ptr, ctx, "google.protobuf.MethodDescriptorProto.output_type");
CHK_(ptr);
} else goto handle_unusual;
continue;
@@ -7255,9 +7191,9 @@
case 1: {
if (static_cast< ::PROTOBUF_NAMESPACE_ID::uint8>(tag) == (10 & 0xFF)) {
DO_(::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::ReadString(
- input, this->mutable_name()));
+ input, this->_internal_mutable_name()));
::PROTOBUF_NAMESPACE_ID::internal::WireFormat::VerifyUTF8StringNamedField(
- this->name().data(), static_cast<int>(this->name().length()),
+ this->_internal_name().data(), static_cast<int>(this->_internal_name().length()),
::PROTOBUF_NAMESPACE_ID::internal::WireFormat::PARSE,
"google.protobuf.MethodDescriptorProto.name");
} else {
@@ -7270,9 +7206,9 @@
case 2: {
if (static_cast< ::PROTOBUF_NAMESPACE_ID::uint8>(tag) == (18 & 0xFF)) {
DO_(::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::ReadString(
- input, this->mutable_input_type()));
+ input, this->_internal_mutable_input_type()));
::PROTOBUF_NAMESPACE_ID::internal::WireFormat::VerifyUTF8StringNamedField(
- this->input_type().data(), static_cast<int>(this->input_type().length()),
+ this->_internal_input_type().data(), static_cast<int>(this->_internal_input_type().length()),
::PROTOBUF_NAMESPACE_ID::internal::WireFormat::PARSE,
"google.protobuf.MethodDescriptorProto.input_type");
} else {
@@ -7285,9 +7221,9 @@
case 3: {
if (static_cast< ::PROTOBUF_NAMESPACE_ID::uint8>(tag) == (26 & 0xFF)) {
DO_(::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::ReadString(
- input, this->mutable_output_type()));
+ input, this->_internal_mutable_output_type()));
::PROTOBUF_NAMESPACE_ID::internal::WireFormat::VerifyUTF8StringNamedField(
- this->output_type().data(), static_cast<int>(this->output_type().length()),
+ this->_internal_output_type().data(), static_cast<int>(this->_internal_output_type().length()),
::PROTOBUF_NAMESPACE_ID::internal::WireFormat::PARSE,
"google.protobuf.MethodDescriptorProto.output_type");
} else {
@@ -7364,31 +7300,31 @@
// optional string name = 1;
if (cached_has_bits & 0x00000001u) {
::PROTOBUF_NAMESPACE_ID::internal::WireFormat::VerifyUTF8StringNamedField(
- this->name().data(), static_cast<int>(this->name().length()),
+ this->_internal_name().data(), static_cast<int>(this->_internal_name().length()),
::PROTOBUF_NAMESPACE_ID::internal::WireFormat::SERIALIZE,
"google.protobuf.MethodDescriptorProto.name");
target = stream->WriteStringMaybeAliased(
- 1, this->name(), target);
+ 1, this->_internal_name(), target);
}
// optional string input_type = 2;
if (cached_has_bits & 0x00000002u) {
::PROTOBUF_NAMESPACE_ID::internal::WireFormat::VerifyUTF8StringNamedField(
- this->input_type().data(), static_cast<int>(this->input_type().length()),
+ this->_internal_input_type().data(), static_cast<int>(this->_internal_input_type().length()),
::PROTOBUF_NAMESPACE_ID::internal::WireFormat::SERIALIZE,
"google.protobuf.MethodDescriptorProto.input_type");
target = stream->WriteStringMaybeAliased(
- 2, this->input_type(), target);
+ 2, this->_internal_input_type(), target);
}
// optional string output_type = 3;
if (cached_has_bits & 0x00000004u) {
::PROTOBUF_NAMESPACE_ID::internal::WireFormat::VerifyUTF8StringNamedField(
- this->output_type().data(), static_cast<int>(this->output_type().length()),
+ this->_internal_output_type().data(), static_cast<int>(this->_internal_output_type().length()),
::PROTOBUF_NAMESPACE_ID::internal::WireFormat::SERIALIZE,
"google.protobuf.MethodDescriptorProto.output_type");
target = stream->WriteStringMaybeAliased(
- 3, this->output_type(), target);
+ 3, this->_internal_output_type(), target);
}
// optional .google.protobuf.MethodOptions options = 4;
@@ -7433,21 +7369,21 @@
if (cached_has_bits & 0x00000001u) {
total_size += 1 +
::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::StringSize(
- this->name());
+ this->_internal_name());
}
// optional string input_type = 2;
if (cached_has_bits & 0x00000002u) {
total_size += 1 +
::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::StringSize(
- this->input_type());
+ this->_internal_input_type());
}
// optional string output_type = 3;
if (cached_has_bits & 0x00000004u) {
total_size += 1 +
::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::StringSize(
- this->output_type());
+ this->_internal_output_type());
}
// optional .google.protobuf.MethodOptions options = 4;
@@ -7502,13 +7438,13 @@
cached_has_bits = from._has_bits_[0];
if (cached_has_bits & 0x0000003fu) {
if (cached_has_bits & 0x00000001u) {
- set_name(from.name());
+ _internal_set_name(from._internal_name());
}
if (cached_has_bits & 0x00000002u) {
- set_input_type(from.input_type());
+ _internal_set_input_type(from._internal_input_type());
}
if (cached_has_bits & 0x00000004u) {
- set_output_type(from.output_type());
+ _internal_set_output_type(from._internal_output_type());
}
if (cached_has_bits & 0x00000008u) {
mutable_options()->PROTOBUF_NAMESPACE_ID::MethodOptions::MergeFrom(from.options());
@@ -7655,53 +7591,53 @@
_internal_metadata_.MergeFrom(from._internal_metadata_);
_extensions_.MergeFrom(from._extensions_);
java_package_.UnsafeSetDefault(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited());
- if (from.has_java_package()) {
- java_package_.Set(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(), from.java_package(),
+ if (from._internal_has_java_package()) {
+ java_package_.Set(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(), from._internal_java_package(),
GetArenaNoVirtual());
}
java_outer_classname_.UnsafeSetDefault(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited());
- if (from.has_java_outer_classname()) {
- java_outer_classname_.Set(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(), from.java_outer_classname(),
+ if (from._internal_has_java_outer_classname()) {
+ java_outer_classname_.Set(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(), from._internal_java_outer_classname(),
GetArenaNoVirtual());
}
go_package_.UnsafeSetDefault(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited());
- if (from.has_go_package()) {
- go_package_.Set(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(), from.go_package(),
+ if (from._internal_has_go_package()) {
+ go_package_.Set(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(), from._internal_go_package(),
GetArenaNoVirtual());
}
objc_class_prefix_.UnsafeSetDefault(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited());
- if (from.has_objc_class_prefix()) {
- objc_class_prefix_.Set(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(), from.objc_class_prefix(),
+ if (from._internal_has_objc_class_prefix()) {
+ objc_class_prefix_.Set(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(), from._internal_objc_class_prefix(),
GetArenaNoVirtual());
}
csharp_namespace_.UnsafeSetDefault(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited());
- if (from.has_csharp_namespace()) {
- csharp_namespace_.Set(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(), from.csharp_namespace(),
+ if (from._internal_has_csharp_namespace()) {
+ csharp_namespace_.Set(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(), from._internal_csharp_namespace(),
GetArenaNoVirtual());
}
swift_prefix_.UnsafeSetDefault(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited());
- if (from.has_swift_prefix()) {
- swift_prefix_.Set(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(), from.swift_prefix(),
+ if (from._internal_has_swift_prefix()) {
+ swift_prefix_.Set(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(), from._internal_swift_prefix(),
GetArenaNoVirtual());
}
php_class_prefix_.UnsafeSetDefault(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited());
- if (from.has_php_class_prefix()) {
- php_class_prefix_.Set(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(), from.php_class_prefix(),
+ if (from._internal_has_php_class_prefix()) {
+ php_class_prefix_.Set(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(), from._internal_php_class_prefix(),
GetArenaNoVirtual());
}
php_namespace_.UnsafeSetDefault(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited());
- if (from.has_php_namespace()) {
- php_namespace_.Set(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(), from.php_namespace(),
+ if (from._internal_has_php_namespace()) {
+ php_namespace_.Set(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(), from._internal_php_namespace(),
GetArenaNoVirtual());
}
php_metadata_namespace_.UnsafeSetDefault(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited());
- if (from.has_php_metadata_namespace()) {
- php_metadata_namespace_.Set(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(), from.php_metadata_namespace(),
+ if (from._internal_has_php_metadata_namespace()) {
+ php_metadata_namespace_.Set(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(), from._internal_php_metadata_namespace(),
GetArenaNoVirtual());
}
ruby_package_.UnsafeSetDefault(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited());
- if (from.has_ruby_package()) {
- ruby_package_.Set(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(), from.ruby_package(),
+ if (from._internal_has_ruby_package()) {
+ ruby_package_.Set(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(), from._internal_ruby_package(),
GetArenaNoVirtual());
}
::memcpy(&java_multiple_files_, &from.java_multiple_files_,
@@ -7833,14 +7769,14 @@
// optional string java_package = 1;
case 1:
if (PROTOBUF_PREDICT_TRUE(static_cast<::PROTOBUF_NAMESPACE_ID::uint8>(tag) == 10)) {
- ptr = ::PROTOBUF_NAMESPACE_ID::internal::InlineGreedyStringParserUTF8Verify(mutable_java_package(), ptr, ctx, "google.protobuf.FileOptions.java_package");
+ ptr = ::PROTOBUF_NAMESPACE_ID::internal::InlineGreedyStringParserUTF8Verify(_internal_mutable_java_package(), ptr, ctx, "google.protobuf.FileOptions.java_package");
CHK_(ptr);
} else goto handle_unusual;
continue;
// optional string java_outer_classname = 8;
case 8:
if (PROTOBUF_PREDICT_TRUE(static_cast<::PROTOBUF_NAMESPACE_ID::uint8>(tag) == 66)) {
- ptr = ::PROTOBUF_NAMESPACE_ID::internal::InlineGreedyStringParserUTF8Verify(mutable_java_outer_classname(), ptr, ctx, "google.protobuf.FileOptions.java_outer_classname");
+ ptr = ::PROTOBUF_NAMESPACE_ID::internal::InlineGreedyStringParserUTF8Verify(_internal_mutable_java_outer_classname(), ptr, ctx, "google.protobuf.FileOptions.java_outer_classname");
CHK_(ptr);
} else goto handle_unusual;
continue;
@@ -7867,7 +7803,7 @@
// optional string go_package = 11;
case 11:
if (PROTOBUF_PREDICT_TRUE(static_cast<::PROTOBUF_NAMESPACE_ID::uint8>(tag) == 90)) {
- ptr = ::PROTOBUF_NAMESPACE_ID::internal::InlineGreedyStringParserUTF8Verify(mutable_go_package(), ptr, ctx, "google.protobuf.FileOptions.go_package");
+ ptr = ::PROTOBUF_NAMESPACE_ID::internal::InlineGreedyStringParserUTF8Verify(_internal_mutable_go_package(), ptr, ctx, "google.protobuf.FileOptions.go_package");
CHK_(ptr);
} else goto handle_unusual;
continue;
@@ -7930,35 +7866,35 @@
// optional string objc_class_prefix = 36;
case 36:
if (PROTOBUF_PREDICT_TRUE(static_cast<::PROTOBUF_NAMESPACE_ID::uint8>(tag) == 34)) {
- ptr = ::PROTOBUF_NAMESPACE_ID::internal::InlineGreedyStringParserUTF8Verify(mutable_objc_class_prefix(), ptr, ctx, "google.protobuf.FileOptions.objc_class_prefix");
+ ptr = ::PROTOBUF_NAMESPACE_ID::internal::InlineGreedyStringParserUTF8Verify(_internal_mutable_objc_class_prefix(), ptr, ctx, "google.protobuf.FileOptions.objc_class_prefix");
CHK_(ptr);
} else goto handle_unusual;
continue;
// optional string csharp_namespace = 37;
case 37:
if (PROTOBUF_PREDICT_TRUE(static_cast<::PROTOBUF_NAMESPACE_ID::uint8>(tag) == 42)) {
- ptr = ::PROTOBUF_NAMESPACE_ID::internal::InlineGreedyStringParserUTF8Verify(mutable_csharp_namespace(), ptr, ctx, "google.protobuf.FileOptions.csharp_namespace");
+ ptr = ::PROTOBUF_NAMESPACE_ID::internal::InlineGreedyStringParserUTF8Verify(_internal_mutable_csharp_namespace(), ptr, ctx, "google.protobuf.FileOptions.csharp_namespace");
CHK_(ptr);
} else goto handle_unusual;
continue;
// optional string swift_prefix = 39;
case 39:
if (PROTOBUF_PREDICT_TRUE(static_cast<::PROTOBUF_NAMESPACE_ID::uint8>(tag) == 58)) {
- ptr = ::PROTOBUF_NAMESPACE_ID::internal::InlineGreedyStringParserUTF8Verify(mutable_swift_prefix(), ptr, ctx, "google.protobuf.FileOptions.swift_prefix");
+ ptr = ::PROTOBUF_NAMESPACE_ID::internal::InlineGreedyStringParserUTF8Verify(_internal_mutable_swift_prefix(), ptr, ctx, "google.protobuf.FileOptions.swift_prefix");
CHK_(ptr);
} else goto handle_unusual;
continue;
// optional string php_class_prefix = 40;
case 40:
if (PROTOBUF_PREDICT_TRUE(static_cast<::PROTOBUF_NAMESPACE_ID::uint8>(tag) == 66)) {
- ptr = ::PROTOBUF_NAMESPACE_ID::internal::InlineGreedyStringParserUTF8Verify(mutable_php_class_prefix(), ptr, ctx, "google.protobuf.FileOptions.php_class_prefix");
+ ptr = ::PROTOBUF_NAMESPACE_ID::internal::InlineGreedyStringParserUTF8Verify(_internal_mutable_php_class_prefix(), ptr, ctx, "google.protobuf.FileOptions.php_class_prefix");
CHK_(ptr);
} else goto handle_unusual;
continue;
// optional string php_namespace = 41;
case 41:
if (PROTOBUF_PREDICT_TRUE(static_cast<::PROTOBUF_NAMESPACE_ID::uint8>(tag) == 74)) {
- ptr = ::PROTOBUF_NAMESPACE_ID::internal::InlineGreedyStringParserUTF8Verify(mutable_php_namespace(), ptr, ctx, "google.protobuf.FileOptions.php_namespace");
+ ptr = ::PROTOBUF_NAMESPACE_ID::internal::InlineGreedyStringParserUTF8Verify(_internal_mutable_php_namespace(), ptr, ctx, "google.protobuf.FileOptions.php_namespace");
CHK_(ptr);
} else goto handle_unusual;
continue;
@@ -7973,14 +7909,14 @@
// optional string php_metadata_namespace = 44;
case 44:
if (PROTOBUF_PREDICT_TRUE(static_cast<::PROTOBUF_NAMESPACE_ID::uint8>(tag) == 98)) {
- ptr = ::PROTOBUF_NAMESPACE_ID::internal::InlineGreedyStringParserUTF8Verify(mutable_php_metadata_namespace(), ptr, ctx, "google.protobuf.FileOptions.php_metadata_namespace");
+ ptr = ::PROTOBUF_NAMESPACE_ID::internal::InlineGreedyStringParserUTF8Verify(_internal_mutable_php_metadata_namespace(), ptr, ctx, "google.protobuf.FileOptions.php_metadata_namespace");
CHK_(ptr);
} else goto handle_unusual;
continue;
// optional string ruby_package = 45;
case 45:
if (PROTOBUF_PREDICT_TRUE(static_cast<::PROTOBUF_NAMESPACE_ID::uint8>(tag) == 106)) {
- ptr = ::PROTOBUF_NAMESPACE_ID::internal::InlineGreedyStringParserUTF8Verify(mutable_ruby_package(), ptr, ctx, "google.protobuf.FileOptions.ruby_package");
+ ptr = ::PROTOBUF_NAMESPACE_ID::internal::InlineGreedyStringParserUTF8Verify(_internal_mutable_ruby_package(), ptr, ctx, "google.protobuf.FileOptions.ruby_package");
CHK_(ptr);
} else goto handle_unusual;
continue;
@@ -7993,7 +7929,7 @@
ptr = ctx->ParseMessage(add_uninterpreted_option(), ptr);
CHK_(ptr);
if (!ctx->DataAvailable(ptr)) break;
- } while (::PROTOBUF_NAMESPACE_ID::internal::UnalignedLoad<::PROTOBUF_NAMESPACE_ID::uint16>(ptr) == 16058);
+ } while (::PROTOBUF_NAMESPACE_ID::internal::ExpectTag<7994>(ptr));
} else goto handle_unusual;
continue;
default: {
@@ -8037,9 +7973,9 @@
case 1: {
if (static_cast< ::PROTOBUF_NAMESPACE_ID::uint8>(tag) == (10 & 0xFF)) {
DO_(::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::ReadString(
- input, this->mutable_java_package()));
+ input, this->_internal_mutable_java_package()));
::PROTOBUF_NAMESPACE_ID::internal::WireFormat::VerifyUTF8StringNamedField(
- this->java_package().data(), static_cast<int>(this->java_package().length()),
+ this->_internal_java_package().data(), static_cast<int>(this->_internal_java_package().length()),
::PROTOBUF_NAMESPACE_ID::internal::WireFormat::PARSE,
"google.protobuf.FileOptions.java_package");
} else {
@@ -8052,9 +7988,9 @@
case 8: {
if (static_cast< ::PROTOBUF_NAMESPACE_ID::uint8>(tag) == (66 & 0xFF)) {
DO_(::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::ReadString(
- input, this->mutable_java_outer_classname()));
+ input, this->_internal_mutable_java_outer_classname()));
::PROTOBUF_NAMESPACE_ID::internal::WireFormat::VerifyUTF8StringNamedField(
- this->java_outer_classname().data(), static_cast<int>(this->java_outer_classname().length()),
+ this->_internal_java_outer_classname().data(), static_cast<int>(this->_internal_java_outer_classname().length()),
::PROTOBUF_NAMESPACE_ID::internal::WireFormat::PARSE,
"google.protobuf.FileOptions.java_outer_classname");
} else {
@@ -8099,9 +8035,9 @@
case 11: {
if (static_cast< ::PROTOBUF_NAMESPACE_ID::uint8>(tag) == (90 & 0xFF)) {
DO_(::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::ReadString(
- input, this->mutable_go_package()));
+ input, this->_internal_mutable_go_package()));
::PROTOBUF_NAMESPACE_ID::internal::WireFormat::VerifyUTF8StringNamedField(
- this->go_package().data(), static_cast<int>(this->go_package().length()),
+ this->_internal_go_package().data(), static_cast<int>(this->_internal_go_package().length()),
::PROTOBUF_NAMESPACE_ID::internal::WireFormat::PARSE,
"google.protobuf.FileOptions.go_package");
} else {
@@ -8205,9 +8141,9 @@
case 36: {
if (static_cast< ::PROTOBUF_NAMESPACE_ID::uint8>(tag) == (290 & 0xFF)) {
DO_(::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::ReadString(
- input, this->mutable_objc_class_prefix()));
+ input, this->_internal_mutable_objc_class_prefix()));
::PROTOBUF_NAMESPACE_ID::internal::WireFormat::VerifyUTF8StringNamedField(
- this->objc_class_prefix().data(), static_cast<int>(this->objc_class_prefix().length()),
+ this->_internal_objc_class_prefix().data(), static_cast<int>(this->_internal_objc_class_prefix().length()),
::PROTOBUF_NAMESPACE_ID::internal::WireFormat::PARSE,
"google.protobuf.FileOptions.objc_class_prefix");
} else {
@@ -8220,9 +8156,9 @@
case 37: {
if (static_cast< ::PROTOBUF_NAMESPACE_ID::uint8>(tag) == (298 & 0xFF)) {
DO_(::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::ReadString(
- input, this->mutable_csharp_namespace()));
+ input, this->_internal_mutable_csharp_namespace()));
::PROTOBUF_NAMESPACE_ID::internal::WireFormat::VerifyUTF8StringNamedField(
- this->csharp_namespace().data(), static_cast<int>(this->csharp_namespace().length()),
+ this->_internal_csharp_namespace().data(), static_cast<int>(this->_internal_csharp_namespace().length()),
::PROTOBUF_NAMESPACE_ID::internal::WireFormat::PARSE,
"google.protobuf.FileOptions.csharp_namespace");
} else {
@@ -8235,9 +8171,9 @@
case 39: {
if (static_cast< ::PROTOBUF_NAMESPACE_ID::uint8>(tag) == (314 & 0xFF)) {
DO_(::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::ReadString(
- input, this->mutable_swift_prefix()));
+ input, this->_internal_mutable_swift_prefix()));
::PROTOBUF_NAMESPACE_ID::internal::WireFormat::VerifyUTF8StringNamedField(
- this->swift_prefix().data(), static_cast<int>(this->swift_prefix().length()),
+ this->_internal_swift_prefix().data(), static_cast<int>(this->_internal_swift_prefix().length()),
::PROTOBUF_NAMESPACE_ID::internal::WireFormat::PARSE,
"google.protobuf.FileOptions.swift_prefix");
} else {
@@ -8250,9 +8186,9 @@
case 40: {
if (static_cast< ::PROTOBUF_NAMESPACE_ID::uint8>(tag) == (322 & 0xFF)) {
DO_(::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::ReadString(
- input, this->mutable_php_class_prefix()));
+ input, this->_internal_mutable_php_class_prefix()));
::PROTOBUF_NAMESPACE_ID::internal::WireFormat::VerifyUTF8StringNamedField(
- this->php_class_prefix().data(), static_cast<int>(this->php_class_prefix().length()),
+ this->_internal_php_class_prefix().data(), static_cast<int>(this->_internal_php_class_prefix().length()),
::PROTOBUF_NAMESPACE_ID::internal::WireFormat::PARSE,
"google.protobuf.FileOptions.php_class_prefix");
} else {
@@ -8265,9 +8201,9 @@
case 41: {
if (static_cast< ::PROTOBUF_NAMESPACE_ID::uint8>(tag) == (330 & 0xFF)) {
DO_(::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::ReadString(
- input, this->mutable_php_namespace()));
+ input, this->_internal_mutable_php_namespace()));
::PROTOBUF_NAMESPACE_ID::internal::WireFormat::VerifyUTF8StringNamedField(
- this->php_namespace().data(), static_cast<int>(this->php_namespace().length()),
+ this->_internal_php_namespace().data(), static_cast<int>(this->_internal_php_namespace().length()),
::PROTOBUF_NAMESPACE_ID::internal::WireFormat::PARSE,
"google.protobuf.FileOptions.php_namespace");
} else {
@@ -8293,9 +8229,9 @@
case 44: {
if (static_cast< ::PROTOBUF_NAMESPACE_ID::uint8>(tag) == (354 & 0xFF)) {
DO_(::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::ReadString(
- input, this->mutable_php_metadata_namespace()));
+ input, this->_internal_mutable_php_metadata_namespace()));
::PROTOBUF_NAMESPACE_ID::internal::WireFormat::VerifyUTF8StringNamedField(
- this->php_metadata_namespace().data(), static_cast<int>(this->php_metadata_namespace().length()),
+ this->_internal_php_metadata_namespace().data(), static_cast<int>(this->_internal_php_metadata_namespace().length()),
::PROTOBUF_NAMESPACE_ID::internal::WireFormat::PARSE,
"google.protobuf.FileOptions.php_metadata_namespace");
} else {
@@ -8308,9 +8244,9 @@
case 45: {
if (static_cast< ::PROTOBUF_NAMESPACE_ID::uint8>(tag) == (362 & 0xFF)) {
DO_(::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::ReadString(
- input, this->mutable_ruby_package()));
+ input, this->_internal_mutable_ruby_package()));
::PROTOBUF_NAMESPACE_ID::internal::WireFormat::VerifyUTF8StringNamedField(
- this->ruby_package().data(), static_cast<int>(this->ruby_package().length()),
+ this->_internal_ruby_package().data(), static_cast<int>(this->_internal_ruby_package().length()),
::PROTOBUF_NAMESPACE_ID::internal::WireFormat::PARSE,
"google.protobuf.FileOptions.ruby_package");
} else {
@@ -8367,21 +8303,21 @@
// optional string java_package = 1;
if (cached_has_bits & 0x00000001u) {
::PROTOBUF_NAMESPACE_ID::internal::WireFormat::VerifyUTF8StringNamedField(
- this->java_package().data(), static_cast<int>(this->java_package().length()),
+ this->_internal_java_package().data(), static_cast<int>(this->_internal_java_package().length()),
::PROTOBUF_NAMESPACE_ID::internal::WireFormat::SERIALIZE,
"google.protobuf.FileOptions.java_package");
target = stream->WriteStringMaybeAliased(
- 1, this->java_package(), target);
+ 1, this->_internal_java_package(), target);
}
// optional string java_outer_classname = 8;
if (cached_has_bits & 0x00000002u) {
::PROTOBUF_NAMESPACE_ID::internal::WireFormat::VerifyUTF8StringNamedField(
- this->java_outer_classname().data(), static_cast<int>(this->java_outer_classname().length()),
+ this->_internal_java_outer_classname().data(), static_cast<int>(this->_internal_java_outer_classname().length()),
::PROTOBUF_NAMESPACE_ID::internal::WireFormat::SERIALIZE,
"google.protobuf.FileOptions.java_outer_classname");
target = stream->WriteStringMaybeAliased(
- 8, this->java_outer_classname(), target);
+ 8, this->_internal_java_outer_classname(), target);
}
// optional .google.protobuf.FileOptions.OptimizeMode optimize_for = 9 [default = SPEED];
@@ -8400,11 +8336,11 @@
// optional string go_package = 11;
if (cached_has_bits & 0x00000004u) {
::PROTOBUF_NAMESPACE_ID::internal::WireFormat::VerifyUTF8StringNamedField(
- this->go_package().data(), static_cast<int>(this->go_package().length()),
+ this->_internal_go_package().data(), static_cast<int>(this->_internal_go_package().length()),
::PROTOBUF_NAMESPACE_ID::internal::WireFormat::SERIALIZE,
"google.protobuf.FileOptions.go_package");
target = stream->WriteStringMaybeAliased(
- 11, this->go_package(), target);
+ 11, this->_internal_go_package(), target);
}
// optional bool cc_generic_services = 16 [default = false];
@@ -8452,51 +8388,51 @@
// optional string objc_class_prefix = 36;
if (cached_has_bits & 0x00000008u) {
::PROTOBUF_NAMESPACE_ID::internal::WireFormat::VerifyUTF8StringNamedField(
- this->objc_class_prefix().data(), static_cast<int>(this->objc_class_prefix().length()),
+ this->_internal_objc_class_prefix().data(), static_cast<int>(this->_internal_objc_class_prefix().length()),
::PROTOBUF_NAMESPACE_ID::internal::WireFormat::SERIALIZE,
"google.protobuf.FileOptions.objc_class_prefix");
target = stream->WriteStringMaybeAliased(
- 36, this->objc_class_prefix(), target);
+ 36, this->_internal_objc_class_prefix(), target);
}
// optional string csharp_namespace = 37;
if (cached_has_bits & 0x00000010u) {
::PROTOBUF_NAMESPACE_ID::internal::WireFormat::VerifyUTF8StringNamedField(
- this->csharp_namespace().data(), static_cast<int>(this->csharp_namespace().length()),
+ this->_internal_csharp_namespace().data(), static_cast<int>(this->_internal_csharp_namespace().length()),
::PROTOBUF_NAMESPACE_ID::internal::WireFormat::SERIALIZE,
"google.protobuf.FileOptions.csharp_namespace");
target = stream->WriteStringMaybeAliased(
- 37, this->csharp_namespace(), target);
+ 37, this->_internal_csharp_namespace(), target);
}
// optional string swift_prefix = 39;
if (cached_has_bits & 0x00000020u) {
::PROTOBUF_NAMESPACE_ID::internal::WireFormat::VerifyUTF8StringNamedField(
- this->swift_prefix().data(), static_cast<int>(this->swift_prefix().length()),
+ this->_internal_swift_prefix().data(), static_cast<int>(this->_internal_swift_prefix().length()),
::PROTOBUF_NAMESPACE_ID::internal::WireFormat::SERIALIZE,
"google.protobuf.FileOptions.swift_prefix");
target = stream->WriteStringMaybeAliased(
- 39, this->swift_prefix(), target);
+ 39, this->_internal_swift_prefix(), target);
}
// optional string php_class_prefix = 40;
if (cached_has_bits & 0x00000040u) {
::PROTOBUF_NAMESPACE_ID::internal::WireFormat::VerifyUTF8StringNamedField(
- this->php_class_prefix().data(), static_cast<int>(this->php_class_prefix().length()),
+ this->_internal_php_class_prefix().data(), static_cast<int>(this->_internal_php_class_prefix().length()),
::PROTOBUF_NAMESPACE_ID::internal::WireFormat::SERIALIZE,
"google.protobuf.FileOptions.php_class_prefix");
target = stream->WriteStringMaybeAliased(
- 40, this->php_class_prefix(), target);
+ 40, this->_internal_php_class_prefix(), target);
}
// optional string php_namespace = 41;
if (cached_has_bits & 0x00000080u) {
::PROTOBUF_NAMESPACE_ID::internal::WireFormat::VerifyUTF8StringNamedField(
- this->php_namespace().data(), static_cast<int>(this->php_namespace().length()),
+ this->_internal_php_namespace().data(), static_cast<int>(this->_internal_php_namespace().length()),
::PROTOBUF_NAMESPACE_ID::internal::WireFormat::SERIALIZE,
"google.protobuf.FileOptions.php_namespace");
target = stream->WriteStringMaybeAliased(
- 41, this->php_namespace(), target);
+ 41, this->_internal_php_namespace(), target);
}
// optional bool php_generic_services = 42 [default = false];
@@ -8508,26 +8444,26 @@
// optional string php_metadata_namespace = 44;
if (cached_has_bits & 0x00000100u) {
::PROTOBUF_NAMESPACE_ID::internal::WireFormat::VerifyUTF8StringNamedField(
- this->php_metadata_namespace().data(), static_cast<int>(this->php_metadata_namespace().length()),
+ this->_internal_php_metadata_namespace().data(), static_cast<int>(this->_internal_php_metadata_namespace().length()),
::PROTOBUF_NAMESPACE_ID::internal::WireFormat::SERIALIZE,
"google.protobuf.FileOptions.php_metadata_namespace");
target = stream->WriteStringMaybeAliased(
- 44, this->php_metadata_namespace(), target);
+ 44, this->_internal_php_metadata_namespace(), target);
}
// optional string ruby_package = 45;
if (cached_has_bits & 0x00000200u) {
::PROTOBUF_NAMESPACE_ID::internal::WireFormat::VerifyUTF8StringNamedField(
- this->ruby_package().data(), static_cast<int>(this->ruby_package().length()),
+ this->_internal_ruby_package().data(), static_cast<int>(this->_internal_ruby_package().length()),
::PROTOBUF_NAMESPACE_ID::internal::WireFormat::SERIALIZE,
"google.protobuf.FileOptions.ruby_package");
target = stream->WriteStringMaybeAliased(
- 45, this->ruby_package(), target);
+ 45, this->_internal_ruby_package(), target);
}
// repeated .google.protobuf.UninterpretedOption uninterpreted_option = 999;
- for (auto it = this->uninterpreted_option().pointer_begin(),
- end = this->uninterpreted_option().pointer_end(); it < end; ++it) {
+ for (auto it = this->uninterpreted_option_.pointer_begin(),
+ end = this->uninterpreted_option_.pointer_end(); it < end; ++it) {
stream->EnsureSpace(&target);
target = ::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::
InternalWriteMessageToArray(999, **it, target, stream);
@@ -8556,14 +8492,10 @@
(void) cached_has_bits;
// repeated .google.protobuf.UninterpretedOption uninterpreted_option = 999;
- {
- unsigned int count = static_cast<unsigned int>(this->uninterpreted_option_size());
- total_size += 2UL * count;
- for (unsigned int i = 0; i < count; i++) {
- total_size +=
- ::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::MessageSize(
- this->uninterpreted_option(static_cast<int>(i)));
- }
+ total_size += 2UL * this->uninterpreted_option_size();
+ for (const auto& msg : this->uninterpreted_option_) {
+ total_size +=
+ ::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::MessageSize(msg);
}
cached_has_bits = _has_bits_[0];
@@ -8572,56 +8504,56 @@
if (cached_has_bits & 0x00000001u) {
total_size += 1 +
::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::StringSize(
- this->java_package());
+ this->_internal_java_package());
}
// optional string java_outer_classname = 8;
if (cached_has_bits & 0x00000002u) {
total_size += 1 +
::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::StringSize(
- this->java_outer_classname());
+ this->_internal_java_outer_classname());
}
// optional string go_package = 11;
if (cached_has_bits & 0x00000004u) {
total_size += 1 +
::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::StringSize(
- this->go_package());
+ this->_internal_go_package());
}
// optional string objc_class_prefix = 36;
if (cached_has_bits & 0x00000008u) {
total_size += 2 +
::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::StringSize(
- this->objc_class_prefix());
+ this->_internal_objc_class_prefix());
}
// optional string csharp_namespace = 37;
if (cached_has_bits & 0x00000010u) {
total_size += 2 +
::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::StringSize(
- this->csharp_namespace());
+ this->_internal_csharp_namespace());
}
// optional string swift_prefix = 39;
if (cached_has_bits & 0x00000020u) {
total_size += 2 +
::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::StringSize(
- this->swift_prefix());
+ this->_internal_swift_prefix());
}
// optional string php_class_prefix = 40;
if (cached_has_bits & 0x00000040u) {
total_size += 2 +
::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::StringSize(
- this->php_class_prefix());
+ this->_internal_php_class_prefix());
}
// optional string php_namespace = 41;
if (cached_has_bits & 0x00000080u) {
total_size += 2 +
::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::StringSize(
- this->php_namespace());
+ this->_internal_php_namespace());
}
}
@@ -8630,14 +8562,14 @@
if (cached_has_bits & 0x00000100u) {
total_size += 2 +
::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::StringSize(
- this->php_metadata_namespace());
+ this->_internal_php_metadata_namespace());
}
// optional string ruby_package = 45;
if (cached_has_bits & 0x00000200u) {
total_size += 2 +
::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::StringSize(
- this->ruby_package());
+ this->_internal_ruby_package());
}
// optional bool java_multiple_files = 10 [default = false];
@@ -8730,36 +8662,36 @@
cached_has_bits = from._has_bits_[0];
if (cached_has_bits & 0x000000ffu) {
if (cached_has_bits & 0x00000001u) {
- set_java_package(from.java_package());
+ _internal_set_java_package(from._internal_java_package());
}
if (cached_has_bits & 0x00000002u) {
- set_java_outer_classname(from.java_outer_classname());
+ _internal_set_java_outer_classname(from._internal_java_outer_classname());
}
if (cached_has_bits & 0x00000004u) {
- set_go_package(from.go_package());
+ _internal_set_go_package(from._internal_go_package());
}
if (cached_has_bits & 0x00000008u) {
- set_objc_class_prefix(from.objc_class_prefix());
+ _internal_set_objc_class_prefix(from._internal_objc_class_prefix());
}
if (cached_has_bits & 0x00000010u) {
- set_csharp_namespace(from.csharp_namespace());
+ _internal_set_csharp_namespace(from._internal_csharp_namespace());
}
if (cached_has_bits & 0x00000020u) {
- set_swift_prefix(from.swift_prefix());
+ _internal_set_swift_prefix(from._internal_swift_prefix());
}
if (cached_has_bits & 0x00000040u) {
- set_php_class_prefix(from.php_class_prefix());
+ _internal_set_php_class_prefix(from._internal_php_class_prefix());
}
if (cached_has_bits & 0x00000080u) {
- set_php_namespace(from.php_namespace());
+ _internal_set_php_namespace(from._internal_php_namespace());
}
}
if (cached_has_bits & 0x0000ff00u) {
if (cached_has_bits & 0x00000100u) {
- set_php_metadata_namespace(from.php_metadata_namespace());
+ _internal_set_php_metadata_namespace(from._internal_php_metadata_namespace());
}
if (cached_has_bits & 0x00000200u) {
- set_ruby_package(from.ruby_package());
+ _internal_set_ruby_package(from._internal_ruby_package());
}
if (cached_has_bits & 0x00000400u) {
java_multiple_files_ = from.java_multiple_files_;
@@ -8826,7 +8758,7 @@
_extensions_.Swap(&other->_extensions_);
_internal_metadata_.Swap(&other->_internal_metadata_);
swap(_has_bits_[0], other->_has_bits_[0]);
- CastToBase(&uninterpreted_option_)->InternalSwap(CastToBase(&other->uninterpreted_option_));
+ uninterpreted_option_.InternalSwap(&other->uninterpreted_option_);
java_package_.Swap(&other->java_package_, &::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(),
GetArenaNoVirtual());
java_outer_classname_.Swap(&other->java_outer_classname_, &::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(),
@@ -9009,7 +8941,7 @@
ptr = ctx->ParseMessage(add_uninterpreted_option(), ptr);
CHK_(ptr);
if (!ctx->DataAvailable(ptr)) break;
- } while (::PROTOBUF_NAMESPACE_ID::internal::UnalignedLoad<::PROTOBUF_NAMESPACE_ID::uint16>(ptr) == 16058);
+ } while (::PROTOBUF_NAMESPACE_ID::internal::ExpectTag<7994>(ptr));
} else goto handle_unusual;
continue;
default: {
@@ -9171,8 +9103,8 @@
}
// repeated .google.protobuf.UninterpretedOption uninterpreted_option = 999;
- for (auto it = this->uninterpreted_option().pointer_begin(),
- end = this->uninterpreted_option().pointer_end(); it < end; ++it) {
+ for (auto it = this->uninterpreted_option_.pointer_begin(),
+ end = this->uninterpreted_option_.pointer_end(); it < end; ++it) {
stream->EnsureSpace(&target);
target = ::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::
InternalWriteMessageToArray(999, **it, target, stream);
@@ -9201,14 +9133,10 @@
(void) cached_has_bits;
// repeated .google.protobuf.UninterpretedOption uninterpreted_option = 999;
- {
- unsigned int count = static_cast<unsigned int>(this->uninterpreted_option_size());
- total_size += 2UL * count;
- for (unsigned int i = 0; i < count; i++) {
- total_size +=
- ::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::MessageSize(
- this->uninterpreted_option(static_cast<int>(i)));
- }
+ total_size += 2UL * this->uninterpreted_option_size();
+ for (const auto& msg : this->uninterpreted_option_) {
+ total_size +=
+ ::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::MessageSize(msg);
}
cached_has_bits = _has_bits_[0];
@@ -9313,7 +9241,7 @@
_extensions_.Swap(&other->_extensions_);
_internal_metadata_.Swap(&other->_internal_metadata_);
swap(_has_bits_[0], other->_has_bits_[0]);
- CastToBase(&uninterpreted_option_)->InternalSwap(CastToBase(&other->uninterpreted_option_));
+ uninterpreted_option_.InternalSwap(&other->uninterpreted_option_);
swap(message_set_wire_format_, other->message_set_wire_format_);
swap(no_standard_descriptor_accessor_, other->no_standard_descriptor_accessor_);
swap(deprecated_, other->deprecated_);
@@ -9503,7 +9431,7 @@
ptr = ctx->ParseMessage(add_uninterpreted_option(), ptr);
CHK_(ptr);
if (!ctx->DataAvailable(ptr)) break;
- } while (::PROTOBUF_NAMESPACE_ID::internal::UnalignedLoad<::PROTOBUF_NAMESPACE_ID::uint16>(ptr) == 16058);
+ } while (::PROTOBUF_NAMESPACE_ID::internal::ExpectTag<7994>(ptr));
} else goto handle_unusual;
continue;
default: {
@@ -9717,8 +9645,8 @@
}
// repeated .google.protobuf.UninterpretedOption uninterpreted_option = 999;
- for (auto it = this->uninterpreted_option().pointer_begin(),
- end = this->uninterpreted_option().pointer_end(); it < end; ++it) {
+ for (auto it = this->uninterpreted_option_.pointer_begin(),
+ end = this->uninterpreted_option_.pointer_end(); it < end; ++it) {
stream->EnsureSpace(&target);
target = ::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::
InternalWriteMessageToArray(999, **it, target, stream);
@@ -9747,14 +9675,10 @@
(void) cached_has_bits;
// repeated .google.protobuf.UninterpretedOption uninterpreted_option = 999;
- {
- unsigned int count = static_cast<unsigned int>(this->uninterpreted_option_size());
- total_size += 2UL * count;
- for (unsigned int i = 0; i < count; i++) {
- total_size +=
- ::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::MessageSize(
- this->uninterpreted_option(static_cast<int>(i)));
- }
+ total_size += 2UL * this->uninterpreted_option_size();
+ for (const auto& msg : this->uninterpreted_option_) {
+ total_size +=
+ ::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::MessageSize(msg);
}
cached_has_bits = _has_bits_[0];
@@ -9877,7 +9801,7 @@
_extensions_.Swap(&other->_extensions_);
_internal_metadata_.Swap(&other->_internal_metadata_);
swap(_has_bits_[0], other->_has_bits_[0]);
- CastToBase(&uninterpreted_option_)->InternalSwap(CastToBase(&other->uninterpreted_option_));
+ uninterpreted_option_.InternalSwap(&other->uninterpreted_option_);
swap(ctype_, other->ctype_);
swap(packed_, other->packed_);
swap(lazy_, other->lazy_);
@@ -9982,7 +9906,7 @@
ptr = ctx->ParseMessage(add_uninterpreted_option(), ptr);
CHK_(ptr);
if (!ctx->DataAvailable(ptr)) break;
- } while (::PROTOBUF_NAMESPACE_ID::internal::UnalignedLoad<::PROTOBUF_NAMESPACE_ID::uint16>(ptr) == 16058);
+ } while (::PROTOBUF_NAMESPACE_ID::internal::ExpectTag<7994>(ptr));
} else goto handle_unusual;
continue;
default: {
@@ -10066,8 +9990,8 @@
(void) cached_has_bits;
// repeated .google.protobuf.UninterpretedOption uninterpreted_option = 999;
- for (auto it = this->uninterpreted_option().pointer_begin(),
- end = this->uninterpreted_option().pointer_end(); it < end; ++it) {
+ for (auto it = this->uninterpreted_option_.pointer_begin(),
+ end = this->uninterpreted_option_.pointer_end(); it < end; ++it) {
stream->EnsureSpace(&target);
target = ::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::
InternalWriteMessageToArray(999, **it, target, stream);
@@ -10096,14 +10020,10 @@
(void) cached_has_bits;
// repeated .google.protobuf.UninterpretedOption uninterpreted_option = 999;
- {
- unsigned int count = static_cast<unsigned int>(this->uninterpreted_option_size());
- total_size += 2UL * count;
- for (unsigned int i = 0; i < count; i++) {
- total_size +=
- ::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::MessageSize(
- this->uninterpreted_option(static_cast<int>(i)));
- }
+ total_size += 2UL * this->uninterpreted_option_size();
+ for (const auto& msg : this->uninterpreted_option_) {
+ total_size +=
+ ::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::MessageSize(msg);
}
if (PROTOBUF_PREDICT_FALSE(_internal_metadata_.have_unknown_fields())) {
@@ -10169,7 +10089,7 @@
_extensions_.Swap(&other->_extensions_);
_internal_metadata_.Swap(&other->_internal_metadata_);
swap(_has_bits_[0], other->_has_bits_[0]);
- CastToBase(&uninterpreted_option_)->InternalSwap(CastToBase(&other->uninterpreted_option_));
+ uninterpreted_option_.InternalSwap(&other->uninterpreted_option_);
}
::PROTOBUF_NAMESPACE_ID::Metadata OneofOptions::GetMetadata() const {
@@ -10300,7 +10220,7 @@
ptr = ctx->ParseMessage(add_uninterpreted_option(), ptr);
CHK_(ptr);
if (!ctx->DataAvailable(ptr)) break;
- } while (::PROTOBUF_NAMESPACE_ID::internal::UnalignedLoad<::PROTOBUF_NAMESPACE_ID::uint16>(ptr) == 16058);
+ } while (::PROTOBUF_NAMESPACE_ID::internal::ExpectTag<7994>(ptr));
} else goto handle_unusual;
continue;
default: {
@@ -10424,8 +10344,8 @@
}
// repeated .google.protobuf.UninterpretedOption uninterpreted_option = 999;
- for (auto it = this->uninterpreted_option().pointer_begin(),
- end = this->uninterpreted_option().pointer_end(); it < end; ++it) {
+ for (auto it = this->uninterpreted_option_.pointer_begin(),
+ end = this->uninterpreted_option_.pointer_end(); it < end; ++it) {
stream->EnsureSpace(&target);
target = ::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::
InternalWriteMessageToArray(999, **it, target, stream);
@@ -10454,14 +10374,10 @@
(void) cached_has_bits;
// repeated .google.protobuf.UninterpretedOption uninterpreted_option = 999;
- {
- unsigned int count = static_cast<unsigned int>(this->uninterpreted_option_size());
- total_size += 2UL * count;
- for (unsigned int i = 0; i < count; i++) {
- total_size +=
- ::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::MessageSize(
- this->uninterpreted_option(static_cast<int>(i)));
- }
+ total_size += 2UL * this->uninterpreted_option_size();
+ for (const auto& msg : this->uninterpreted_option_) {
+ total_size +=
+ ::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::MessageSize(msg);
}
cached_has_bits = _has_bits_[0];
@@ -10550,7 +10466,7 @@
_extensions_.Swap(&other->_extensions_);
_internal_metadata_.Swap(&other->_internal_metadata_);
swap(_has_bits_[0], other->_has_bits_[0]);
- CastToBase(&uninterpreted_option_)->InternalSwap(CastToBase(&other->uninterpreted_option_));
+ uninterpreted_option_.InternalSwap(&other->uninterpreted_option_);
swap(allow_alias_, other->allow_alias_);
swap(deprecated_, other->deprecated_);
}
@@ -10666,7 +10582,7 @@
ptr = ctx->ParseMessage(add_uninterpreted_option(), ptr);
CHK_(ptr);
if (!ctx->DataAvailable(ptr)) break;
- } while (::PROTOBUF_NAMESPACE_ID::internal::UnalignedLoad<::PROTOBUF_NAMESPACE_ID::uint16>(ptr) == 16058);
+ } while (::PROTOBUF_NAMESPACE_ID::internal::ExpectTag<7994>(ptr));
} else goto handle_unusual;
continue;
default: {
@@ -10771,8 +10687,8 @@
}
// repeated .google.protobuf.UninterpretedOption uninterpreted_option = 999;
- for (auto it = this->uninterpreted_option().pointer_begin(),
- end = this->uninterpreted_option().pointer_end(); it < end; ++it) {
+ for (auto it = this->uninterpreted_option_.pointer_begin(),
+ end = this->uninterpreted_option_.pointer_end(); it < end; ++it) {
stream->EnsureSpace(&target);
target = ::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::
InternalWriteMessageToArray(999, **it, target, stream);
@@ -10801,14 +10717,10 @@
(void) cached_has_bits;
// repeated .google.protobuf.UninterpretedOption uninterpreted_option = 999;
- {
- unsigned int count = static_cast<unsigned int>(this->uninterpreted_option_size());
- total_size += 2UL * count;
- for (unsigned int i = 0; i < count; i++) {
- total_size +=
- ::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::MessageSize(
- this->uninterpreted_option(static_cast<int>(i)));
- }
+ total_size += 2UL * this->uninterpreted_option_size();
+ for (const auto& msg : this->uninterpreted_option_) {
+ total_size +=
+ ::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::MessageSize(msg);
}
// optional bool deprecated = 1 [default = false];
@@ -10883,7 +10795,7 @@
_extensions_.Swap(&other->_extensions_);
_internal_metadata_.Swap(&other->_internal_metadata_);
swap(_has_bits_[0], other->_has_bits_[0]);
- CastToBase(&uninterpreted_option_)->InternalSwap(CastToBase(&other->uninterpreted_option_));
+ uninterpreted_option_.InternalSwap(&other->uninterpreted_option_);
swap(deprecated_, other->deprecated_);
}
@@ -10998,7 +10910,7 @@
ptr = ctx->ParseMessage(add_uninterpreted_option(), ptr);
CHK_(ptr);
if (!ctx->DataAvailable(ptr)) break;
- } while (::PROTOBUF_NAMESPACE_ID::internal::UnalignedLoad<::PROTOBUF_NAMESPACE_ID::uint16>(ptr) == 16058);
+ } while (::PROTOBUF_NAMESPACE_ID::internal::ExpectTag<7994>(ptr));
} else goto handle_unusual;
continue;
default: {
@@ -11103,8 +11015,8 @@
}
// repeated .google.protobuf.UninterpretedOption uninterpreted_option = 999;
- for (auto it = this->uninterpreted_option().pointer_begin(),
- end = this->uninterpreted_option().pointer_end(); it < end; ++it) {
+ for (auto it = this->uninterpreted_option_.pointer_begin(),
+ end = this->uninterpreted_option_.pointer_end(); it < end; ++it) {
stream->EnsureSpace(&target);
target = ::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::
InternalWriteMessageToArray(999, **it, target, stream);
@@ -11133,14 +11045,10 @@
(void) cached_has_bits;
// repeated .google.protobuf.UninterpretedOption uninterpreted_option = 999;
- {
- unsigned int count = static_cast<unsigned int>(this->uninterpreted_option_size());
- total_size += 2UL * count;
- for (unsigned int i = 0; i < count; i++) {
- total_size +=
- ::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::MessageSize(
- this->uninterpreted_option(static_cast<int>(i)));
- }
+ total_size += 2UL * this->uninterpreted_option_size();
+ for (const auto& msg : this->uninterpreted_option_) {
+ total_size +=
+ ::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::MessageSize(msg);
}
// optional bool deprecated = 33 [default = false];
@@ -11215,7 +11123,7 @@
_extensions_.Swap(&other->_extensions_);
_internal_metadata_.Swap(&other->_internal_metadata_);
swap(_has_bits_[0], other->_has_bits_[0]);
- CastToBase(&uninterpreted_option_)->InternalSwap(CastToBase(&other->uninterpreted_option_));
+ uninterpreted_option_.InternalSwap(&other->uninterpreted_option_);
swap(deprecated_, other->deprecated_);
}
@@ -11354,7 +11262,7 @@
ptr = ctx->ParseMessage(add_uninterpreted_option(), ptr);
CHK_(ptr);
if (!ctx->DataAvailable(ptr)) break;
- } while (::PROTOBUF_NAMESPACE_ID::internal::UnalignedLoad<::PROTOBUF_NAMESPACE_ID::uint16>(ptr) == 16058);
+ } while (::PROTOBUF_NAMESPACE_ID::internal::ExpectTag<7994>(ptr));
} else goto handle_unusual;
continue;
default: {
@@ -11485,8 +11393,8 @@
}
// repeated .google.protobuf.UninterpretedOption uninterpreted_option = 999;
- for (auto it = this->uninterpreted_option().pointer_begin(),
- end = this->uninterpreted_option().pointer_end(); it < end; ++it) {
+ for (auto it = this->uninterpreted_option_.pointer_begin(),
+ end = this->uninterpreted_option_.pointer_end(); it < end; ++it) {
stream->EnsureSpace(&target);
target = ::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::
InternalWriteMessageToArray(999, **it, target, stream);
@@ -11515,14 +11423,10 @@
(void) cached_has_bits;
// repeated .google.protobuf.UninterpretedOption uninterpreted_option = 999;
- {
- unsigned int count = static_cast<unsigned int>(this->uninterpreted_option_size());
- total_size += 2UL * count;
- for (unsigned int i = 0; i < count; i++) {
- total_size +=
- ::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::MessageSize(
- this->uninterpreted_option(static_cast<int>(i)));
- }
+ total_size += 2UL * this->uninterpreted_option_size();
+ for (const auto& msg : this->uninterpreted_option_) {
+ total_size +=
+ ::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::MessageSize(msg);
}
cached_has_bits = _has_bits_[0];
@@ -11612,7 +11516,7 @@
_extensions_.Swap(&other->_extensions_);
_internal_metadata_.Swap(&other->_internal_metadata_);
swap(_has_bits_[0], other->_has_bits_[0]);
- CastToBase(&uninterpreted_option_)->InternalSwap(CastToBase(&other->uninterpreted_option_));
+ uninterpreted_option_.InternalSwap(&other->uninterpreted_option_);
swap(deprecated_, other->deprecated_);
swap(idempotency_level_, other->idempotency_level_);
}
@@ -11655,8 +11559,8 @@
_has_bits_(from._has_bits_) {
_internal_metadata_.MergeFrom(from._internal_metadata_);
name_part_.UnsafeSetDefault(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited());
- if (from.has_name_part()) {
- name_part_.Set(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(), from.name_part(),
+ if (from._internal_has_name_part()) {
+ name_part_.Set(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(), from._internal_name_part(),
GetArenaNoVirtual());
}
is_extension_ = from.is_extension_;
@@ -11722,7 +11626,7 @@
// required string name_part = 1;
case 1:
if (PROTOBUF_PREDICT_TRUE(static_cast<::PROTOBUF_NAMESPACE_ID::uint8>(tag) == 10)) {
- ptr = ::PROTOBUF_NAMESPACE_ID::internal::InlineGreedyStringParserUTF8Verify(mutable_name_part(), ptr, ctx, "google.protobuf.UninterpretedOption.NamePart.name_part");
+ ptr = ::PROTOBUF_NAMESPACE_ID::internal::InlineGreedyStringParserUTF8Verify(_internal_mutable_name_part(), ptr, ctx, "google.protobuf.UninterpretedOption.NamePart.name_part");
CHK_(ptr);
} else goto handle_unusual;
continue;
@@ -11769,9 +11673,9 @@
case 1: {
if (static_cast< ::PROTOBUF_NAMESPACE_ID::uint8>(tag) == (10 & 0xFF)) {
DO_(::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::ReadString(
- input, this->mutable_name_part()));
+ input, this->_internal_mutable_name_part()));
::PROTOBUF_NAMESPACE_ID::internal::WireFormat::VerifyUTF8StringNamedField(
- this->name_part().data(), static_cast<int>(this->name_part().length()),
+ this->_internal_name_part().data(), static_cast<int>(this->_internal_name_part().length()),
::PROTOBUF_NAMESPACE_ID::internal::WireFormat::PARSE,
"google.protobuf.UninterpretedOption.NamePart.name_part");
} else {
@@ -11824,11 +11728,11 @@
// required string name_part = 1;
if (cached_has_bits & 0x00000001u) {
::PROTOBUF_NAMESPACE_ID::internal::WireFormat::VerifyUTF8StringNamedField(
- this->name_part().data(), static_cast<int>(this->name_part().length()),
+ this->_internal_name_part().data(), static_cast<int>(this->_internal_name_part().length()),
::PROTOBUF_NAMESPACE_ID::internal::WireFormat::SERIALIZE,
"google.protobuf.UninterpretedOption.NamePart.name_part");
target = stream->WriteStringMaybeAliased(
- 1, this->name_part(), target);
+ 1, this->_internal_name_part(), target);
}
// required bool is_extension = 2;
@@ -11853,7 +11757,7 @@
// required string name_part = 1;
total_size += 1 +
::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::StringSize(
- this->name_part());
+ this->_internal_name_part());
}
if (has_is_extension()) {
@@ -11871,7 +11775,7 @@
// required string name_part = 1;
total_size += 1 +
::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::StringSize(
- this->name_part());
+ this->_internal_name_part());
// required bool is_extension = 2;
total_size += 1 + 1;
@@ -11917,7 +11821,7 @@
cached_has_bits = from._has_bits_[0];
if (cached_has_bits & 0x00000003u) {
if (cached_has_bits & 0x00000001u) {
- set_name_part(from.name_part());
+ _internal_set_name_part(from._internal_name_part());
}
if (cached_has_bits & 0x00000002u) {
is_extension_ = from.is_extension_;
@@ -12006,18 +11910,18 @@
name_(from.name_) {
_internal_metadata_.MergeFrom(from._internal_metadata_);
identifier_value_.UnsafeSetDefault(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited());
- if (from.has_identifier_value()) {
- identifier_value_.Set(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(), from.identifier_value(),
+ if (from._internal_has_identifier_value()) {
+ identifier_value_.Set(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(), from._internal_identifier_value(),
GetArenaNoVirtual());
}
string_value_.UnsafeSetDefault(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited());
- if (from.has_string_value()) {
- string_value_.Set(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(), from.string_value(),
+ if (from._internal_has_string_value()) {
+ string_value_.Set(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(), from._internal_string_value(),
GetArenaNoVirtual());
}
aggregate_value_.UnsafeSetDefault(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited());
- if (from.has_aggregate_value()) {
- aggregate_value_.Set(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(), from.aggregate_value(),
+ if (from._internal_has_aggregate_value()) {
+ aggregate_value_.Set(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(), from._internal_aggregate_value(),
GetArenaNoVirtual());
}
::memcpy(&positive_int_value_, &from.positive_int_value_,
@@ -12110,13 +12014,13 @@
ptr = ctx->ParseMessage(add_name(), ptr);
CHK_(ptr);
if (!ctx->DataAvailable(ptr)) break;
- } while (::PROTOBUF_NAMESPACE_ID::internal::UnalignedLoad<::PROTOBUF_NAMESPACE_ID::uint8>(ptr) == 18);
+ } while (::PROTOBUF_NAMESPACE_ID::internal::ExpectTag<18>(ptr));
} else goto handle_unusual;
continue;
// optional string identifier_value = 3;
case 3:
if (PROTOBUF_PREDICT_TRUE(static_cast<::PROTOBUF_NAMESPACE_ID::uint8>(tag) == 26)) {
- ptr = ::PROTOBUF_NAMESPACE_ID::internal::InlineGreedyStringParserUTF8Verify(mutable_identifier_value(), ptr, ctx, "google.protobuf.UninterpretedOption.identifier_value");
+ ptr = ::PROTOBUF_NAMESPACE_ID::internal::InlineGreedyStringParserUTF8Verify(_internal_mutable_identifier_value(), ptr, ctx, "google.protobuf.UninterpretedOption.identifier_value");
CHK_(ptr);
} else goto handle_unusual;
continue;
@@ -12147,14 +12051,14 @@
// optional bytes string_value = 7;
case 7:
if (PROTOBUF_PREDICT_TRUE(static_cast<::PROTOBUF_NAMESPACE_ID::uint8>(tag) == 58)) {
- ptr = ::PROTOBUF_NAMESPACE_ID::internal::InlineGreedyStringParser(mutable_string_value(), ptr, ctx);
+ ptr = ::PROTOBUF_NAMESPACE_ID::internal::InlineGreedyStringParser(_internal_mutable_string_value(), ptr, ctx);
CHK_(ptr);
} else goto handle_unusual;
continue;
// optional string aggregate_value = 8;
case 8:
if (PROTOBUF_PREDICT_TRUE(static_cast<::PROTOBUF_NAMESPACE_ID::uint8>(tag) == 66)) {
- ptr = ::PROTOBUF_NAMESPACE_ID::internal::InlineGreedyStringParserUTF8Verify(mutable_aggregate_value(), ptr, ctx, "google.protobuf.UninterpretedOption.aggregate_value");
+ ptr = ::PROTOBUF_NAMESPACE_ID::internal::InlineGreedyStringParserUTF8Verify(_internal_mutable_aggregate_value(), ptr, ctx, "google.protobuf.UninterpretedOption.aggregate_value");
CHK_(ptr);
} else goto handle_unusual;
continue;
@@ -12204,9 +12108,9 @@
case 3: {
if (static_cast< ::PROTOBUF_NAMESPACE_ID::uint8>(tag) == (26 & 0xFF)) {
DO_(::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::ReadString(
- input, this->mutable_identifier_value()));
+ input, this->_internal_mutable_identifier_value()));
::PROTOBUF_NAMESPACE_ID::internal::WireFormat::VerifyUTF8StringNamedField(
- this->identifier_value().data(), static_cast<int>(this->identifier_value().length()),
+ this->_internal_identifier_value().data(), static_cast<int>(this->_internal_identifier_value().length()),
::PROTOBUF_NAMESPACE_ID::internal::WireFormat::PARSE,
"google.protobuf.UninterpretedOption.identifier_value");
} else {
@@ -12258,7 +12162,7 @@
case 7: {
if (static_cast< ::PROTOBUF_NAMESPACE_ID::uint8>(tag) == (58 & 0xFF)) {
DO_(::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::ReadBytes(
- input, this->mutable_string_value()));
+ input, this->_internal_mutable_string_value()));
} else {
goto handle_unusual;
}
@@ -12269,9 +12173,9 @@
case 8: {
if (static_cast< ::PROTOBUF_NAMESPACE_ID::uint8>(tag) == (66 & 0xFF)) {
DO_(::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::ReadString(
- input, this->mutable_aggregate_value()));
+ input, this->_internal_mutable_aggregate_value()));
::PROTOBUF_NAMESPACE_ID::internal::WireFormat::VerifyUTF8StringNamedField(
- this->aggregate_value().data(), static_cast<int>(this->aggregate_value().length()),
+ this->_internal_aggregate_value().data(), static_cast<int>(this->_internal_aggregate_value().length()),
::PROTOBUF_NAMESPACE_ID::internal::WireFormat::PARSE,
"google.protobuf.UninterpretedOption.aggregate_value");
} else {
@@ -12308,8 +12212,8 @@
(void) cached_has_bits;
// repeated .google.protobuf.UninterpretedOption.NamePart name = 2;
- for (auto it = this->name().pointer_begin(),
- end = this->name().pointer_end(); it < end; ++it) {
+ for (auto it = this->name_.pointer_begin(),
+ end = this->name_.pointer_end(); it < end; ++it) {
stream->EnsureSpace(&target);
target = ::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::
InternalWriteMessageToArray(2, **it, target, stream);
@@ -12319,11 +12223,11 @@
// optional string identifier_value = 3;
if (cached_has_bits & 0x00000001u) {
::PROTOBUF_NAMESPACE_ID::internal::WireFormat::VerifyUTF8StringNamedField(
- this->identifier_value().data(), static_cast<int>(this->identifier_value().length()),
+ this->_internal_identifier_value().data(), static_cast<int>(this->_internal_identifier_value().length()),
::PROTOBUF_NAMESPACE_ID::internal::WireFormat::SERIALIZE,
"google.protobuf.UninterpretedOption.identifier_value");
target = stream->WriteStringMaybeAliased(
- 3, this->identifier_value(), target);
+ 3, this->_internal_identifier_value(), target);
}
// optional uint64 positive_int_value = 4;
@@ -12347,17 +12251,17 @@
// optional bytes string_value = 7;
if (cached_has_bits & 0x00000002u) {
target = stream->WriteBytesMaybeAliased(
- 7, this->string_value(), target);
+ 7, this->_internal_string_value(), target);
}
// optional string aggregate_value = 8;
if (cached_has_bits & 0x00000004u) {
::PROTOBUF_NAMESPACE_ID::internal::WireFormat::VerifyUTF8StringNamedField(
- this->aggregate_value().data(), static_cast<int>(this->aggregate_value().length()),
+ this->_internal_aggregate_value().data(), static_cast<int>(this->_internal_aggregate_value().length()),
::PROTOBUF_NAMESPACE_ID::internal::WireFormat::SERIALIZE,
"google.protobuf.UninterpretedOption.aggregate_value");
target = stream->WriteStringMaybeAliased(
- 8, this->aggregate_value(), target);
+ 8, this->_internal_aggregate_value(), target);
}
if (PROTOBUF_PREDICT_FALSE(_internal_metadata_.have_unknown_fields())) {
@@ -12377,14 +12281,10 @@
(void) cached_has_bits;
// repeated .google.protobuf.UninterpretedOption.NamePart name = 2;
- {
- unsigned int count = static_cast<unsigned int>(this->name_size());
- total_size += 1UL * count;
- for (unsigned int i = 0; i < count; i++) {
- total_size +=
- ::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::MessageSize(
- this->name(static_cast<int>(i)));
- }
+ total_size += 1UL * this->name_size();
+ for (const auto& msg : this->name_) {
+ total_size +=
+ ::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::MessageSize(msg);
}
cached_has_bits = _has_bits_[0];
@@ -12393,21 +12293,21 @@
if (cached_has_bits & 0x00000001u) {
total_size += 1 +
::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::StringSize(
- this->identifier_value());
+ this->_internal_identifier_value());
}
// optional bytes string_value = 7;
if (cached_has_bits & 0x00000002u) {
total_size += 1 +
::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::BytesSize(
- this->string_value());
+ this->_internal_string_value());
}
// optional string aggregate_value = 8;
if (cached_has_bits & 0x00000004u) {
total_size += 1 +
::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::StringSize(
- this->aggregate_value());
+ this->_internal_aggregate_value());
}
// optional uint64 positive_int_value = 4;
@@ -12465,13 +12365,13 @@
cached_has_bits = from._has_bits_[0];
if (cached_has_bits & 0x0000003fu) {
if (cached_has_bits & 0x00000001u) {
- set_identifier_value(from.identifier_value());
+ _internal_set_identifier_value(from._internal_identifier_value());
}
if (cached_has_bits & 0x00000002u) {
- set_string_value(from.string_value());
+ _internal_set_string_value(from._internal_string_value());
}
if (cached_has_bits & 0x00000004u) {
- set_aggregate_value(from.aggregate_value());
+ _internal_set_aggregate_value(from._internal_aggregate_value());
}
if (cached_has_bits & 0x00000008u) {
positive_int_value_ = from.positive_int_value_;
@@ -12509,7 +12409,7 @@
using std::swap;
_internal_metadata_.Swap(&other->_internal_metadata_);
swap(_has_bits_[0], other->_has_bits_[0]);
- CastToBase(&name_)->InternalSwap(CastToBase(&other->name_));
+ name_.InternalSwap(&other->name_);
identifier_value_.Swap(&other->identifier_value_, &::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(),
GetArenaNoVirtual());
string_value_.Swap(&other->string_value_, &::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(),
@@ -12565,13 +12465,13 @@
leading_detached_comments_(from.leading_detached_comments_) {
_internal_metadata_.MergeFrom(from._internal_metadata_);
leading_comments_.UnsafeSetDefault(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited());
- if (from.has_leading_comments()) {
- leading_comments_.Set(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(), from.leading_comments(),
+ if (from._internal_has_leading_comments()) {
+ leading_comments_.Set(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(), from._internal_leading_comments(),
GetArenaNoVirtual());
}
trailing_comments_.UnsafeSetDefault(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited());
- if (from.has_trailing_comments()) {
- trailing_comments_.Set(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(), from.trailing_comments(),
+ if (from._internal_has_trailing_comments()) {
+ trailing_comments_.Set(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(), from._internal_trailing_comments(),
GetArenaNoVirtual());
}
// @@protoc_insertion_point(copy_constructor:google.protobuf.SourceCodeInfo.Location)
@@ -12664,14 +12564,14 @@
// optional string leading_comments = 3;
case 3:
if (PROTOBUF_PREDICT_TRUE(static_cast<::PROTOBUF_NAMESPACE_ID::uint8>(tag) == 26)) {
- ptr = ::PROTOBUF_NAMESPACE_ID::internal::InlineGreedyStringParserUTF8Verify(mutable_leading_comments(), ptr, ctx, "google.protobuf.SourceCodeInfo.Location.leading_comments");
+ ptr = ::PROTOBUF_NAMESPACE_ID::internal::InlineGreedyStringParserUTF8Verify(_internal_mutable_leading_comments(), ptr, ctx, "google.protobuf.SourceCodeInfo.Location.leading_comments");
CHK_(ptr);
} else goto handle_unusual;
continue;
// optional string trailing_comments = 4;
case 4:
if (PROTOBUF_PREDICT_TRUE(static_cast<::PROTOBUF_NAMESPACE_ID::uint8>(tag) == 34)) {
- ptr = ::PROTOBUF_NAMESPACE_ID::internal::InlineGreedyStringParserUTF8Verify(mutable_trailing_comments(), ptr, ctx, "google.protobuf.SourceCodeInfo.Location.trailing_comments");
+ ptr = ::PROTOBUF_NAMESPACE_ID::internal::InlineGreedyStringParserUTF8Verify(_internal_mutable_trailing_comments(), ptr, ctx, "google.protobuf.SourceCodeInfo.Location.trailing_comments");
CHK_(ptr);
} else goto handle_unusual;
continue;
@@ -12681,10 +12581,10 @@
ptr -= 1;
do {
ptr += 1;
- ptr = ::PROTOBUF_NAMESPACE_ID::internal::InlineGreedyStringParserUTF8Verify(add_leading_detached_comments(), ptr, ctx, "google.protobuf.SourceCodeInfo.Location.leading_detached_comments");
+ ptr = ::PROTOBUF_NAMESPACE_ID::internal::InlineGreedyStringParserUTF8Verify(_internal_add_leading_detached_comments(), ptr, ctx, "google.protobuf.SourceCodeInfo.Location.leading_detached_comments");
CHK_(ptr);
if (!ctx->DataAvailable(ptr)) break;
- } while (::PROTOBUF_NAMESPACE_ID::internal::UnalignedLoad<::PROTOBUF_NAMESPACE_ID::uint8>(ptr) == 50);
+ } while (::PROTOBUF_NAMESPACE_ID::internal::ExpectTag<50>(ptr));
} else goto handle_unusual;
continue;
default: {
@@ -12754,9 +12654,9 @@
case 3: {
if (static_cast< ::PROTOBUF_NAMESPACE_ID::uint8>(tag) == (26 & 0xFF)) {
DO_(::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::ReadString(
- input, this->mutable_leading_comments()));
+ input, this->_internal_mutable_leading_comments()));
::PROTOBUF_NAMESPACE_ID::internal::WireFormat::VerifyUTF8StringNamedField(
- this->leading_comments().data(), static_cast<int>(this->leading_comments().length()),
+ this->_internal_leading_comments().data(), static_cast<int>(this->_internal_leading_comments().length()),
::PROTOBUF_NAMESPACE_ID::internal::WireFormat::PARSE,
"google.protobuf.SourceCodeInfo.Location.leading_comments");
} else {
@@ -12769,9 +12669,9 @@
case 4: {
if (static_cast< ::PROTOBUF_NAMESPACE_ID::uint8>(tag) == (34 & 0xFF)) {
DO_(::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::ReadString(
- input, this->mutable_trailing_comments()));
+ input, this->_internal_mutable_trailing_comments()));
::PROTOBUF_NAMESPACE_ID::internal::WireFormat::VerifyUTF8StringNamedField(
- this->trailing_comments().data(), static_cast<int>(this->trailing_comments().length()),
+ this->_internal_trailing_comments().data(), static_cast<int>(this->_internal_trailing_comments().length()),
::PROTOBUF_NAMESPACE_ID::internal::WireFormat::PARSE,
"google.protobuf.SourceCodeInfo.Location.trailing_comments");
} else {
@@ -12784,10 +12684,10 @@
case 6: {
if (static_cast< ::PROTOBUF_NAMESPACE_ID::uint8>(tag) == (50 & 0xFF)) {
DO_(::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::ReadString(
- input, this->add_leading_detached_comments()));
+ input, this->_internal_add_leading_detached_comments()));
::PROTOBUF_NAMESPACE_ID::internal::WireFormat::VerifyUTF8StringNamedField(
- this->leading_detached_comments(this->leading_detached_comments_size() - 1).data(),
- static_cast<int>(this->leading_detached_comments(this->leading_detached_comments_size() - 1).length()),
+ leading_detached_comments_.Get(leading_detached_comments_.size() - 1).data(),
+ static_cast<int>(leading_detached_comments_.Get(leading_detached_comments_.size() - 1).length()),
::PROTOBUF_NAMESPACE_ID::internal::WireFormat::PARSE,
"google.protobuf.SourceCodeInfo.Location.leading_detached_comments");
} else {
@@ -12845,26 +12745,26 @@
// optional string leading_comments = 3;
if (cached_has_bits & 0x00000001u) {
::PROTOBUF_NAMESPACE_ID::internal::WireFormat::VerifyUTF8StringNamedField(
- this->leading_comments().data(), static_cast<int>(this->leading_comments().length()),
+ this->_internal_leading_comments().data(), static_cast<int>(this->_internal_leading_comments().length()),
::PROTOBUF_NAMESPACE_ID::internal::WireFormat::SERIALIZE,
"google.protobuf.SourceCodeInfo.Location.leading_comments");
target = stream->WriteStringMaybeAliased(
- 3, this->leading_comments(), target);
+ 3, this->_internal_leading_comments(), target);
}
// optional string trailing_comments = 4;
if (cached_has_bits & 0x00000002u) {
::PROTOBUF_NAMESPACE_ID::internal::WireFormat::VerifyUTF8StringNamedField(
- this->trailing_comments().data(), static_cast<int>(this->trailing_comments().length()),
+ this->_internal_trailing_comments().data(), static_cast<int>(this->_internal_trailing_comments().length()),
::PROTOBUF_NAMESPACE_ID::internal::WireFormat::SERIALIZE,
"google.protobuf.SourceCodeInfo.Location.trailing_comments");
target = stream->WriteStringMaybeAliased(
- 4, this->trailing_comments(), target);
+ 4, this->_internal_trailing_comments(), target);
}
// repeated string leading_detached_comments = 6;
- for (auto it = this->leading_detached_comments().pointer_begin(),
- end = this->leading_detached_comments().pointer_end(); it < end; ++it) {
+ for (auto it = leading_detached_comments_.pointer_begin(),
+ end = leading_detached_comments_.pointer_end(); it < end; ++it) {
const auto& s = **it;
::PROTOBUF_NAMESPACE_ID::internal::WireFormat::VerifyUTF8StringNamedField(
s.data(), static_cast<int>(s.length()),
@@ -12921,10 +12821,10 @@
// repeated string leading_detached_comments = 6;
total_size += 1 *
- ::PROTOBUF_NAMESPACE_ID::internal::FromIntSize(this->leading_detached_comments_size());
- for (int i = 0, n = this->leading_detached_comments_size(); i < n; i++) {
+ ::PROTOBUF_NAMESPACE_ID::internal::FromIntSize(leading_detached_comments_.size());
+ for (int i = 0, n = leading_detached_comments_.size(); i < n; i++) {
total_size += ::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::StringSize(
- this->leading_detached_comments(i));
+ leading_detached_comments_.Get(i));
}
cached_has_bits = _has_bits_[0];
@@ -12933,14 +12833,14 @@
if (cached_has_bits & 0x00000001u) {
total_size += 1 +
::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::StringSize(
- this->leading_comments());
+ this->_internal_leading_comments());
}
// optional string trailing_comments = 4;
if (cached_has_bits & 0x00000002u) {
total_size += 1 +
::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::StringSize(
- this->trailing_comments());
+ this->_internal_trailing_comments());
}
}
@@ -12981,10 +12881,10 @@
cached_has_bits = from._has_bits_[0];
if (cached_has_bits & 0x00000003u) {
if (cached_has_bits & 0x00000001u) {
- set_leading_comments(from.leading_comments());
+ _internal_set_leading_comments(from._internal_leading_comments());
}
if (cached_has_bits & 0x00000002u) {
- set_trailing_comments(from.trailing_comments());
+ _internal_set_trailing_comments(from._internal_trailing_comments());
}
}
}
@@ -13013,7 +12913,7 @@
swap(_has_bits_[0], other->_has_bits_[0]);
path_.InternalSwap(&other->path_);
span_.InternalSwap(&other->span_);
- leading_detached_comments_.InternalSwap(CastToBase(&other->leading_detached_comments_));
+ leading_detached_comments_.InternalSwap(&other->leading_detached_comments_);
leading_comments_.Swap(&other->leading_comments_, &::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(),
GetArenaNoVirtual());
trailing_comments_.Swap(&other->trailing_comments_, &::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(),
@@ -13113,7 +13013,7 @@
ptr = ctx->ParseMessage(add_location(), ptr);
CHK_(ptr);
if (!ctx->DataAvailable(ptr)) break;
- } while (::PROTOBUF_NAMESPACE_ID::internal::UnalignedLoad<::PROTOBUF_NAMESPACE_ID::uint8>(ptr) == 10);
+ } while (::PROTOBUF_NAMESPACE_ID::internal::ExpectTag<10>(ptr));
} else goto handle_unusual;
continue;
default: {
@@ -13185,8 +13085,8 @@
(void) cached_has_bits;
// repeated .google.protobuf.SourceCodeInfo.Location location = 1;
- for (auto it = this->location().pointer_begin(),
- end = this->location().pointer_end(); it < end; ++it) {
+ for (auto it = this->location_.pointer_begin(),
+ end = this->location_.pointer_end(); it < end; ++it) {
stream->EnsureSpace(&target);
target = ::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::
InternalWriteMessageToArray(1, **it, target, stream);
@@ -13209,14 +13109,10 @@
(void) cached_has_bits;
// repeated .google.protobuf.SourceCodeInfo.Location location = 1;
- {
- unsigned int count = static_cast<unsigned int>(this->location_size());
- total_size += 1UL * count;
- for (unsigned int i = 0; i < count; i++) {
- total_size +=
- ::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::MessageSize(
- this->location(static_cast<int>(i)));
- }
+ total_size += 1UL * this->location_size();
+ for (const auto& msg : this->location_) {
+ total_size +=
+ ::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::MessageSize(msg);
}
if (PROTOBUF_PREDICT_FALSE(_internal_metadata_.have_unknown_fields())) {
@@ -13275,7 +13171,7 @@
using std::swap;
_internal_metadata_.Swap(&other->_internal_metadata_);
swap(_has_bits_[0], other->_has_bits_[0]);
- CastToBase(&location_)->InternalSwap(CastToBase(&other->location_));
+ location_.InternalSwap(&other->location_);
}
::PROTOBUF_NAMESPACE_ID::Metadata SourceCodeInfo::GetMetadata() const {
@@ -13321,8 +13217,8 @@
path_(from.path_) {
_internal_metadata_.MergeFrom(from._internal_metadata_);
source_file_.UnsafeSetDefault(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited());
- if (from.has_source_file()) {
- source_file_.Set(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(), from.source_file(),
+ if (from._internal_has_source_file()) {
+ source_file_.Set(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(), from._internal_source_file(),
GetArenaNoVirtual());
}
::memcpy(&begin_, &from.begin_,
@@ -13407,7 +13303,7 @@
// optional string source_file = 2;
case 2:
if (PROTOBUF_PREDICT_TRUE(static_cast<::PROTOBUF_NAMESPACE_ID::uint8>(tag) == 18)) {
- ptr = ::PROTOBUF_NAMESPACE_ID::internal::InlineGreedyStringParserUTF8Verify(mutable_source_file(), ptr, ctx, "google.protobuf.GeneratedCodeInfo.Annotation.source_file");
+ ptr = ::PROTOBUF_NAMESPACE_ID::internal::InlineGreedyStringParserUTF8Verify(_internal_mutable_source_file(), ptr, ctx, "google.protobuf.GeneratedCodeInfo.Annotation.source_file");
CHK_(ptr);
} else goto handle_unusual;
continue;
@@ -13478,9 +13374,9 @@
case 2: {
if (static_cast< ::PROTOBUF_NAMESPACE_ID::uint8>(tag) == (18 & 0xFF)) {
DO_(::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::ReadString(
- input, this->mutable_source_file()));
+ input, this->_internal_mutable_source_file()));
::PROTOBUF_NAMESPACE_ID::internal::WireFormat::VerifyUTF8StringNamedField(
- this->source_file().data(), static_cast<int>(this->source_file().length()),
+ this->_internal_source_file().data(), static_cast<int>(this->_internal_source_file().length()),
::PROTOBUF_NAMESPACE_ID::internal::WireFormat::PARSE,
"google.protobuf.GeneratedCodeInfo.Annotation.source_file");
} else {
@@ -13555,11 +13451,11 @@
// optional string source_file = 2;
if (cached_has_bits & 0x00000001u) {
::PROTOBUF_NAMESPACE_ID::internal::WireFormat::VerifyUTF8StringNamedField(
- this->source_file().data(), static_cast<int>(this->source_file().length()),
+ this->_internal_source_file().data(), static_cast<int>(this->_internal_source_file().length()),
::PROTOBUF_NAMESPACE_ID::internal::WireFormat::SERIALIZE,
"google.protobuf.GeneratedCodeInfo.Annotation.source_file");
target = stream->WriteStringMaybeAliased(
- 2, this->source_file(), target);
+ 2, this->_internal_source_file(), target);
}
// optional int32 begin = 3;
@@ -13611,7 +13507,7 @@
if (cached_has_bits & 0x00000001u) {
total_size += 1 +
::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::StringSize(
- this->source_file());
+ this->_internal_source_file());
}
// optional int32 begin = 3;
@@ -13664,7 +13560,7 @@
cached_has_bits = from._has_bits_[0];
if (cached_has_bits & 0x00000007u) {
if (cached_has_bits & 0x00000001u) {
- set_source_file(from.source_file());
+ _internal_set_source_file(from._internal_source_file());
}
if (cached_has_bits & 0x00000002u) {
begin_ = from.begin_;
@@ -13798,7 +13694,7 @@
ptr = ctx->ParseMessage(add_annotation(), ptr);
CHK_(ptr);
if (!ctx->DataAvailable(ptr)) break;
- } while (::PROTOBUF_NAMESPACE_ID::internal::UnalignedLoad<::PROTOBUF_NAMESPACE_ID::uint8>(ptr) == 10);
+ } while (::PROTOBUF_NAMESPACE_ID::internal::ExpectTag<10>(ptr));
} else goto handle_unusual;
continue;
default: {
@@ -13870,8 +13766,8 @@
(void) cached_has_bits;
// repeated .google.protobuf.GeneratedCodeInfo.Annotation annotation = 1;
- for (auto it = this->annotation().pointer_begin(),
- end = this->annotation().pointer_end(); it < end; ++it) {
+ for (auto it = this->annotation_.pointer_begin(),
+ end = this->annotation_.pointer_end(); it < end; ++it) {
stream->EnsureSpace(&target);
target = ::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::
InternalWriteMessageToArray(1, **it, target, stream);
@@ -13894,14 +13790,10 @@
(void) cached_has_bits;
// repeated .google.protobuf.GeneratedCodeInfo.Annotation annotation = 1;
- {
- unsigned int count = static_cast<unsigned int>(this->annotation_size());
- total_size += 1UL * count;
- for (unsigned int i = 0; i < count; i++) {
- total_size +=
- ::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::MessageSize(
- this->annotation(static_cast<int>(i)));
- }
+ total_size += 1UL * this->annotation_size();
+ for (const auto& msg : this->annotation_) {
+ total_size +=
+ ::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::MessageSize(msg);
}
if (PROTOBUF_PREDICT_FALSE(_internal_metadata_.have_unknown_fields())) {
@@ -13960,7 +13852,7 @@
using std::swap;
_internal_metadata_.Swap(&other->_internal_metadata_);
swap(_has_bits_[0], other->_has_bits_[0]);
- CastToBase(&annotation_)->InternalSwap(CastToBase(&other->annotation_));
+ annotation_.InternalSwap(&other->annotation_);
}
::PROTOBUF_NAMESPACE_ID::Metadata GeneratedCodeInfo::GetMetadata() const {
diff --git a/src/google/protobuf/descriptor.pb.h b/src/google/protobuf/descriptor.pb.h
index d2601e3..cebbe9e 100644
--- a/src/google/protobuf/descriptor.pb.h
+++ b/src/google/protobuf/descriptor.pb.h
@@ -663,6 +663,9 @@
void add_dependency(const char* value, size_t size);
const ::PROTOBUF_NAMESPACE_ID::RepeatedPtrField<std::string>& dependency() const;
::PROTOBUF_NAMESPACE_ID::RepeatedPtrField<std::string>* mutable_dependency();
+ private:
+ std::string* _internal_add_dependency();
+ public:
// repeated .google.protobuf.DescriptorProto message_type = 4;
int message_type_size() const;
@@ -732,6 +735,9 @@
// optional string name = 1;
bool has_name() const;
+ private:
+ bool _internal_has_name() const;
+ public:
void clear_name();
const std::string& name() const;
void set_name(const std::string& value);
@@ -750,9 +756,17 @@
" future release.")
void unsafe_arena_set_allocated_name(
std::string* name);
+ private:
+ const std::string& _internal_name() const;
+ void _internal_set_name(const std::string& value);
+ std::string* _internal_mutable_name();
+ public:
// optional string package = 2;
bool has_package() const;
+ private:
+ bool _internal_has_package() const;
+ public:
void clear_package();
const std::string& package() const;
void set_package(const std::string& value);
@@ -771,9 +785,17 @@
" future release.")
void unsafe_arena_set_allocated_package(
std::string* package);
+ private:
+ const std::string& _internal_package() const;
+ void _internal_set_package(const std::string& value);
+ std::string* _internal_mutable_package();
+ public:
// optional string syntax = 12;
bool has_syntax() const;
+ private:
+ bool _internal_has_syntax() const;
+ public:
void clear_syntax();
const std::string& syntax() const;
void set_syntax(const std::string& value);
@@ -792,9 +814,17 @@
" future release.")
void unsafe_arena_set_allocated_syntax(
std::string* syntax);
+ private:
+ const std::string& _internal_syntax() const;
+ void _internal_set_syntax(const std::string& value);
+ std::string* _internal_mutable_syntax();
+ public:
// optional .google.protobuf.FileOptions options = 8;
bool has_options() const;
+ private:
+ bool _internal_has_options() const;
+ public:
void clear_options();
const PROTOBUF_NAMESPACE_ID::FileOptions& options() const;
PROTOBUF_NAMESPACE_ID::FileOptions* release_options();
@@ -806,6 +836,9 @@
// optional .google.protobuf.SourceCodeInfo source_code_info = 9;
bool has_source_code_info() const;
+ private:
+ bool _internal_has_source_code_info() const;
+ public:
void clear_source_code_info();
const PROTOBUF_NAMESPACE_ID::SourceCodeInfo& source_code_info() const;
PROTOBUF_NAMESPACE_ID::SourceCodeInfo* release_source_code_info();
@@ -985,6 +1018,9 @@
};
// optional .google.protobuf.ExtensionRangeOptions options = 3;
bool has_options() const;
+ private:
+ bool _internal_has_options() const;
+ public:
void clear_options();
const PROTOBUF_NAMESPACE_ID::ExtensionRangeOptions& options() const;
PROTOBUF_NAMESPACE_ID::ExtensionRangeOptions* release_options();
@@ -996,12 +1032,18 @@
// optional int32 start = 1;
bool has_start() const;
+ private:
+ bool _internal_has_start() const;
+ public:
void clear_start();
::PROTOBUF_NAMESPACE_ID::int32 start() const;
void set_start(::PROTOBUF_NAMESPACE_ID::int32 value);
// optional int32 end = 2;
bool has_end() const;
+ private:
+ bool _internal_has_end() const;
+ public:
void clear_end();
::PROTOBUF_NAMESPACE_ID::int32 end() const;
void set_end(::PROTOBUF_NAMESPACE_ID::int32 value);
@@ -1166,12 +1208,18 @@
};
// optional int32 start = 1;
bool has_start() const;
+ private:
+ bool _internal_has_start() const;
+ public:
void clear_start();
::PROTOBUF_NAMESPACE_ID::int32 start() const;
void set_start(::PROTOBUF_NAMESPACE_ID::int32 value);
// optional int32 end = 2;
bool has_end() const;
+ private:
+ bool _internal_has_end() const;
+ public:
void clear_end();
::PROTOBUF_NAMESPACE_ID::int32 end() const;
void set_end(::PROTOBUF_NAMESPACE_ID::int32 value);
@@ -1437,9 +1485,15 @@
void add_reserved_name(const char* value, size_t size);
const ::PROTOBUF_NAMESPACE_ID::RepeatedPtrField<std::string>& reserved_name() const;
::PROTOBUF_NAMESPACE_ID::RepeatedPtrField<std::string>* mutable_reserved_name();
+ private:
+ std::string* _internal_add_reserved_name();
+ public:
// optional string name = 1;
bool has_name() const;
+ private:
+ bool _internal_has_name() const;
+ public:
void clear_name();
const std::string& name() const;
void set_name(const std::string& value);
@@ -1458,9 +1512,17 @@
" future release.")
void unsafe_arena_set_allocated_name(
std::string* name);
+ private:
+ const std::string& _internal_name() const;
+ void _internal_set_name(const std::string& value);
+ std::string* _internal_mutable_name();
+ public:
// optional .google.protobuf.MessageOptions options = 7;
bool has_options() const;
+ private:
+ bool _internal_has_options() const;
+ public:
void clear_options();
const PROTOBUF_NAMESPACE_ID::MessageOptions& options() const;
PROTOBUF_NAMESPACE_ID::MessageOptions* release_options();
@@ -1908,6 +1970,9 @@
};
// optional string name = 1;
bool has_name() const;
+ private:
+ bool _internal_has_name() const;
+ public:
void clear_name();
const std::string& name() const;
void set_name(const std::string& value);
@@ -1926,9 +1991,17 @@
" future release.")
void unsafe_arena_set_allocated_name(
std::string* name);
+ private:
+ const std::string& _internal_name() const;
+ void _internal_set_name(const std::string& value);
+ std::string* _internal_mutable_name();
+ public:
// optional string extendee = 2;
bool has_extendee() const;
+ private:
+ bool _internal_has_extendee() const;
+ public:
void clear_extendee();
const std::string& extendee() const;
void set_extendee(const std::string& value);
@@ -1947,9 +2020,17 @@
" future release.")
void unsafe_arena_set_allocated_extendee(
std::string* extendee);
+ private:
+ const std::string& _internal_extendee() const;
+ void _internal_set_extendee(const std::string& value);
+ std::string* _internal_mutable_extendee();
+ public:
// optional string type_name = 6;
bool has_type_name() const;
+ private:
+ bool _internal_has_type_name() const;
+ public:
void clear_type_name();
const std::string& type_name() const;
void set_type_name(const std::string& value);
@@ -1968,9 +2049,17 @@
" future release.")
void unsafe_arena_set_allocated_type_name(
std::string* type_name);
+ private:
+ const std::string& _internal_type_name() const;
+ void _internal_set_type_name(const std::string& value);
+ std::string* _internal_mutable_type_name();
+ public:
// optional string default_value = 7;
bool has_default_value() const;
+ private:
+ bool _internal_has_default_value() const;
+ public:
void clear_default_value();
const std::string& default_value() const;
void set_default_value(const std::string& value);
@@ -1989,9 +2078,17 @@
" future release.")
void unsafe_arena_set_allocated_default_value(
std::string* default_value);
+ private:
+ const std::string& _internal_default_value() const;
+ void _internal_set_default_value(const std::string& value);
+ std::string* _internal_mutable_default_value();
+ public:
// optional string json_name = 10;
bool has_json_name() const;
+ private:
+ bool _internal_has_json_name() const;
+ public:
void clear_json_name();
const std::string& json_name() const;
void set_json_name(const std::string& value);
@@ -2010,9 +2107,17 @@
" future release.")
void unsafe_arena_set_allocated_json_name(
std::string* json_name);
+ private:
+ const std::string& _internal_json_name() const;
+ void _internal_set_json_name(const std::string& value);
+ std::string* _internal_mutable_json_name();
+ public:
// optional .google.protobuf.FieldOptions options = 8;
bool has_options() const;
+ private:
+ bool _internal_has_options() const;
+ public:
void clear_options();
const PROTOBUF_NAMESPACE_ID::FieldOptions& options() const;
PROTOBUF_NAMESPACE_ID::FieldOptions* release_options();
@@ -2024,24 +2129,36 @@
// optional int32 number = 3;
bool has_number() const;
+ private:
+ bool _internal_has_number() const;
+ public:
void clear_number();
::PROTOBUF_NAMESPACE_ID::int32 number() const;
void set_number(::PROTOBUF_NAMESPACE_ID::int32 value);
// optional int32 oneof_index = 9;
bool has_oneof_index() const;
+ private:
+ bool _internal_has_oneof_index() const;
+ public:
void clear_oneof_index();
::PROTOBUF_NAMESPACE_ID::int32 oneof_index() const;
void set_oneof_index(::PROTOBUF_NAMESPACE_ID::int32 value);
// optional .google.protobuf.FieldDescriptorProto.Label label = 4;
bool has_label() const;
+ private:
+ bool _internal_has_label() const;
+ public:
void clear_label();
PROTOBUF_NAMESPACE_ID::FieldDescriptorProto_Label label() const;
void set_label(PROTOBUF_NAMESPACE_ID::FieldDescriptorProto_Label value);
// optional .google.protobuf.FieldDescriptorProto.Type type = 5;
bool has_type() const;
+ private:
+ bool _internal_has_type() const;
+ public:
void clear_type();
PROTOBUF_NAMESPACE_ID::FieldDescriptorProto_Type type() const;
void set_type(PROTOBUF_NAMESPACE_ID::FieldDescriptorProto_Type value);
@@ -2213,6 +2330,9 @@
};
// optional string name = 1;
bool has_name() const;
+ private:
+ bool _internal_has_name() const;
+ public:
void clear_name();
const std::string& name() const;
void set_name(const std::string& value);
@@ -2231,9 +2351,17 @@
" future release.")
void unsafe_arena_set_allocated_name(
std::string* name);
+ private:
+ const std::string& _internal_name() const;
+ void _internal_set_name(const std::string& value);
+ std::string* _internal_mutable_name();
+ public:
// optional .google.protobuf.OneofOptions options = 2;
bool has_options() const;
+ private:
+ bool _internal_has_options() const;
+ public:
void clear_options();
const PROTOBUF_NAMESPACE_ID::OneofOptions& options() const;
PROTOBUF_NAMESPACE_ID::OneofOptions* release_options();
@@ -2402,12 +2530,18 @@
};
// optional int32 start = 1;
bool has_start() const;
+ private:
+ bool _internal_has_start() const;
+ public:
void clear_start();
::PROTOBUF_NAMESPACE_ID::int32 start() const;
void set_start(::PROTOBUF_NAMESPACE_ID::int32 value);
// optional int32 end = 2;
bool has_end() const;
+ private:
+ bool _internal_has_end() const;
+ public:
void clear_end();
::PROTOBUF_NAMESPACE_ID::int32 end() const;
void set_end(::PROTOBUF_NAMESPACE_ID::int32 value);
@@ -2612,9 +2746,15 @@
void add_reserved_name(const char* value, size_t size);
const ::PROTOBUF_NAMESPACE_ID::RepeatedPtrField<std::string>& reserved_name() const;
::PROTOBUF_NAMESPACE_ID::RepeatedPtrField<std::string>* mutable_reserved_name();
+ private:
+ std::string* _internal_add_reserved_name();
+ public:
// optional string name = 1;
bool has_name() const;
+ private:
+ bool _internal_has_name() const;
+ public:
void clear_name();
const std::string& name() const;
void set_name(const std::string& value);
@@ -2633,9 +2773,17 @@
" future release.")
void unsafe_arena_set_allocated_name(
std::string* name);
+ private:
+ const std::string& _internal_name() const;
+ void _internal_set_name(const std::string& value);
+ std::string* _internal_mutable_name();
+ public:
// optional .google.protobuf.EnumOptions options = 3;
bool has_options() const;
+ private:
+ bool _internal_has_options() const;
+ public:
void clear_options();
const PROTOBUF_NAMESPACE_ID::EnumOptions& options() const;
PROTOBUF_NAMESPACE_ID::EnumOptions* release_options();
@@ -2808,6 +2956,9 @@
};
// optional string name = 1;
bool has_name() const;
+ private:
+ bool _internal_has_name() const;
+ public:
void clear_name();
const std::string& name() const;
void set_name(const std::string& value);
@@ -2826,9 +2977,17 @@
" future release.")
void unsafe_arena_set_allocated_name(
std::string* name);
+ private:
+ const std::string& _internal_name() const;
+ void _internal_set_name(const std::string& value);
+ std::string* _internal_mutable_name();
+ public:
// optional .google.protobuf.EnumValueOptions options = 3;
bool has_options() const;
+ private:
+ bool _internal_has_options() const;
+ public:
void clear_options();
const PROTOBUF_NAMESPACE_ID::EnumValueOptions& options() const;
PROTOBUF_NAMESPACE_ID::EnumValueOptions* release_options();
@@ -2840,6 +2999,9 @@
// optional int32 number = 2;
bool has_number() const;
+ private:
+ bool _internal_has_number() const;
+ public:
void clear_number();
::PROTOBUF_NAMESPACE_ID::int32 number() const;
void set_number(::PROTOBUF_NAMESPACE_ID::int32 value);
@@ -3016,6 +3178,9 @@
// optional string name = 1;
bool has_name() const;
+ private:
+ bool _internal_has_name() const;
+ public:
void clear_name();
const std::string& name() const;
void set_name(const std::string& value);
@@ -3034,9 +3199,17 @@
" future release.")
void unsafe_arena_set_allocated_name(
std::string* name);
+ private:
+ const std::string& _internal_name() const;
+ void _internal_set_name(const std::string& value);
+ std::string* _internal_mutable_name();
+ public:
// optional .google.protobuf.ServiceOptions options = 3;
bool has_options() const;
+ private:
+ bool _internal_has_options() const;
+ public:
void clear_options();
const PROTOBUF_NAMESPACE_ID::ServiceOptions& options() const;
PROTOBUF_NAMESPACE_ID::ServiceOptions* release_options();
@@ -3210,6 +3383,9 @@
};
// optional string name = 1;
bool has_name() const;
+ private:
+ bool _internal_has_name() const;
+ public:
void clear_name();
const std::string& name() const;
void set_name(const std::string& value);
@@ -3228,9 +3404,17 @@
" future release.")
void unsafe_arena_set_allocated_name(
std::string* name);
+ private:
+ const std::string& _internal_name() const;
+ void _internal_set_name(const std::string& value);
+ std::string* _internal_mutable_name();
+ public:
// optional string input_type = 2;
bool has_input_type() const;
+ private:
+ bool _internal_has_input_type() const;
+ public:
void clear_input_type();
const std::string& input_type() const;
void set_input_type(const std::string& value);
@@ -3249,9 +3433,17 @@
" future release.")
void unsafe_arena_set_allocated_input_type(
std::string* input_type);
+ private:
+ const std::string& _internal_input_type() const;
+ void _internal_set_input_type(const std::string& value);
+ std::string* _internal_mutable_input_type();
+ public:
// optional string output_type = 3;
bool has_output_type() const;
+ private:
+ bool _internal_has_output_type() const;
+ public:
void clear_output_type();
const std::string& output_type() const;
void set_output_type(const std::string& value);
@@ -3270,9 +3462,17 @@
" future release.")
void unsafe_arena_set_allocated_output_type(
std::string* output_type);
+ private:
+ const std::string& _internal_output_type() const;
+ void _internal_set_output_type(const std::string& value);
+ std::string* _internal_mutable_output_type();
+ public:
// optional .google.protobuf.MethodOptions options = 4;
bool has_options() const;
+ private:
+ bool _internal_has_options() const;
+ public:
void clear_options();
const PROTOBUF_NAMESPACE_ID::MethodOptions& options() const;
PROTOBUF_NAMESPACE_ID::MethodOptions* release_options();
@@ -3284,12 +3484,18 @@
// optional bool client_streaming = 5 [default = false];
bool has_client_streaming() const;
+ private:
+ bool _internal_has_client_streaming() const;
+ public:
void clear_client_streaming();
bool client_streaming() const;
void set_client_streaming(bool value);
// optional bool server_streaming = 6 [default = false];
bool has_server_streaming() const;
+ private:
+ bool _internal_has_server_streaming() const;
+ public:
void clear_server_streaming();
bool server_streaming() const;
void set_server_streaming(bool value);
@@ -3519,6 +3725,9 @@
// optional string java_package = 1;
bool has_java_package() const;
+ private:
+ bool _internal_has_java_package() const;
+ public:
void clear_java_package();
const std::string& java_package() const;
void set_java_package(const std::string& value);
@@ -3537,9 +3746,17 @@
" future release.")
void unsafe_arena_set_allocated_java_package(
std::string* java_package);
+ private:
+ const std::string& _internal_java_package() const;
+ void _internal_set_java_package(const std::string& value);
+ std::string* _internal_mutable_java_package();
+ public:
// optional string java_outer_classname = 8;
bool has_java_outer_classname() const;
+ private:
+ bool _internal_has_java_outer_classname() const;
+ public:
void clear_java_outer_classname();
const std::string& java_outer_classname() const;
void set_java_outer_classname(const std::string& value);
@@ -3558,9 +3775,17 @@
" future release.")
void unsafe_arena_set_allocated_java_outer_classname(
std::string* java_outer_classname);
+ private:
+ const std::string& _internal_java_outer_classname() const;
+ void _internal_set_java_outer_classname(const std::string& value);
+ std::string* _internal_mutable_java_outer_classname();
+ public:
// optional string go_package = 11;
bool has_go_package() const;
+ private:
+ bool _internal_has_go_package() const;
+ public:
void clear_go_package();
const std::string& go_package() const;
void set_go_package(const std::string& value);
@@ -3579,9 +3804,17 @@
" future release.")
void unsafe_arena_set_allocated_go_package(
std::string* go_package);
+ private:
+ const std::string& _internal_go_package() const;
+ void _internal_set_go_package(const std::string& value);
+ std::string* _internal_mutable_go_package();
+ public:
// optional string objc_class_prefix = 36;
bool has_objc_class_prefix() const;
+ private:
+ bool _internal_has_objc_class_prefix() const;
+ public:
void clear_objc_class_prefix();
const std::string& objc_class_prefix() const;
void set_objc_class_prefix(const std::string& value);
@@ -3600,9 +3833,17 @@
" future release.")
void unsafe_arena_set_allocated_objc_class_prefix(
std::string* objc_class_prefix);
+ private:
+ const std::string& _internal_objc_class_prefix() const;
+ void _internal_set_objc_class_prefix(const std::string& value);
+ std::string* _internal_mutable_objc_class_prefix();
+ public:
// optional string csharp_namespace = 37;
bool has_csharp_namespace() const;
+ private:
+ bool _internal_has_csharp_namespace() const;
+ public:
void clear_csharp_namespace();
const std::string& csharp_namespace() const;
void set_csharp_namespace(const std::string& value);
@@ -3621,9 +3862,17 @@
" future release.")
void unsafe_arena_set_allocated_csharp_namespace(
std::string* csharp_namespace);
+ private:
+ const std::string& _internal_csharp_namespace() const;
+ void _internal_set_csharp_namespace(const std::string& value);
+ std::string* _internal_mutable_csharp_namespace();
+ public:
// optional string swift_prefix = 39;
bool has_swift_prefix() const;
+ private:
+ bool _internal_has_swift_prefix() const;
+ public:
void clear_swift_prefix();
const std::string& swift_prefix() const;
void set_swift_prefix(const std::string& value);
@@ -3642,9 +3891,17 @@
" future release.")
void unsafe_arena_set_allocated_swift_prefix(
std::string* swift_prefix);
+ private:
+ const std::string& _internal_swift_prefix() const;
+ void _internal_set_swift_prefix(const std::string& value);
+ std::string* _internal_mutable_swift_prefix();
+ public:
// optional string php_class_prefix = 40;
bool has_php_class_prefix() const;
+ private:
+ bool _internal_has_php_class_prefix() const;
+ public:
void clear_php_class_prefix();
const std::string& php_class_prefix() const;
void set_php_class_prefix(const std::string& value);
@@ -3663,9 +3920,17 @@
" future release.")
void unsafe_arena_set_allocated_php_class_prefix(
std::string* php_class_prefix);
+ private:
+ const std::string& _internal_php_class_prefix() const;
+ void _internal_set_php_class_prefix(const std::string& value);
+ std::string* _internal_mutable_php_class_prefix();
+ public:
// optional string php_namespace = 41;
bool has_php_namespace() const;
+ private:
+ bool _internal_has_php_namespace() const;
+ public:
void clear_php_namespace();
const std::string& php_namespace() const;
void set_php_namespace(const std::string& value);
@@ -3684,9 +3949,17 @@
" future release.")
void unsafe_arena_set_allocated_php_namespace(
std::string* php_namespace);
+ private:
+ const std::string& _internal_php_namespace() const;
+ void _internal_set_php_namespace(const std::string& value);
+ std::string* _internal_mutable_php_namespace();
+ public:
// optional string php_metadata_namespace = 44;
bool has_php_metadata_namespace() const;
+ private:
+ bool _internal_has_php_metadata_namespace() const;
+ public:
void clear_php_metadata_namespace();
const std::string& php_metadata_namespace() const;
void set_php_metadata_namespace(const std::string& value);
@@ -3705,9 +3978,17 @@
" future release.")
void unsafe_arena_set_allocated_php_metadata_namespace(
std::string* php_metadata_namespace);
+ private:
+ const std::string& _internal_php_metadata_namespace() const;
+ void _internal_set_php_metadata_namespace(const std::string& value);
+ std::string* _internal_mutable_php_metadata_namespace();
+ public:
// optional string ruby_package = 45;
bool has_ruby_package() const;
+ private:
+ bool _internal_has_ruby_package() const;
+ public:
void clear_ruby_package();
const std::string& ruby_package() const;
void set_ruby_package(const std::string& value);
@@ -3726,63 +4007,98 @@
" future release.")
void unsafe_arena_set_allocated_ruby_package(
std::string* ruby_package);
+ private:
+ const std::string& _internal_ruby_package() const;
+ void _internal_set_ruby_package(const std::string& value);
+ std::string* _internal_mutable_ruby_package();
+ public:
// optional bool java_multiple_files = 10 [default = false];
bool has_java_multiple_files() const;
+ private:
+ bool _internal_has_java_multiple_files() const;
+ public:
void clear_java_multiple_files();
bool java_multiple_files() const;
void set_java_multiple_files(bool value);
// optional bool java_generate_equals_and_hash = 20 [deprecated = true];
PROTOBUF_DEPRECATED bool has_java_generate_equals_and_hash() const;
+ private:
+ bool _internal_has_java_generate_equals_and_hash() const;
+ public:
PROTOBUF_DEPRECATED void clear_java_generate_equals_and_hash();
PROTOBUF_DEPRECATED bool java_generate_equals_and_hash() const;
PROTOBUF_DEPRECATED void set_java_generate_equals_and_hash(bool value);
// optional bool java_string_check_utf8 = 27 [default = false];
bool has_java_string_check_utf8() const;
+ private:
+ bool _internal_has_java_string_check_utf8() const;
+ public:
void clear_java_string_check_utf8();
bool java_string_check_utf8() const;
void set_java_string_check_utf8(bool value);
// optional bool cc_generic_services = 16 [default = false];
bool has_cc_generic_services() const;
+ private:
+ bool _internal_has_cc_generic_services() const;
+ public:
void clear_cc_generic_services();
bool cc_generic_services() const;
void set_cc_generic_services(bool value);
// optional bool java_generic_services = 17 [default = false];
bool has_java_generic_services() const;
+ private:
+ bool _internal_has_java_generic_services() const;
+ public:
void clear_java_generic_services();
bool java_generic_services() const;
void set_java_generic_services(bool value);
// optional bool py_generic_services = 18 [default = false];
bool has_py_generic_services() const;
+ private:
+ bool _internal_has_py_generic_services() const;
+ public:
void clear_py_generic_services();
bool py_generic_services() const;
void set_py_generic_services(bool value);
// optional bool php_generic_services = 42 [default = false];
bool has_php_generic_services() const;
+ private:
+ bool _internal_has_php_generic_services() const;
+ public:
void clear_php_generic_services();
bool php_generic_services() const;
void set_php_generic_services(bool value);
// optional bool deprecated = 23 [default = false];
bool has_deprecated() const;
+ private:
+ bool _internal_has_deprecated() const;
+ public:
void clear_deprecated();
bool deprecated() const;
void set_deprecated(bool value);
// optional bool cc_enable_arenas = 31 [default = false];
bool has_cc_enable_arenas() const;
+ private:
+ bool _internal_has_cc_enable_arenas() const;
+ public:
void clear_cc_enable_arenas();
bool cc_enable_arenas() const;
void set_cc_enable_arenas(bool value);
// optional .google.protobuf.FileOptions.OptimizeMode optimize_for = 9 [default = SPEED];
bool has_optimize_for() const;
+ private:
+ bool _internal_has_optimize_for() const;
+ public:
void clear_optimize_for();
PROTOBUF_NAMESPACE_ID::FileOptions_OptimizeMode optimize_for() const;
void set_optimize_for(PROTOBUF_NAMESPACE_ID::FileOptions_OptimizeMode value);
@@ -3982,24 +4298,36 @@
// optional bool message_set_wire_format = 1 [default = false];
bool has_message_set_wire_format() const;
+ private:
+ bool _internal_has_message_set_wire_format() const;
+ public:
void clear_message_set_wire_format();
bool message_set_wire_format() const;
void set_message_set_wire_format(bool value);
// optional bool no_standard_descriptor_accessor = 2 [default = false];
bool has_no_standard_descriptor_accessor() const;
+ private:
+ bool _internal_has_no_standard_descriptor_accessor() const;
+ public:
void clear_no_standard_descriptor_accessor();
bool no_standard_descriptor_accessor() const;
void set_no_standard_descriptor_accessor(bool value);
// optional bool deprecated = 3 [default = false];
bool has_deprecated() const;
+ private:
+ bool _internal_has_deprecated() const;
+ public:
void clear_deprecated();
bool deprecated() const;
void set_deprecated(bool value);
// optional bool map_entry = 7;
bool has_map_entry() const;
+ private:
+ bool _internal_has_map_entry() const;
+ public:
void clear_map_entry();
bool map_entry() const;
void set_map_entry(bool value);
@@ -4249,36 +4577,54 @@
// optional .google.protobuf.FieldOptions.CType ctype = 1 [default = STRING];
bool has_ctype() const;
+ private:
+ bool _internal_has_ctype() const;
+ public:
void clear_ctype();
PROTOBUF_NAMESPACE_ID::FieldOptions_CType ctype() const;
void set_ctype(PROTOBUF_NAMESPACE_ID::FieldOptions_CType value);
// optional bool packed = 2;
bool has_packed() const;
+ private:
+ bool _internal_has_packed() const;
+ public:
void clear_packed();
bool packed() const;
void set_packed(bool value);
// optional bool lazy = 5 [default = false];
bool has_lazy() const;
+ private:
+ bool _internal_has_lazy() const;
+ public:
void clear_lazy();
bool lazy() const;
void set_lazy(bool value);
// optional bool deprecated = 3 [default = false];
bool has_deprecated() const;
+ private:
+ bool _internal_has_deprecated() const;
+ public:
void clear_deprecated();
bool deprecated() const;
void set_deprecated(bool value);
// optional bool weak = 10 [default = false];
bool has_weak() const;
+ private:
+ bool _internal_has_weak() const;
+ public:
void clear_weak();
bool weak() const;
void set_weak(bool value);
// optional .google.protobuf.FieldOptions.JSType jstype = 6 [default = JS_NORMAL];
bool has_jstype() const;
+ private:
+ bool _internal_has_jstype() const;
+ public:
void clear_jstype();
PROTOBUF_NAMESPACE_ID::FieldOptions_JSType jstype() const;
void set_jstype(PROTOBUF_NAMESPACE_ID::FieldOptions_JSType value);
@@ -4631,12 +4977,18 @@
// optional bool allow_alias = 2;
bool has_allow_alias() const;
+ private:
+ bool _internal_has_allow_alias() const;
+ public:
void clear_allow_alias();
bool allow_alias() const;
void set_allow_alias(bool value);
// optional bool deprecated = 3 [default = false];
bool has_deprecated() const;
+ private:
+ bool _internal_has_deprecated() const;
+ public:
void clear_deprecated();
bool deprecated() const;
void set_deprecated(bool value);
@@ -4815,6 +5167,9 @@
// optional bool deprecated = 1 [default = false];
bool has_deprecated() const;
+ private:
+ bool _internal_has_deprecated() const;
+ public:
void clear_deprecated();
bool deprecated() const;
void set_deprecated(bool value);
@@ -4992,6 +5347,9 @@
// optional bool deprecated = 33 [default = false];
bool has_deprecated() const;
+ private:
+ bool _internal_has_deprecated() const;
+ public:
void clear_deprecated();
bool deprecated() const;
void set_deprecated(bool value);
@@ -5202,12 +5560,18 @@
// optional bool deprecated = 33 [default = false];
bool has_deprecated() const;
+ private:
+ bool _internal_has_deprecated() const;
+ public:
void clear_deprecated();
bool deprecated() const;
void set_deprecated(bool value);
// optional .google.protobuf.MethodOptions.IdempotencyLevel idempotency_level = 34 [default = IDEMPOTENCY_UNKNOWN];
bool has_idempotency_level() const;
+ private:
+ bool _internal_has_idempotency_level() const;
+ public:
void clear_idempotency_level();
PROTOBUF_NAMESPACE_ID::MethodOptions_IdempotencyLevel idempotency_level() const;
void set_idempotency_level(PROTOBUF_NAMESPACE_ID::MethodOptions_IdempotencyLevel value);
@@ -5375,6 +5739,9 @@
};
// required string name_part = 1;
bool has_name_part() const;
+ private:
+ bool _internal_has_name_part() const;
+ public:
void clear_name_part();
const std::string& name_part() const;
void set_name_part(const std::string& value);
@@ -5393,9 +5760,17 @@
" future release.")
void unsafe_arena_set_allocated_name_part(
std::string* name_part);
+ private:
+ const std::string& _internal_name_part() const;
+ void _internal_set_name_part(const std::string& value);
+ std::string* _internal_mutable_name_part();
+ public:
// required bool is_extension = 2;
bool has_is_extension() const;
+ private:
+ bool _internal_has_is_extension() const;
+ public:
void clear_is_extension();
bool is_extension() const;
void set_is_extension(bool value);
@@ -5580,6 +5955,9 @@
// optional string identifier_value = 3;
bool has_identifier_value() const;
+ private:
+ bool _internal_has_identifier_value() const;
+ public:
void clear_identifier_value();
const std::string& identifier_value() const;
void set_identifier_value(const std::string& value);
@@ -5598,9 +5976,17 @@
" future release.")
void unsafe_arena_set_allocated_identifier_value(
std::string* identifier_value);
+ private:
+ const std::string& _internal_identifier_value() const;
+ void _internal_set_identifier_value(const std::string& value);
+ std::string* _internal_mutable_identifier_value();
+ public:
// optional bytes string_value = 7;
bool has_string_value() const;
+ private:
+ bool _internal_has_string_value() const;
+ public:
void clear_string_value();
const std::string& string_value() const;
void set_string_value(const std::string& value);
@@ -5619,9 +6005,17 @@
" future release.")
void unsafe_arena_set_allocated_string_value(
std::string* string_value);
+ private:
+ const std::string& _internal_string_value() const;
+ void _internal_set_string_value(const std::string& value);
+ std::string* _internal_mutable_string_value();
+ public:
// optional string aggregate_value = 8;
bool has_aggregate_value() const;
+ private:
+ bool _internal_has_aggregate_value() const;
+ public:
void clear_aggregate_value();
const std::string& aggregate_value() const;
void set_aggregate_value(const std::string& value);
@@ -5640,21 +6034,35 @@
" future release.")
void unsafe_arena_set_allocated_aggregate_value(
std::string* aggregate_value);
+ private:
+ const std::string& _internal_aggregate_value() const;
+ void _internal_set_aggregate_value(const std::string& value);
+ std::string* _internal_mutable_aggregate_value();
+ public:
// optional uint64 positive_int_value = 4;
bool has_positive_int_value() const;
+ private:
+ bool _internal_has_positive_int_value() const;
+ public:
void clear_positive_int_value();
::PROTOBUF_NAMESPACE_ID::uint64 positive_int_value() const;
void set_positive_int_value(::PROTOBUF_NAMESPACE_ID::uint64 value);
// optional int64 negative_int_value = 5;
bool has_negative_int_value() const;
+ private:
+ bool _internal_has_negative_int_value() const;
+ public:
void clear_negative_int_value();
::PROTOBUF_NAMESPACE_ID::int64 negative_int_value() const;
void set_negative_int_value(::PROTOBUF_NAMESPACE_ID::int64 value);
// optional double double_value = 6;
bool has_double_value() const;
+ private:
+ bool _internal_has_double_value() const;
+ public:
void clear_double_value();
double double_value() const;
void set_double_value(double value);
@@ -5862,9 +6270,15 @@
void add_leading_detached_comments(const char* value, size_t size);
const ::PROTOBUF_NAMESPACE_ID::RepeatedPtrField<std::string>& leading_detached_comments() const;
::PROTOBUF_NAMESPACE_ID::RepeatedPtrField<std::string>* mutable_leading_detached_comments();
+ private:
+ std::string* _internal_add_leading_detached_comments();
+ public:
// optional string leading_comments = 3;
bool has_leading_comments() const;
+ private:
+ bool _internal_has_leading_comments() const;
+ public:
void clear_leading_comments();
const std::string& leading_comments() const;
void set_leading_comments(const std::string& value);
@@ -5883,9 +6297,17 @@
" future release.")
void unsafe_arena_set_allocated_leading_comments(
std::string* leading_comments);
+ private:
+ const std::string& _internal_leading_comments() const;
+ void _internal_set_leading_comments(const std::string& value);
+ std::string* _internal_mutable_leading_comments();
+ public:
// optional string trailing_comments = 4;
bool has_trailing_comments() const;
+ private:
+ bool _internal_has_trailing_comments() const;
+ public:
void clear_trailing_comments();
const std::string& trailing_comments() const;
void set_trailing_comments(const std::string& value);
@@ -5904,6 +6326,11 @@
" future release.")
void unsafe_arena_set_allocated_trailing_comments(
std::string* trailing_comments);
+ private:
+ const std::string& _internal_trailing_comments() const;
+ void _internal_set_trailing_comments(const std::string& value);
+ std::string* _internal_mutable_trailing_comments();
+ public:
// @@protoc_insertion_point(class_scope:google.protobuf.SourceCodeInfo.Location)
private:
@@ -6250,6 +6677,9 @@
// optional string source_file = 2;
bool has_source_file() const;
+ private:
+ bool _internal_has_source_file() const;
+ public:
void clear_source_file();
const std::string& source_file() const;
void set_source_file(const std::string& value);
@@ -6268,15 +6698,26 @@
" future release.")
void unsafe_arena_set_allocated_source_file(
std::string* source_file);
+ private:
+ const std::string& _internal_source_file() const;
+ void _internal_set_source_file(const std::string& value);
+ std::string* _internal_mutable_source_file();
+ public:
// optional int32 begin = 3;
bool has_begin() const;
+ private:
+ bool _internal_has_begin() const;
+ public:
void clear_begin();
::PROTOBUF_NAMESPACE_ID::int32 begin() const;
void set_begin(::PROTOBUF_NAMESPACE_ID::int32 value);
// optional int32 end = 4;
bool has_end() const;
+ private:
+ bool _internal_has_end() const;
+ public:
void clear_end();
::PROTOBUF_NAMESPACE_ID::int32 end() const;
void set_end(::PROTOBUF_NAMESPACE_ID::int32 value);
@@ -6512,21 +6953,34 @@
// FileDescriptorProto
// optional string name = 1;
-inline bool FileDescriptorProto::has_name() const {
+inline bool FileDescriptorProto::_internal_has_name() const {
return (_has_bits_[0] & 0x00000001u) != 0;
}
+inline bool FileDescriptorProto::has_name() const {
+ return _internal_has_name();
+}
inline void FileDescriptorProto::clear_name() {
name_.ClearToEmpty(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(), GetArenaNoVirtual());
_has_bits_[0] &= ~0x00000001u;
}
inline const std::string& FileDescriptorProto::name() const {
// @@protoc_insertion_point(field_get:google.protobuf.FileDescriptorProto.name)
- return name_.Get();
+ return _internal_name();
}
inline void FileDescriptorProto::set_name(const std::string& value) {
+ _internal_set_name(value);
+ // @@protoc_insertion_point(field_set:google.protobuf.FileDescriptorProto.name)
+}
+inline std::string* FileDescriptorProto::mutable_name() {
+ // @@protoc_insertion_point(field_mutable:google.protobuf.FileDescriptorProto.name)
+ return _internal_mutable_name();
+}
+inline const std::string& FileDescriptorProto::_internal_name() const {
+ return name_.Get();
+}
+inline void FileDescriptorProto::_internal_set_name(const std::string& value) {
_has_bits_[0] |= 0x00000001u;
name_.Set(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(), value, GetArenaNoVirtual());
- // @@protoc_insertion_point(field_set:google.protobuf.FileDescriptorProto.name)
}
inline void FileDescriptorProto::set_name(std::string&& value) {
_has_bits_[0] |= 0x00000001u;
@@ -6548,9 +7002,8 @@
reinterpret_cast<const char*>(value), size), GetArenaNoVirtual());
// @@protoc_insertion_point(field_set_pointer:google.protobuf.FileDescriptorProto.name)
}
-inline std::string* FileDescriptorProto::mutable_name() {
+inline std::string* FileDescriptorProto::_internal_mutable_name() {
_has_bits_[0] |= 0x00000001u;
- // @@protoc_insertion_point(field_mutable:google.protobuf.FileDescriptorProto.name)
return name_.Mutable(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(), GetArenaNoVirtual());
}
inline std::string* FileDescriptorProto::release_name() {
@@ -6592,21 +7045,34 @@
}
// optional string package = 2;
-inline bool FileDescriptorProto::has_package() const {
+inline bool FileDescriptorProto::_internal_has_package() const {
return (_has_bits_[0] & 0x00000002u) != 0;
}
+inline bool FileDescriptorProto::has_package() const {
+ return _internal_has_package();
+}
inline void FileDescriptorProto::clear_package() {
package_.ClearToEmpty(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(), GetArenaNoVirtual());
_has_bits_[0] &= ~0x00000002u;
}
inline const std::string& FileDescriptorProto::package() const {
// @@protoc_insertion_point(field_get:google.protobuf.FileDescriptorProto.package)
- return package_.Get();
+ return _internal_package();
}
inline void FileDescriptorProto::set_package(const std::string& value) {
+ _internal_set_package(value);
+ // @@protoc_insertion_point(field_set:google.protobuf.FileDescriptorProto.package)
+}
+inline std::string* FileDescriptorProto::mutable_package() {
+ // @@protoc_insertion_point(field_mutable:google.protobuf.FileDescriptorProto.package)
+ return _internal_mutable_package();
+}
+inline const std::string& FileDescriptorProto::_internal_package() const {
+ return package_.Get();
+}
+inline void FileDescriptorProto::_internal_set_package(const std::string& value) {
_has_bits_[0] |= 0x00000002u;
package_.Set(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(), value, GetArenaNoVirtual());
- // @@protoc_insertion_point(field_set:google.protobuf.FileDescriptorProto.package)
}
inline void FileDescriptorProto::set_package(std::string&& value) {
_has_bits_[0] |= 0x00000002u;
@@ -6628,9 +7094,8 @@
reinterpret_cast<const char*>(value), size), GetArenaNoVirtual());
// @@protoc_insertion_point(field_set_pointer:google.protobuf.FileDescriptorProto.package)
}
-inline std::string* FileDescriptorProto::mutable_package() {
+inline std::string* FileDescriptorProto::_internal_mutable_package() {
_has_bits_[0] |= 0x00000002u;
- // @@protoc_insertion_point(field_mutable:google.protobuf.FileDescriptorProto.package)
return package_.Mutable(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(), GetArenaNoVirtual());
}
inline std::string* FileDescriptorProto::release_package() {
@@ -6678,6 +7143,10 @@
inline void FileDescriptorProto::clear_dependency() {
dependency_.Clear();
}
+inline std::string* FileDescriptorProto::add_dependency() {
+ // @@protoc_insertion_point(field_add_mutable:google.protobuf.FileDescriptorProto.dependency)
+ return _internal_add_dependency();
+}
inline const std::string& FileDescriptorProto::dependency(int index) const {
// @@protoc_insertion_point(field_get:google.protobuf.FileDescriptorProto.dependency)
return dependency_.Get(index);
@@ -6704,8 +7173,7 @@
reinterpret_cast<const char*>(value), size);
// @@protoc_insertion_point(field_set_pointer:google.protobuf.FileDescriptorProto.dependency)
}
-inline std::string* FileDescriptorProto::add_dependency() {
- // @@protoc_insertion_point(field_add_mutable:google.protobuf.FileDescriptorProto.dependency)
+inline std::string* FileDescriptorProto::_internal_add_dependency() {
return dependency_.Add();
}
inline void FileDescriptorProto::add_dependency(const std::string& value) {
@@ -6917,9 +7385,12 @@
}
// optional .google.protobuf.FileOptions options = 8;
-inline bool FileDescriptorProto::has_options() const {
+inline bool FileDescriptorProto::_internal_has_options() const {
return (_has_bits_[0] & 0x00000008u) != 0;
}
+inline bool FileDescriptorProto::has_options() const {
+ return _internal_has_options();
+}
inline void FileDescriptorProto::clear_options() {
if (options_ != nullptr) options_->Clear();
_has_bits_[0] &= ~0x00000008u;
@@ -6931,17 +7402,14 @@
&PROTOBUF_NAMESPACE_ID::_FileOptions_default_instance_);
}
inline PROTOBUF_NAMESPACE_ID::FileOptions* FileDescriptorProto::release_options() {
- // @@protoc_insertion_point(field_release:google.protobuf.FileDescriptorProto.options)
- _has_bits_[0] &= ~0x00000008u;
- PROTOBUF_NAMESPACE_ID::FileOptions* temp = options_;
+ auto temp = unsafe_arena_release_options();
if (GetArenaNoVirtual() != nullptr) {
temp = ::PROTOBUF_NAMESPACE_ID::internal::DuplicateIfNonNull(temp);
}
- options_ = nullptr;
return temp;
}
inline PROTOBUF_NAMESPACE_ID::FileOptions* FileDescriptorProto::unsafe_arena_release_options() {
- // @@protoc_insertion_point(field_unsafe_arena_release:google.protobuf.FileDescriptorProto.options)
+ // @@protoc_insertion_point(field_release:google.protobuf.FileDescriptorProto.options)
_has_bits_[0] &= ~0x00000008u;
PROTOBUF_NAMESPACE_ID::FileOptions* temp = options_;
options_ = nullptr;
@@ -6977,9 +7445,12 @@
}
// optional .google.protobuf.SourceCodeInfo source_code_info = 9;
-inline bool FileDescriptorProto::has_source_code_info() const {
+inline bool FileDescriptorProto::_internal_has_source_code_info() const {
return (_has_bits_[0] & 0x00000010u) != 0;
}
+inline bool FileDescriptorProto::has_source_code_info() const {
+ return _internal_has_source_code_info();
+}
inline void FileDescriptorProto::clear_source_code_info() {
if (source_code_info_ != nullptr) source_code_info_->Clear();
_has_bits_[0] &= ~0x00000010u;
@@ -6991,17 +7462,14 @@
&PROTOBUF_NAMESPACE_ID::_SourceCodeInfo_default_instance_);
}
inline PROTOBUF_NAMESPACE_ID::SourceCodeInfo* FileDescriptorProto::release_source_code_info() {
- // @@protoc_insertion_point(field_release:google.protobuf.FileDescriptorProto.source_code_info)
- _has_bits_[0] &= ~0x00000010u;
- PROTOBUF_NAMESPACE_ID::SourceCodeInfo* temp = source_code_info_;
+ auto temp = unsafe_arena_release_source_code_info();
if (GetArenaNoVirtual() != nullptr) {
temp = ::PROTOBUF_NAMESPACE_ID::internal::DuplicateIfNonNull(temp);
}
- source_code_info_ = nullptr;
return temp;
}
inline PROTOBUF_NAMESPACE_ID::SourceCodeInfo* FileDescriptorProto::unsafe_arena_release_source_code_info() {
- // @@protoc_insertion_point(field_unsafe_arena_release:google.protobuf.FileDescriptorProto.source_code_info)
+ // @@protoc_insertion_point(field_release:google.protobuf.FileDescriptorProto.source_code_info)
_has_bits_[0] &= ~0x00000010u;
PROTOBUF_NAMESPACE_ID::SourceCodeInfo* temp = source_code_info_;
source_code_info_ = nullptr;
@@ -7037,21 +7505,34 @@
}
// optional string syntax = 12;
-inline bool FileDescriptorProto::has_syntax() const {
+inline bool FileDescriptorProto::_internal_has_syntax() const {
return (_has_bits_[0] & 0x00000004u) != 0;
}
+inline bool FileDescriptorProto::has_syntax() const {
+ return _internal_has_syntax();
+}
inline void FileDescriptorProto::clear_syntax() {
syntax_.ClearToEmpty(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(), GetArenaNoVirtual());
_has_bits_[0] &= ~0x00000004u;
}
inline const std::string& FileDescriptorProto::syntax() const {
// @@protoc_insertion_point(field_get:google.protobuf.FileDescriptorProto.syntax)
- return syntax_.Get();
+ return _internal_syntax();
}
inline void FileDescriptorProto::set_syntax(const std::string& value) {
+ _internal_set_syntax(value);
+ // @@protoc_insertion_point(field_set:google.protobuf.FileDescriptorProto.syntax)
+}
+inline std::string* FileDescriptorProto::mutable_syntax() {
+ // @@protoc_insertion_point(field_mutable:google.protobuf.FileDescriptorProto.syntax)
+ return _internal_mutable_syntax();
+}
+inline const std::string& FileDescriptorProto::_internal_syntax() const {
+ return syntax_.Get();
+}
+inline void FileDescriptorProto::_internal_set_syntax(const std::string& value) {
_has_bits_[0] |= 0x00000004u;
syntax_.Set(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(), value, GetArenaNoVirtual());
- // @@protoc_insertion_point(field_set:google.protobuf.FileDescriptorProto.syntax)
}
inline void FileDescriptorProto::set_syntax(std::string&& value) {
_has_bits_[0] |= 0x00000004u;
@@ -7073,9 +7554,8 @@
reinterpret_cast<const char*>(value), size), GetArenaNoVirtual());
// @@protoc_insertion_point(field_set_pointer:google.protobuf.FileDescriptorProto.syntax)
}
-inline std::string* FileDescriptorProto::mutable_syntax() {
+inline std::string* FileDescriptorProto::_internal_mutable_syntax() {
_has_bits_[0] |= 0x00000004u;
- // @@protoc_insertion_point(field_mutable:google.protobuf.FileDescriptorProto.syntax)
return syntax_.Mutable(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(), GetArenaNoVirtual());
}
inline std::string* FileDescriptorProto::release_syntax() {
@@ -7121,9 +7601,12 @@
// DescriptorProto_ExtensionRange
// optional int32 start = 1;
-inline bool DescriptorProto_ExtensionRange::has_start() const {
+inline bool DescriptorProto_ExtensionRange::_internal_has_start() const {
return (_has_bits_[0] & 0x00000002u) != 0;
}
+inline bool DescriptorProto_ExtensionRange::has_start() const {
+ return _internal_has_start();
+}
inline void DescriptorProto_ExtensionRange::clear_start() {
start_ = 0;
_has_bits_[0] &= ~0x00000002u;
@@ -7139,9 +7622,12 @@
}
// optional int32 end = 2;
-inline bool DescriptorProto_ExtensionRange::has_end() const {
+inline bool DescriptorProto_ExtensionRange::_internal_has_end() const {
return (_has_bits_[0] & 0x00000004u) != 0;
}
+inline bool DescriptorProto_ExtensionRange::has_end() const {
+ return _internal_has_end();
+}
inline void DescriptorProto_ExtensionRange::clear_end() {
end_ = 0;
_has_bits_[0] &= ~0x00000004u;
@@ -7157,9 +7643,12 @@
}
// optional .google.protobuf.ExtensionRangeOptions options = 3;
-inline bool DescriptorProto_ExtensionRange::has_options() const {
+inline bool DescriptorProto_ExtensionRange::_internal_has_options() const {
return (_has_bits_[0] & 0x00000001u) != 0;
}
+inline bool DescriptorProto_ExtensionRange::has_options() const {
+ return _internal_has_options();
+}
inline void DescriptorProto_ExtensionRange::clear_options() {
if (options_ != nullptr) options_->Clear();
_has_bits_[0] &= ~0x00000001u;
@@ -7171,17 +7660,14 @@
&PROTOBUF_NAMESPACE_ID::_ExtensionRangeOptions_default_instance_);
}
inline PROTOBUF_NAMESPACE_ID::ExtensionRangeOptions* DescriptorProto_ExtensionRange::release_options() {
- // @@protoc_insertion_point(field_release:google.protobuf.DescriptorProto.ExtensionRange.options)
- _has_bits_[0] &= ~0x00000001u;
- PROTOBUF_NAMESPACE_ID::ExtensionRangeOptions* temp = options_;
+ auto temp = unsafe_arena_release_options();
if (GetArenaNoVirtual() != nullptr) {
temp = ::PROTOBUF_NAMESPACE_ID::internal::DuplicateIfNonNull(temp);
}
- options_ = nullptr;
return temp;
}
inline PROTOBUF_NAMESPACE_ID::ExtensionRangeOptions* DescriptorProto_ExtensionRange::unsafe_arena_release_options() {
- // @@protoc_insertion_point(field_unsafe_arena_release:google.protobuf.DescriptorProto.ExtensionRange.options)
+ // @@protoc_insertion_point(field_release:google.protobuf.DescriptorProto.ExtensionRange.options)
_has_bits_[0] &= ~0x00000001u;
PROTOBUF_NAMESPACE_ID::ExtensionRangeOptions* temp = options_;
options_ = nullptr;
@@ -7221,9 +7707,12 @@
// DescriptorProto_ReservedRange
// optional int32 start = 1;
-inline bool DescriptorProto_ReservedRange::has_start() const {
+inline bool DescriptorProto_ReservedRange::_internal_has_start() const {
return (_has_bits_[0] & 0x00000001u) != 0;
}
+inline bool DescriptorProto_ReservedRange::has_start() const {
+ return _internal_has_start();
+}
inline void DescriptorProto_ReservedRange::clear_start() {
start_ = 0;
_has_bits_[0] &= ~0x00000001u;
@@ -7239,9 +7728,12 @@
}
// optional int32 end = 2;
-inline bool DescriptorProto_ReservedRange::has_end() const {
+inline bool DescriptorProto_ReservedRange::_internal_has_end() const {
return (_has_bits_[0] & 0x00000002u) != 0;
}
+inline bool DescriptorProto_ReservedRange::has_end() const {
+ return _internal_has_end();
+}
inline void DescriptorProto_ReservedRange::clear_end() {
end_ = 0;
_has_bits_[0] &= ~0x00000002u;
@@ -7261,21 +7753,34 @@
// DescriptorProto
// optional string name = 1;
-inline bool DescriptorProto::has_name() const {
+inline bool DescriptorProto::_internal_has_name() const {
return (_has_bits_[0] & 0x00000001u) != 0;
}
+inline bool DescriptorProto::has_name() const {
+ return _internal_has_name();
+}
inline void DescriptorProto::clear_name() {
name_.ClearToEmpty(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(), GetArenaNoVirtual());
_has_bits_[0] &= ~0x00000001u;
}
inline const std::string& DescriptorProto::name() const {
// @@protoc_insertion_point(field_get:google.protobuf.DescriptorProto.name)
- return name_.Get();
+ return _internal_name();
}
inline void DescriptorProto::set_name(const std::string& value) {
+ _internal_set_name(value);
+ // @@protoc_insertion_point(field_set:google.protobuf.DescriptorProto.name)
+}
+inline std::string* DescriptorProto::mutable_name() {
+ // @@protoc_insertion_point(field_mutable:google.protobuf.DescriptorProto.name)
+ return _internal_mutable_name();
+}
+inline const std::string& DescriptorProto::_internal_name() const {
+ return name_.Get();
+}
+inline void DescriptorProto::_internal_set_name(const std::string& value) {
_has_bits_[0] |= 0x00000001u;
name_.Set(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(), value, GetArenaNoVirtual());
- // @@protoc_insertion_point(field_set:google.protobuf.DescriptorProto.name)
}
inline void DescriptorProto::set_name(std::string&& value) {
_has_bits_[0] |= 0x00000001u;
@@ -7297,9 +7802,8 @@
reinterpret_cast<const char*>(value), size), GetArenaNoVirtual());
// @@protoc_insertion_point(field_set_pointer:google.protobuf.DescriptorProto.name)
}
-inline std::string* DescriptorProto::mutable_name() {
+inline std::string* DescriptorProto::_internal_mutable_name() {
_has_bits_[0] |= 0x00000001u;
- // @@protoc_insertion_point(field_mutable:google.protobuf.DescriptorProto.name)
return name_.Mutable(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(), GetArenaNoVirtual());
}
inline std::string* DescriptorProto::release_name() {
@@ -7521,9 +8025,12 @@
}
// optional .google.protobuf.MessageOptions options = 7;
-inline bool DescriptorProto::has_options() const {
+inline bool DescriptorProto::_internal_has_options() const {
return (_has_bits_[0] & 0x00000002u) != 0;
}
+inline bool DescriptorProto::has_options() const {
+ return _internal_has_options();
+}
inline void DescriptorProto::clear_options() {
if (options_ != nullptr) options_->Clear();
_has_bits_[0] &= ~0x00000002u;
@@ -7535,17 +8042,14 @@
&PROTOBUF_NAMESPACE_ID::_MessageOptions_default_instance_);
}
inline PROTOBUF_NAMESPACE_ID::MessageOptions* DescriptorProto::release_options() {
- // @@protoc_insertion_point(field_release:google.protobuf.DescriptorProto.options)
- _has_bits_[0] &= ~0x00000002u;
- PROTOBUF_NAMESPACE_ID::MessageOptions* temp = options_;
+ auto temp = unsafe_arena_release_options();
if (GetArenaNoVirtual() != nullptr) {
temp = ::PROTOBUF_NAMESPACE_ID::internal::DuplicateIfNonNull(temp);
}
- options_ = nullptr;
return temp;
}
inline PROTOBUF_NAMESPACE_ID::MessageOptions* DescriptorProto::unsafe_arena_release_options() {
- // @@protoc_insertion_point(field_unsafe_arena_release:google.protobuf.DescriptorProto.options)
+ // @@protoc_insertion_point(field_release:google.protobuf.DescriptorProto.options)
_has_bits_[0] &= ~0x00000002u;
PROTOBUF_NAMESPACE_ID::MessageOptions* temp = options_;
options_ = nullptr;
@@ -7617,6 +8121,10 @@
inline void DescriptorProto::clear_reserved_name() {
reserved_name_.Clear();
}
+inline std::string* DescriptorProto::add_reserved_name() {
+ // @@protoc_insertion_point(field_add_mutable:google.protobuf.DescriptorProto.reserved_name)
+ return _internal_add_reserved_name();
+}
inline const std::string& DescriptorProto::reserved_name(int index) const {
// @@protoc_insertion_point(field_get:google.protobuf.DescriptorProto.reserved_name)
return reserved_name_.Get(index);
@@ -7643,8 +8151,7 @@
reinterpret_cast<const char*>(value), size);
// @@protoc_insertion_point(field_set_pointer:google.protobuf.DescriptorProto.reserved_name)
}
-inline std::string* DescriptorProto::add_reserved_name() {
- // @@protoc_insertion_point(field_add_mutable:google.protobuf.DescriptorProto.reserved_name)
+inline std::string* DescriptorProto::_internal_add_reserved_name() {
return reserved_name_.Add();
}
inline void DescriptorProto::add_reserved_name(const std::string& value) {
@@ -7714,21 +8221,34 @@
// FieldDescriptorProto
// optional string name = 1;
-inline bool FieldDescriptorProto::has_name() const {
+inline bool FieldDescriptorProto::_internal_has_name() const {
return (_has_bits_[0] & 0x00000001u) != 0;
}
+inline bool FieldDescriptorProto::has_name() const {
+ return _internal_has_name();
+}
inline void FieldDescriptorProto::clear_name() {
name_.ClearToEmpty(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(), GetArenaNoVirtual());
_has_bits_[0] &= ~0x00000001u;
}
inline const std::string& FieldDescriptorProto::name() const {
// @@protoc_insertion_point(field_get:google.protobuf.FieldDescriptorProto.name)
- return name_.Get();
+ return _internal_name();
}
inline void FieldDescriptorProto::set_name(const std::string& value) {
+ _internal_set_name(value);
+ // @@protoc_insertion_point(field_set:google.protobuf.FieldDescriptorProto.name)
+}
+inline std::string* FieldDescriptorProto::mutable_name() {
+ // @@protoc_insertion_point(field_mutable:google.protobuf.FieldDescriptorProto.name)
+ return _internal_mutable_name();
+}
+inline const std::string& FieldDescriptorProto::_internal_name() const {
+ return name_.Get();
+}
+inline void FieldDescriptorProto::_internal_set_name(const std::string& value) {
_has_bits_[0] |= 0x00000001u;
name_.Set(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(), value, GetArenaNoVirtual());
- // @@protoc_insertion_point(field_set:google.protobuf.FieldDescriptorProto.name)
}
inline void FieldDescriptorProto::set_name(std::string&& value) {
_has_bits_[0] |= 0x00000001u;
@@ -7750,9 +8270,8 @@
reinterpret_cast<const char*>(value), size), GetArenaNoVirtual());
// @@protoc_insertion_point(field_set_pointer:google.protobuf.FieldDescriptorProto.name)
}
-inline std::string* FieldDescriptorProto::mutable_name() {
+inline std::string* FieldDescriptorProto::_internal_mutable_name() {
_has_bits_[0] |= 0x00000001u;
- // @@protoc_insertion_point(field_mutable:google.protobuf.FieldDescriptorProto.name)
return name_.Mutable(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(), GetArenaNoVirtual());
}
inline std::string* FieldDescriptorProto::release_name() {
@@ -7794,9 +8313,12 @@
}
// optional int32 number = 3;
-inline bool FieldDescriptorProto::has_number() const {
+inline bool FieldDescriptorProto::_internal_has_number() const {
return (_has_bits_[0] & 0x00000040u) != 0;
}
+inline bool FieldDescriptorProto::has_number() const {
+ return _internal_has_number();
+}
inline void FieldDescriptorProto::clear_number() {
number_ = 0;
_has_bits_[0] &= ~0x00000040u;
@@ -7812,9 +8334,12 @@
}
// optional .google.protobuf.FieldDescriptorProto.Label label = 4;
-inline bool FieldDescriptorProto::has_label() const {
+inline bool FieldDescriptorProto::_internal_has_label() const {
return (_has_bits_[0] & 0x00000100u) != 0;
}
+inline bool FieldDescriptorProto::has_label() const {
+ return _internal_has_label();
+}
inline void FieldDescriptorProto::clear_label() {
label_ = 1;
_has_bits_[0] &= ~0x00000100u;
@@ -7831,9 +8356,12 @@
}
// optional .google.protobuf.FieldDescriptorProto.Type type = 5;
-inline bool FieldDescriptorProto::has_type() const {
+inline bool FieldDescriptorProto::_internal_has_type() const {
return (_has_bits_[0] & 0x00000200u) != 0;
}
+inline bool FieldDescriptorProto::has_type() const {
+ return _internal_has_type();
+}
inline void FieldDescriptorProto::clear_type() {
type_ = 1;
_has_bits_[0] &= ~0x00000200u;
@@ -7850,21 +8378,34 @@
}
// optional string type_name = 6;
-inline bool FieldDescriptorProto::has_type_name() const {
+inline bool FieldDescriptorProto::_internal_has_type_name() const {
return (_has_bits_[0] & 0x00000004u) != 0;
}
+inline bool FieldDescriptorProto::has_type_name() const {
+ return _internal_has_type_name();
+}
inline void FieldDescriptorProto::clear_type_name() {
type_name_.ClearToEmpty(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(), GetArenaNoVirtual());
_has_bits_[0] &= ~0x00000004u;
}
inline const std::string& FieldDescriptorProto::type_name() const {
// @@protoc_insertion_point(field_get:google.protobuf.FieldDescriptorProto.type_name)
- return type_name_.Get();
+ return _internal_type_name();
}
inline void FieldDescriptorProto::set_type_name(const std::string& value) {
+ _internal_set_type_name(value);
+ // @@protoc_insertion_point(field_set:google.protobuf.FieldDescriptorProto.type_name)
+}
+inline std::string* FieldDescriptorProto::mutable_type_name() {
+ // @@protoc_insertion_point(field_mutable:google.protobuf.FieldDescriptorProto.type_name)
+ return _internal_mutable_type_name();
+}
+inline const std::string& FieldDescriptorProto::_internal_type_name() const {
+ return type_name_.Get();
+}
+inline void FieldDescriptorProto::_internal_set_type_name(const std::string& value) {
_has_bits_[0] |= 0x00000004u;
type_name_.Set(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(), value, GetArenaNoVirtual());
- // @@protoc_insertion_point(field_set:google.protobuf.FieldDescriptorProto.type_name)
}
inline void FieldDescriptorProto::set_type_name(std::string&& value) {
_has_bits_[0] |= 0x00000004u;
@@ -7886,9 +8427,8 @@
reinterpret_cast<const char*>(value), size), GetArenaNoVirtual());
// @@protoc_insertion_point(field_set_pointer:google.protobuf.FieldDescriptorProto.type_name)
}
-inline std::string* FieldDescriptorProto::mutable_type_name() {
+inline std::string* FieldDescriptorProto::_internal_mutable_type_name() {
_has_bits_[0] |= 0x00000004u;
- // @@protoc_insertion_point(field_mutable:google.protobuf.FieldDescriptorProto.type_name)
return type_name_.Mutable(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(), GetArenaNoVirtual());
}
inline std::string* FieldDescriptorProto::release_type_name() {
@@ -7930,21 +8470,34 @@
}
// optional string extendee = 2;
-inline bool FieldDescriptorProto::has_extendee() const {
+inline bool FieldDescriptorProto::_internal_has_extendee() const {
return (_has_bits_[0] & 0x00000002u) != 0;
}
+inline bool FieldDescriptorProto::has_extendee() const {
+ return _internal_has_extendee();
+}
inline void FieldDescriptorProto::clear_extendee() {
extendee_.ClearToEmpty(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(), GetArenaNoVirtual());
_has_bits_[0] &= ~0x00000002u;
}
inline const std::string& FieldDescriptorProto::extendee() const {
// @@protoc_insertion_point(field_get:google.protobuf.FieldDescriptorProto.extendee)
- return extendee_.Get();
+ return _internal_extendee();
}
inline void FieldDescriptorProto::set_extendee(const std::string& value) {
+ _internal_set_extendee(value);
+ // @@protoc_insertion_point(field_set:google.protobuf.FieldDescriptorProto.extendee)
+}
+inline std::string* FieldDescriptorProto::mutable_extendee() {
+ // @@protoc_insertion_point(field_mutable:google.protobuf.FieldDescriptorProto.extendee)
+ return _internal_mutable_extendee();
+}
+inline const std::string& FieldDescriptorProto::_internal_extendee() const {
+ return extendee_.Get();
+}
+inline void FieldDescriptorProto::_internal_set_extendee(const std::string& value) {
_has_bits_[0] |= 0x00000002u;
extendee_.Set(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(), value, GetArenaNoVirtual());
- // @@protoc_insertion_point(field_set:google.protobuf.FieldDescriptorProto.extendee)
}
inline void FieldDescriptorProto::set_extendee(std::string&& value) {
_has_bits_[0] |= 0x00000002u;
@@ -7966,9 +8519,8 @@
reinterpret_cast<const char*>(value), size), GetArenaNoVirtual());
// @@protoc_insertion_point(field_set_pointer:google.protobuf.FieldDescriptorProto.extendee)
}
-inline std::string* FieldDescriptorProto::mutable_extendee() {
+inline std::string* FieldDescriptorProto::_internal_mutable_extendee() {
_has_bits_[0] |= 0x00000002u;
- // @@protoc_insertion_point(field_mutable:google.protobuf.FieldDescriptorProto.extendee)
return extendee_.Mutable(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(), GetArenaNoVirtual());
}
inline std::string* FieldDescriptorProto::release_extendee() {
@@ -8010,21 +8562,34 @@
}
// optional string default_value = 7;
-inline bool FieldDescriptorProto::has_default_value() const {
+inline bool FieldDescriptorProto::_internal_has_default_value() const {
return (_has_bits_[0] & 0x00000008u) != 0;
}
+inline bool FieldDescriptorProto::has_default_value() const {
+ return _internal_has_default_value();
+}
inline void FieldDescriptorProto::clear_default_value() {
default_value_.ClearToEmpty(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(), GetArenaNoVirtual());
_has_bits_[0] &= ~0x00000008u;
}
inline const std::string& FieldDescriptorProto::default_value() const {
// @@protoc_insertion_point(field_get:google.protobuf.FieldDescriptorProto.default_value)
- return default_value_.Get();
+ return _internal_default_value();
}
inline void FieldDescriptorProto::set_default_value(const std::string& value) {
+ _internal_set_default_value(value);
+ // @@protoc_insertion_point(field_set:google.protobuf.FieldDescriptorProto.default_value)
+}
+inline std::string* FieldDescriptorProto::mutable_default_value() {
+ // @@protoc_insertion_point(field_mutable:google.protobuf.FieldDescriptorProto.default_value)
+ return _internal_mutable_default_value();
+}
+inline const std::string& FieldDescriptorProto::_internal_default_value() const {
+ return default_value_.Get();
+}
+inline void FieldDescriptorProto::_internal_set_default_value(const std::string& value) {
_has_bits_[0] |= 0x00000008u;
default_value_.Set(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(), value, GetArenaNoVirtual());
- // @@protoc_insertion_point(field_set:google.protobuf.FieldDescriptorProto.default_value)
}
inline void FieldDescriptorProto::set_default_value(std::string&& value) {
_has_bits_[0] |= 0x00000008u;
@@ -8046,9 +8611,8 @@
reinterpret_cast<const char*>(value), size), GetArenaNoVirtual());
// @@protoc_insertion_point(field_set_pointer:google.protobuf.FieldDescriptorProto.default_value)
}
-inline std::string* FieldDescriptorProto::mutable_default_value() {
+inline std::string* FieldDescriptorProto::_internal_mutable_default_value() {
_has_bits_[0] |= 0x00000008u;
- // @@protoc_insertion_point(field_mutable:google.protobuf.FieldDescriptorProto.default_value)
return default_value_.Mutable(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(), GetArenaNoVirtual());
}
inline std::string* FieldDescriptorProto::release_default_value() {
@@ -8090,9 +8654,12 @@
}
// optional int32 oneof_index = 9;
-inline bool FieldDescriptorProto::has_oneof_index() const {
+inline bool FieldDescriptorProto::_internal_has_oneof_index() const {
return (_has_bits_[0] & 0x00000080u) != 0;
}
+inline bool FieldDescriptorProto::has_oneof_index() const {
+ return _internal_has_oneof_index();
+}
inline void FieldDescriptorProto::clear_oneof_index() {
oneof_index_ = 0;
_has_bits_[0] &= ~0x00000080u;
@@ -8108,21 +8675,34 @@
}
// optional string json_name = 10;
-inline bool FieldDescriptorProto::has_json_name() const {
+inline bool FieldDescriptorProto::_internal_has_json_name() const {
return (_has_bits_[0] & 0x00000010u) != 0;
}
+inline bool FieldDescriptorProto::has_json_name() const {
+ return _internal_has_json_name();
+}
inline void FieldDescriptorProto::clear_json_name() {
json_name_.ClearToEmpty(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(), GetArenaNoVirtual());
_has_bits_[0] &= ~0x00000010u;
}
inline const std::string& FieldDescriptorProto::json_name() const {
// @@protoc_insertion_point(field_get:google.protobuf.FieldDescriptorProto.json_name)
- return json_name_.Get();
+ return _internal_json_name();
}
inline void FieldDescriptorProto::set_json_name(const std::string& value) {
+ _internal_set_json_name(value);
+ // @@protoc_insertion_point(field_set:google.protobuf.FieldDescriptorProto.json_name)
+}
+inline std::string* FieldDescriptorProto::mutable_json_name() {
+ // @@protoc_insertion_point(field_mutable:google.protobuf.FieldDescriptorProto.json_name)
+ return _internal_mutable_json_name();
+}
+inline const std::string& FieldDescriptorProto::_internal_json_name() const {
+ return json_name_.Get();
+}
+inline void FieldDescriptorProto::_internal_set_json_name(const std::string& value) {
_has_bits_[0] |= 0x00000010u;
json_name_.Set(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(), value, GetArenaNoVirtual());
- // @@protoc_insertion_point(field_set:google.protobuf.FieldDescriptorProto.json_name)
}
inline void FieldDescriptorProto::set_json_name(std::string&& value) {
_has_bits_[0] |= 0x00000010u;
@@ -8144,9 +8724,8 @@
reinterpret_cast<const char*>(value), size), GetArenaNoVirtual());
// @@protoc_insertion_point(field_set_pointer:google.protobuf.FieldDescriptorProto.json_name)
}
-inline std::string* FieldDescriptorProto::mutable_json_name() {
+inline std::string* FieldDescriptorProto::_internal_mutable_json_name() {
_has_bits_[0] |= 0x00000010u;
- // @@protoc_insertion_point(field_mutable:google.protobuf.FieldDescriptorProto.json_name)
return json_name_.Mutable(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(), GetArenaNoVirtual());
}
inline std::string* FieldDescriptorProto::release_json_name() {
@@ -8188,9 +8767,12 @@
}
// optional .google.protobuf.FieldOptions options = 8;
-inline bool FieldDescriptorProto::has_options() const {
+inline bool FieldDescriptorProto::_internal_has_options() const {
return (_has_bits_[0] & 0x00000020u) != 0;
}
+inline bool FieldDescriptorProto::has_options() const {
+ return _internal_has_options();
+}
inline void FieldDescriptorProto::clear_options() {
if (options_ != nullptr) options_->Clear();
_has_bits_[0] &= ~0x00000020u;
@@ -8202,17 +8784,14 @@
&PROTOBUF_NAMESPACE_ID::_FieldOptions_default_instance_);
}
inline PROTOBUF_NAMESPACE_ID::FieldOptions* FieldDescriptorProto::release_options() {
- // @@protoc_insertion_point(field_release:google.protobuf.FieldDescriptorProto.options)
- _has_bits_[0] &= ~0x00000020u;
- PROTOBUF_NAMESPACE_ID::FieldOptions* temp = options_;
+ auto temp = unsafe_arena_release_options();
if (GetArenaNoVirtual() != nullptr) {
temp = ::PROTOBUF_NAMESPACE_ID::internal::DuplicateIfNonNull(temp);
}
- options_ = nullptr;
return temp;
}
inline PROTOBUF_NAMESPACE_ID::FieldOptions* FieldDescriptorProto::unsafe_arena_release_options() {
- // @@protoc_insertion_point(field_unsafe_arena_release:google.protobuf.FieldDescriptorProto.options)
+ // @@protoc_insertion_point(field_release:google.protobuf.FieldDescriptorProto.options)
_has_bits_[0] &= ~0x00000020u;
PROTOBUF_NAMESPACE_ID::FieldOptions* temp = options_;
options_ = nullptr;
@@ -8252,21 +8831,34 @@
// OneofDescriptorProto
// optional string name = 1;
-inline bool OneofDescriptorProto::has_name() const {
+inline bool OneofDescriptorProto::_internal_has_name() const {
return (_has_bits_[0] & 0x00000001u) != 0;
}
+inline bool OneofDescriptorProto::has_name() const {
+ return _internal_has_name();
+}
inline void OneofDescriptorProto::clear_name() {
name_.ClearToEmpty(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(), GetArenaNoVirtual());
_has_bits_[0] &= ~0x00000001u;
}
inline const std::string& OneofDescriptorProto::name() const {
// @@protoc_insertion_point(field_get:google.protobuf.OneofDescriptorProto.name)
- return name_.Get();
+ return _internal_name();
}
inline void OneofDescriptorProto::set_name(const std::string& value) {
+ _internal_set_name(value);
+ // @@protoc_insertion_point(field_set:google.protobuf.OneofDescriptorProto.name)
+}
+inline std::string* OneofDescriptorProto::mutable_name() {
+ // @@protoc_insertion_point(field_mutable:google.protobuf.OneofDescriptorProto.name)
+ return _internal_mutable_name();
+}
+inline const std::string& OneofDescriptorProto::_internal_name() const {
+ return name_.Get();
+}
+inline void OneofDescriptorProto::_internal_set_name(const std::string& value) {
_has_bits_[0] |= 0x00000001u;
name_.Set(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(), value, GetArenaNoVirtual());
- // @@protoc_insertion_point(field_set:google.protobuf.OneofDescriptorProto.name)
}
inline void OneofDescriptorProto::set_name(std::string&& value) {
_has_bits_[0] |= 0x00000001u;
@@ -8288,9 +8880,8 @@
reinterpret_cast<const char*>(value), size), GetArenaNoVirtual());
// @@protoc_insertion_point(field_set_pointer:google.protobuf.OneofDescriptorProto.name)
}
-inline std::string* OneofDescriptorProto::mutable_name() {
+inline std::string* OneofDescriptorProto::_internal_mutable_name() {
_has_bits_[0] |= 0x00000001u;
- // @@protoc_insertion_point(field_mutable:google.protobuf.OneofDescriptorProto.name)
return name_.Mutable(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(), GetArenaNoVirtual());
}
inline std::string* OneofDescriptorProto::release_name() {
@@ -8332,9 +8923,12 @@
}
// optional .google.protobuf.OneofOptions options = 2;
-inline bool OneofDescriptorProto::has_options() const {
+inline bool OneofDescriptorProto::_internal_has_options() const {
return (_has_bits_[0] & 0x00000002u) != 0;
}
+inline bool OneofDescriptorProto::has_options() const {
+ return _internal_has_options();
+}
inline void OneofDescriptorProto::clear_options() {
if (options_ != nullptr) options_->Clear();
_has_bits_[0] &= ~0x00000002u;
@@ -8346,17 +8940,14 @@
&PROTOBUF_NAMESPACE_ID::_OneofOptions_default_instance_);
}
inline PROTOBUF_NAMESPACE_ID::OneofOptions* OneofDescriptorProto::release_options() {
- // @@protoc_insertion_point(field_release:google.protobuf.OneofDescriptorProto.options)
- _has_bits_[0] &= ~0x00000002u;
- PROTOBUF_NAMESPACE_ID::OneofOptions* temp = options_;
+ auto temp = unsafe_arena_release_options();
if (GetArenaNoVirtual() != nullptr) {
temp = ::PROTOBUF_NAMESPACE_ID::internal::DuplicateIfNonNull(temp);
}
- options_ = nullptr;
return temp;
}
inline PROTOBUF_NAMESPACE_ID::OneofOptions* OneofDescriptorProto::unsafe_arena_release_options() {
- // @@protoc_insertion_point(field_unsafe_arena_release:google.protobuf.OneofDescriptorProto.options)
+ // @@protoc_insertion_point(field_release:google.protobuf.OneofDescriptorProto.options)
_has_bits_[0] &= ~0x00000002u;
PROTOBUF_NAMESPACE_ID::OneofOptions* temp = options_;
options_ = nullptr;
@@ -8396,9 +8987,12 @@
// EnumDescriptorProto_EnumReservedRange
// optional int32 start = 1;
-inline bool EnumDescriptorProto_EnumReservedRange::has_start() const {
+inline bool EnumDescriptorProto_EnumReservedRange::_internal_has_start() const {
return (_has_bits_[0] & 0x00000001u) != 0;
}
+inline bool EnumDescriptorProto_EnumReservedRange::has_start() const {
+ return _internal_has_start();
+}
inline void EnumDescriptorProto_EnumReservedRange::clear_start() {
start_ = 0;
_has_bits_[0] &= ~0x00000001u;
@@ -8414,9 +9008,12 @@
}
// optional int32 end = 2;
-inline bool EnumDescriptorProto_EnumReservedRange::has_end() const {
+inline bool EnumDescriptorProto_EnumReservedRange::_internal_has_end() const {
return (_has_bits_[0] & 0x00000002u) != 0;
}
+inline bool EnumDescriptorProto_EnumReservedRange::has_end() const {
+ return _internal_has_end();
+}
inline void EnumDescriptorProto_EnumReservedRange::clear_end() {
end_ = 0;
_has_bits_[0] &= ~0x00000002u;
@@ -8436,21 +9033,34 @@
// EnumDescriptorProto
// optional string name = 1;
-inline bool EnumDescriptorProto::has_name() const {
+inline bool EnumDescriptorProto::_internal_has_name() const {
return (_has_bits_[0] & 0x00000001u) != 0;
}
+inline bool EnumDescriptorProto::has_name() const {
+ return _internal_has_name();
+}
inline void EnumDescriptorProto::clear_name() {
name_.ClearToEmpty(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(), GetArenaNoVirtual());
_has_bits_[0] &= ~0x00000001u;
}
inline const std::string& EnumDescriptorProto::name() const {
// @@protoc_insertion_point(field_get:google.protobuf.EnumDescriptorProto.name)
- return name_.Get();
+ return _internal_name();
}
inline void EnumDescriptorProto::set_name(const std::string& value) {
+ _internal_set_name(value);
+ // @@protoc_insertion_point(field_set:google.protobuf.EnumDescriptorProto.name)
+}
+inline std::string* EnumDescriptorProto::mutable_name() {
+ // @@protoc_insertion_point(field_mutable:google.protobuf.EnumDescriptorProto.name)
+ return _internal_mutable_name();
+}
+inline const std::string& EnumDescriptorProto::_internal_name() const {
+ return name_.Get();
+}
+inline void EnumDescriptorProto::_internal_set_name(const std::string& value) {
_has_bits_[0] |= 0x00000001u;
name_.Set(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(), value, GetArenaNoVirtual());
- // @@protoc_insertion_point(field_set:google.protobuf.EnumDescriptorProto.name)
}
inline void EnumDescriptorProto::set_name(std::string&& value) {
_has_bits_[0] |= 0x00000001u;
@@ -8472,9 +9082,8 @@
reinterpret_cast<const char*>(value), size), GetArenaNoVirtual());
// @@protoc_insertion_point(field_set_pointer:google.protobuf.EnumDescriptorProto.name)
}
-inline std::string* EnumDescriptorProto::mutable_name() {
+inline std::string* EnumDescriptorProto::_internal_mutable_name() {
_has_bits_[0] |= 0x00000001u;
- // @@protoc_insertion_point(field_mutable:google.protobuf.EnumDescriptorProto.name)
return name_.Mutable(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(), GetArenaNoVirtual());
}
inline std::string* EnumDescriptorProto::release_name() {
@@ -8546,9 +9155,12 @@
}
// optional .google.protobuf.EnumOptions options = 3;
-inline bool EnumDescriptorProto::has_options() const {
+inline bool EnumDescriptorProto::_internal_has_options() const {
return (_has_bits_[0] & 0x00000002u) != 0;
}
+inline bool EnumDescriptorProto::has_options() const {
+ return _internal_has_options();
+}
inline void EnumDescriptorProto::clear_options() {
if (options_ != nullptr) options_->Clear();
_has_bits_[0] &= ~0x00000002u;
@@ -8560,17 +9172,14 @@
&PROTOBUF_NAMESPACE_ID::_EnumOptions_default_instance_);
}
inline PROTOBUF_NAMESPACE_ID::EnumOptions* EnumDescriptorProto::release_options() {
- // @@protoc_insertion_point(field_release:google.protobuf.EnumDescriptorProto.options)
- _has_bits_[0] &= ~0x00000002u;
- PROTOBUF_NAMESPACE_ID::EnumOptions* temp = options_;
+ auto temp = unsafe_arena_release_options();
if (GetArenaNoVirtual() != nullptr) {
temp = ::PROTOBUF_NAMESPACE_ID::internal::DuplicateIfNonNull(temp);
}
- options_ = nullptr;
return temp;
}
inline PROTOBUF_NAMESPACE_ID::EnumOptions* EnumDescriptorProto::unsafe_arena_release_options() {
- // @@protoc_insertion_point(field_unsafe_arena_release:google.protobuf.EnumDescriptorProto.options)
+ // @@protoc_insertion_point(field_release:google.protobuf.EnumDescriptorProto.options)
_has_bits_[0] &= ~0x00000002u;
PROTOBUF_NAMESPACE_ID::EnumOptions* temp = options_;
options_ = nullptr;
@@ -8642,6 +9251,10 @@
inline void EnumDescriptorProto::clear_reserved_name() {
reserved_name_.Clear();
}
+inline std::string* EnumDescriptorProto::add_reserved_name() {
+ // @@protoc_insertion_point(field_add_mutable:google.protobuf.EnumDescriptorProto.reserved_name)
+ return _internal_add_reserved_name();
+}
inline const std::string& EnumDescriptorProto::reserved_name(int index) const {
// @@protoc_insertion_point(field_get:google.protobuf.EnumDescriptorProto.reserved_name)
return reserved_name_.Get(index);
@@ -8668,8 +9281,7 @@
reinterpret_cast<const char*>(value), size);
// @@protoc_insertion_point(field_set_pointer:google.protobuf.EnumDescriptorProto.reserved_name)
}
-inline std::string* EnumDescriptorProto::add_reserved_name() {
- // @@protoc_insertion_point(field_add_mutable:google.protobuf.EnumDescriptorProto.reserved_name)
+inline std::string* EnumDescriptorProto::_internal_add_reserved_name() {
return reserved_name_.Add();
}
inline void EnumDescriptorProto::add_reserved_name(const std::string& value) {
@@ -8705,21 +9317,34 @@
// EnumValueDescriptorProto
// optional string name = 1;
-inline bool EnumValueDescriptorProto::has_name() const {
+inline bool EnumValueDescriptorProto::_internal_has_name() const {
return (_has_bits_[0] & 0x00000001u) != 0;
}
+inline bool EnumValueDescriptorProto::has_name() const {
+ return _internal_has_name();
+}
inline void EnumValueDescriptorProto::clear_name() {
name_.ClearToEmpty(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(), GetArenaNoVirtual());
_has_bits_[0] &= ~0x00000001u;
}
inline const std::string& EnumValueDescriptorProto::name() const {
// @@protoc_insertion_point(field_get:google.protobuf.EnumValueDescriptorProto.name)
- return name_.Get();
+ return _internal_name();
}
inline void EnumValueDescriptorProto::set_name(const std::string& value) {
+ _internal_set_name(value);
+ // @@protoc_insertion_point(field_set:google.protobuf.EnumValueDescriptorProto.name)
+}
+inline std::string* EnumValueDescriptorProto::mutable_name() {
+ // @@protoc_insertion_point(field_mutable:google.protobuf.EnumValueDescriptorProto.name)
+ return _internal_mutable_name();
+}
+inline const std::string& EnumValueDescriptorProto::_internal_name() const {
+ return name_.Get();
+}
+inline void EnumValueDescriptorProto::_internal_set_name(const std::string& value) {
_has_bits_[0] |= 0x00000001u;
name_.Set(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(), value, GetArenaNoVirtual());
- // @@protoc_insertion_point(field_set:google.protobuf.EnumValueDescriptorProto.name)
}
inline void EnumValueDescriptorProto::set_name(std::string&& value) {
_has_bits_[0] |= 0x00000001u;
@@ -8741,9 +9366,8 @@
reinterpret_cast<const char*>(value), size), GetArenaNoVirtual());
// @@protoc_insertion_point(field_set_pointer:google.protobuf.EnumValueDescriptorProto.name)
}
-inline std::string* EnumValueDescriptorProto::mutable_name() {
+inline std::string* EnumValueDescriptorProto::_internal_mutable_name() {
_has_bits_[0] |= 0x00000001u;
- // @@protoc_insertion_point(field_mutable:google.protobuf.EnumValueDescriptorProto.name)
return name_.Mutable(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(), GetArenaNoVirtual());
}
inline std::string* EnumValueDescriptorProto::release_name() {
@@ -8785,9 +9409,12 @@
}
// optional int32 number = 2;
-inline bool EnumValueDescriptorProto::has_number() const {
+inline bool EnumValueDescriptorProto::_internal_has_number() const {
return (_has_bits_[0] & 0x00000004u) != 0;
}
+inline bool EnumValueDescriptorProto::has_number() const {
+ return _internal_has_number();
+}
inline void EnumValueDescriptorProto::clear_number() {
number_ = 0;
_has_bits_[0] &= ~0x00000004u;
@@ -8803,9 +9430,12 @@
}
// optional .google.protobuf.EnumValueOptions options = 3;
-inline bool EnumValueDescriptorProto::has_options() const {
+inline bool EnumValueDescriptorProto::_internal_has_options() const {
return (_has_bits_[0] & 0x00000002u) != 0;
}
+inline bool EnumValueDescriptorProto::has_options() const {
+ return _internal_has_options();
+}
inline void EnumValueDescriptorProto::clear_options() {
if (options_ != nullptr) options_->Clear();
_has_bits_[0] &= ~0x00000002u;
@@ -8817,17 +9447,14 @@
&PROTOBUF_NAMESPACE_ID::_EnumValueOptions_default_instance_);
}
inline PROTOBUF_NAMESPACE_ID::EnumValueOptions* EnumValueDescriptorProto::release_options() {
- // @@protoc_insertion_point(field_release:google.protobuf.EnumValueDescriptorProto.options)
- _has_bits_[0] &= ~0x00000002u;
- PROTOBUF_NAMESPACE_ID::EnumValueOptions* temp = options_;
+ auto temp = unsafe_arena_release_options();
if (GetArenaNoVirtual() != nullptr) {
temp = ::PROTOBUF_NAMESPACE_ID::internal::DuplicateIfNonNull(temp);
}
- options_ = nullptr;
return temp;
}
inline PROTOBUF_NAMESPACE_ID::EnumValueOptions* EnumValueDescriptorProto::unsafe_arena_release_options() {
- // @@protoc_insertion_point(field_unsafe_arena_release:google.protobuf.EnumValueDescriptorProto.options)
+ // @@protoc_insertion_point(field_release:google.protobuf.EnumValueDescriptorProto.options)
_has_bits_[0] &= ~0x00000002u;
PROTOBUF_NAMESPACE_ID::EnumValueOptions* temp = options_;
options_ = nullptr;
@@ -8867,21 +9494,34 @@
// ServiceDescriptorProto
// optional string name = 1;
-inline bool ServiceDescriptorProto::has_name() const {
+inline bool ServiceDescriptorProto::_internal_has_name() const {
return (_has_bits_[0] & 0x00000001u) != 0;
}
+inline bool ServiceDescriptorProto::has_name() const {
+ return _internal_has_name();
+}
inline void ServiceDescriptorProto::clear_name() {
name_.ClearToEmpty(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(), GetArenaNoVirtual());
_has_bits_[0] &= ~0x00000001u;
}
inline const std::string& ServiceDescriptorProto::name() const {
// @@protoc_insertion_point(field_get:google.protobuf.ServiceDescriptorProto.name)
- return name_.Get();
+ return _internal_name();
}
inline void ServiceDescriptorProto::set_name(const std::string& value) {
+ _internal_set_name(value);
+ // @@protoc_insertion_point(field_set:google.protobuf.ServiceDescriptorProto.name)
+}
+inline std::string* ServiceDescriptorProto::mutable_name() {
+ // @@protoc_insertion_point(field_mutable:google.protobuf.ServiceDescriptorProto.name)
+ return _internal_mutable_name();
+}
+inline const std::string& ServiceDescriptorProto::_internal_name() const {
+ return name_.Get();
+}
+inline void ServiceDescriptorProto::_internal_set_name(const std::string& value) {
_has_bits_[0] |= 0x00000001u;
name_.Set(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(), value, GetArenaNoVirtual());
- // @@protoc_insertion_point(field_set:google.protobuf.ServiceDescriptorProto.name)
}
inline void ServiceDescriptorProto::set_name(std::string&& value) {
_has_bits_[0] |= 0x00000001u;
@@ -8903,9 +9543,8 @@
reinterpret_cast<const char*>(value), size), GetArenaNoVirtual());
// @@protoc_insertion_point(field_set_pointer:google.protobuf.ServiceDescriptorProto.name)
}
-inline std::string* ServiceDescriptorProto::mutable_name() {
+inline std::string* ServiceDescriptorProto::_internal_mutable_name() {
_has_bits_[0] |= 0x00000001u;
- // @@protoc_insertion_point(field_mutable:google.protobuf.ServiceDescriptorProto.name)
return name_.Mutable(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(), GetArenaNoVirtual());
}
inline std::string* ServiceDescriptorProto::release_name() {
@@ -8977,9 +9616,12 @@
}
// optional .google.protobuf.ServiceOptions options = 3;
-inline bool ServiceDescriptorProto::has_options() const {
+inline bool ServiceDescriptorProto::_internal_has_options() const {
return (_has_bits_[0] & 0x00000002u) != 0;
}
+inline bool ServiceDescriptorProto::has_options() const {
+ return _internal_has_options();
+}
inline void ServiceDescriptorProto::clear_options() {
if (options_ != nullptr) options_->Clear();
_has_bits_[0] &= ~0x00000002u;
@@ -8991,17 +9633,14 @@
&PROTOBUF_NAMESPACE_ID::_ServiceOptions_default_instance_);
}
inline PROTOBUF_NAMESPACE_ID::ServiceOptions* ServiceDescriptorProto::release_options() {
- // @@protoc_insertion_point(field_release:google.protobuf.ServiceDescriptorProto.options)
- _has_bits_[0] &= ~0x00000002u;
- PROTOBUF_NAMESPACE_ID::ServiceOptions* temp = options_;
+ auto temp = unsafe_arena_release_options();
if (GetArenaNoVirtual() != nullptr) {
temp = ::PROTOBUF_NAMESPACE_ID::internal::DuplicateIfNonNull(temp);
}
- options_ = nullptr;
return temp;
}
inline PROTOBUF_NAMESPACE_ID::ServiceOptions* ServiceDescriptorProto::unsafe_arena_release_options() {
- // @@protoc_insertion_point(field_unsafe_arena_release:google.protobuf.ServiceDescriptorProto.options)
+ // @@protoc_insertion_point(field_release:google.protobuf.ServiceDescriptorProto.options)
_has_bits_[0] &= ~0x00000002u;
PROTOBUF_NAMESPACE_ID::ServiceOptions* temp = options_;
options_ = nullptr;
@@ -9041,21 +9680,34 @@
// MethodDescriptorProto
// optional string name = 1;
-inline bool MethodDescriptorProto::has_name() const {
+inline bool MethodDescriptorProto::_internal_has_name() const {
return (_has_bits_[0] & 0x00000001u) != 0;
}
+inline bool MethodDescriptorProto::has_name() const {
+ return _internal_has_name();
+}
inline void MethodDescriptorProto::clear_name() {
name_.ClearToEmpty(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(), GetArenaNoVirtual());
_has_bits_[0] &= ~0x00000001u;
}
inline const std::string& MethodDescriptorProto::name() const {
// @@protoc_insertion_point(field_get:google.protobuf.MethodDescriptorProto.name)
- return name_.Get();
+ return _internal_name();
}
inline void MethodDescriptorProto::set_name(const std::string& value) {
+ _internal_set_name(value);
+ // @@protoc_insertion_point(field_set:google.protobuf.MethodDescriptorProto.name)
+}
+inline std::string* MethodDescriptorProto::mutable_name() {
+ // @@protoc_insertion_point(field_mutable:google.protobuf.MethodDescriptorProto.name)
+ return _internal_mutable_name();
+}
+inline const std::string& MethodDescriptorProto::_internal_name() const {
+ return name_.Get();
+}
+inline void MethodDescriptorProto::_internal_set_name(const std::string& value) {
_has_bits_[0] |= 0x00000001u;
name_.Set(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(), value, GetArenaNoVirtual());
- // @@protoc_insertion_point(field_set:google.protobuf.MethodDescriptorProto.name)
}
inline void MethodDescriptorProto::set_name(std::string&& value) {
_has_bits_[0] |= 0x00000001u;
@@ -9077,9 +9729,8 @@
reinterpret_cast<const char*>(value), size), GetArenaNoVirtual());
// @@protoc_insertion_point(field_set_pointer:google.protobuf.MethodDescriptorProto.name)
}
-inline std::string* MethodDescriptorProto::mutable_name() {
+inline std::string* MethodDescriptorProto::_internal_mutable_name() {
_has_bits_[0] |= 0x00000001u;
- // @@protoc_insertion_point(field_mutable:google.protobuf.MethodDescriptorProto.name)
return name_.Mutable(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(), GetArenaNoVirtual());
}
inline std::string* MethodDescriptorProto::release_name() {
@@ -9121,21 +9772,34 @@
}
// optional string input_type = 2;
-inline bool MethodDescriptorProto::has_input_type() const {
+inline bool MethodDescriptorProto::_internal_has_input_type() const {
return (_has_bits_[0] & 0x00000002u) != 0;
}
+inline bool MethodDescriptorProto::has_input_type() const {
+ return _internal_has_input_type();
+}
inline void MethodDescriptorProto::clear_input_type() {
input_type_.ClearToEmpty(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(), GetArenaNoVirtual());
_has_bits_[0] &= ~0x00000002u;
}
inline const std::string& MethodDescriptorProto::input_type() const {
// @@protoc_insertion_point(field_get:google.protobuf.MethodDescriptorProto.input_type)
- return input_type_.Get();
+ return _internal_input_type();
}
inline void MethodDescriptorProto::set_input_type(const std::string& value) {
+ _internal_set_input_type(value);
+ // @@protoc_insertion_point(field_set:google.protobuf.MethodDescriptorProto.input_type)
+}
+inline std::string* MethodDescriptorProto::mutable_input_type() {
+ // @@protoc_insertion_point(field_mutable:google.protobuf.MethodDescriptorProto.input_type)
+ return _internal_mutable_input_type();
+}
+inline const std::string& MethodDescriptorProto::_internal_input_type() const {
+ return input_type_.Get();
+}
+inline void MethodDescriptorProto::_internal_set_input_type(const std::string& value) {
_has_bits_[0] |= 0x00000002u;
input_type_.Set(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(), value, GetArenaNoVirtual());
- // @@protoc_insertion_point(field_set:google.protobuf.MethodDescriptorProto.input_type)
}
inline void MethodDescriptorProto::set_input_type(std::string&& value) {
_has_bits_[0] |= 0x00000002u;
@@ -9157,9 +9821,8 @@
reinterpret_cast<const char*>(value), size), GetArenaNoVirtual());
// @@protoc_insertion_point(field_set_pointer:google.protobuf.MethodDescriptorProto.input_type)
}
-inline std::string* MethodDescriptorProto::mutable_input_type() {
+inline std::string* MethodDescriptorProto::_internal_mutable_input_type() {
_has_bits_[0] |= 0x00000002u;
- // @@protoc_insertion_point(field_mutable:google.protobuf.MethodDescriptorProto.input_type)
return input_type_.Mutable(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(), GetArenaNoVirtual());
}
inline std::string* MethodDescriptorProto::release_input_type() {
@@ -9201,21 +9864,34 @@
}
// optional string output_type = 3;
-inline bool MethodDescriptorProto::has_output_type() const {
+inline bool MethodDescriptorProto::_internal_has_output_type() const {
return (_has_bits_[0] & 0x00000004u) != 0;
}
+inline bool MethodDescriptorProto::has_output_type() const {
+ return _internal_has_output_type();
+}
inline void MethodDescriptorProto::clear_output_type() {
output_type_.ClearToEmpty(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(), GetArenaNoVirtual());
_has_bits_[0] &= ~0x00000004u;
}
inline const std::string& MethodDescriptorProto::output_type() const {
// @@protoc_insertion_point(field_get:google.protobuf.MethodDescriptorProto.output_type)
- return output_type_.Get();
+ return _internal_output_type();
}
inline void MethodDescriptorProto::set_output_type(const std::string& value) {
+ _internal_set_output_type(value);
+ // @@protoc_insertion_point(field_set:google.protobuf.MethodDescriptorProto.output_type)
+}
+inline std::string* MethodDescriptorProto::mutable_output_type() {
+ // @@protoc_insertion_point(field_mutable:google.protobuf.MethodDescriptorProto.output_type)
+ return _internal_mutable_output_type();
+}
+inline const std::string& MethodDescriptorProto::_internal_output_type() const {
+ return output_type_.Get();
+}
+inline void MethodDescriptorProto::_internal_set_output_type(const std::string& value) {
_has_bits_[0] |= 0x00000004u;
output_type_.Set(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(), value, GetArenaNoVirtual());
- // @@protoc_insertion_point(field_set:google.protobuf.MethodDescriptorProto.output_type)
}
inline void MethodDescriptorProto::set_output_type(std::string&& value) {
_has_bits_[0] |= 0x00000004u;
@@ -9237,9 +9913,8 @@
reinterpret_cast<const char*>(value), size), GetArenaNoVirtual());
// @@protoc_insertion_point(field_set_pointer:google.protobuf.MethodDescriptorProto.output_type)
}
-inline std::string* MethodDescriptorProto::mutable_output_type() {
+inline std::string* MethodDescriptorProto::_internal_mutable_output_type() {
_has_bits_[0] |= 0x00000004u;
- // @@protoc_insertion_point(field_mutable:google.protobuf.MethodDescriptorProto.output_type)
return output_type_.Mutable(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(), GetArenaNoVirtual());
}
inline std::string* MethodDescriptorProto::release_output_type() {
@@ -9281,9 +9956,12 @@
}
// optional .google.protobuf.MethodOptions options = 4;
-inline bool MethodDescriptorProto::has_options() const {
+inline bool MethodDescriptorProto::_internal_has_options() const {
return (_has_bits_[0] & 0x00000008u) != 0;
}
+inline bool MethodDescriptorProto::has_options() const {
+ return _internal_has_options();
+}
inline void MethodDescriptorProto::clear_options() {
if (options_ != nullptr) options_->Clear();
_has_bits_[0] &= ~0x00000008u;
@@ -9295,17 +9973,14 @@
&PROTOBUF_NAMESPACE_ID::_MethodOptions_default_instance_);
}
inline PROTOBUF_NAMESPACE_ID::MethodOptions* MethodDescriptorProto::release_options() {
- // @@protoc_insertion_point(field_release:google.protobuf.MethodDescriptorProto.options)
- _has_bits_[0] &= ~0x00000008u;
- PROTOBUF_NAMESPACE_ID::MethodOptions* temp = options_;
+ auto temp = unsafe_arena_release_options();
if (GetArenaNoVirtual() != nullptr) {
temp = ::PROTOBUF_NAMESPACE_ID::internal::DuplicateIfNonNull(temp);
}
- options_ = nullptr;
return temp;
}
inline PROTOBUF_NAMESPACE_ID::MethodOptions* MethodDescriptorProto::unsafe_arena_release_options() {
- // @@protoc_insertion_point(field_unsafe_arena_release:google.protobuf.MethodDescriptorProto.options)
+ // @@protoc_insertion_point(field_release:google.protobuf.MethodDescriptorProto.options)
_has_bits_[0] &= ~0x00000008u;
PROTOBUF_NAMESPACE_ID::MethodOptions* temp = options_;
options_ = nullptr;
@@ -9341,9 +10016,12 @@
}
// optional bool client_streaming = 5 [default = false];
-inline bool MethodDescriptorProto::has_client_streaming() const {
+inline bool MethodDescriptorProto::_internal_has_client_streaming() const {
return (_has_bits_[0] & 0x00000010u) != 0;
}
+inline bool MethodDescriptorProto::has_client_streaming() const {
+ return _internal_has_client_streaming();
+}
inline void MethodDescriptorProto::clear_client_streaming() {
client_streaming_ = false;
_has_bits_[0] &= ~0x00000010u;
@@ -9359,9 +10037,12 @@
}
// optional bool server_streaming = 6 [default = false];
-inline bool MethodDescriptorProto::has_server_streaming() const {
+inline bool MethodDescriptorProto::_internal_has_server_streaming() const {
return (_has_bits_[0] & 0x00000020u) != 0;
}
+inline bool MethodDescriptorProto::has_server_streaming() const {
+ return _internal_has_server_streaming();
+}
inline void MethodDescriptorProto::clear_server_streaming() {
server_streaming_ = false;
_has_bits_[0] &= ~0x00000020u;
@@ -9381,21 +10062,34 @@
// FileOptions
// optional string java_package = 1;
-inline bool FileOptions::has_java_package() const {
+inline bool FileOptions::_internal_has_java_package() const {
return (_has_bits_[0] & 0x00000001u) != 0;
}
+inline bool FileOptions::has_java_package() const {
+ return _internal_has_java_package();
+}
inline void FileOptions::clear_java_package() {
java_package_.ClearToEmpty(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(), GetArenaNoVirtual());
_has_bits_[0] &= ~0x00000001u;
}
inline const std::string& FileOptions::java_package() const {
// @@protoc_insertion_point(field_get:google.protobuf.FileOptions.java_package)
- return java_package_.Get();
+ return _internal_java_package();
}
inline void FileOptions::set_java_package(const std::string& value) {
+ _internal_set_java_package(value);
+ // @@protoc_insertion_point(field_set:google.protobuf.FileOptions.java_package)
+}
+inline std::string* FileOptions::mutable_java_package() {
+ // @@protoc_insertion_point(field_mutable:google.protobuf.FileOptions.java_package)
+ return _internal_mutable_java_package();
+}
+inline const std::string& FileOptions::_internal_java_package() const {
+ return java_package_.Get();
+}
+inline void FileOptions::_internal_set_java_package(const std::string& value) {
_has_bits_[0] |= 0x00000001u;
java_package_.Set(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(), value, GetArenaNoVirtual());
- // @@protoc_insertion_point(field_set:google.protobuf.FileOptions.java_package)
}
inline void FileOptions::set_java_package(std::string&& value) {
_has_bits_[0] |= 0x00000001u;
@@ -9417,9 +10111,8 @@
reinterpret_cast<const char*>(value), size), GetArenaNoVirtual());
// @@protoc_insertion_point(field_set_pointer:google.protobuf.FileOptions.java_package)
}
-inline std::string* FileOptions::mutable_java_package() {
+inline std::string* FileOptions::_internal_mutable_java_package() {
_has_bits_[0] |= 0x00000001u;
- // @@protoc_insertion_point(field_mutable:google.protobuf.FileOptions.java_package)
return java_package_.Mutable(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(), GetArenaNoVirtual());
}
inline std::string* FileOptions::release_java_package() {
@@ -9461,21 +10154,34 @@
}
// optional string java_outer_classname = 8;
-inline bool FileOptions::has_java_outer_classname() const {
+inline bool FileOptions::_internal_has_java_outer_classname() const {
return (_has_bits_[0] & 0x00000002u) != 0;
}
+inline bool FileOptions::has_java_outer_classname() const {
+ return _internal_has_java_outer_classname();
+}
inline void FileOptions::clear_java_outer_classname() {
java_outer_classname_.ClearToEmpty(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(), GetArenaNoVirtual());
_has_bits_[0] &= ~0x00000002u;
}
inline const std::string& FileOptions::java_outer_classname() const {
// @@protoc_insertion_point(field_get:google.protobuf.FileOptions.java_outer_classname)
- return java_outer_classname_.Get();
+ return _internal_java_outer_classname();
}
inline void FileOptions::set_java_outer_classname(const std::string& value) {
+ _internal_set_java_outer_classname(value);
+ // @@protoc_insertion_point(field_set:google.protobuf.FileOptions.java_outer_classname)
+}
+inline std::string* FileOptions::mutable_java_outer_classname() {
+ // @@protoc_insertion_point(field_mutable:google.protobuf.FileOptions.java_outer_classname)
+ return _internal_mutable_java_outer_classname();
+}
+inline const std::string& FileOptions::_internal_java_outer_classname() const {
+ return java_outer_classname_.Get();
+}
+inline void FileOptions::_internal_set_java_outer_classname(const std::string& value) {
_has_bits_[0] |= 0x00000002u;
java_outer_classname_.Set(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(), value, GetArenaNoVirtual());
- // @@protoc_insertion_point(field_set:google.protobuf.FileOptions.java_outer_classname)
}
inline void FileOptions::set_java_outer_classname(std::string&& value) {
_has_bits_[0] |= 0x00000002u;
@@ -9497,9 +10203,8 @@
reinterpret_cast<const char*>(value), size), GetArenaNoVirtual());
// @@protoc_insertion_point(field_set_pointer:google.protobuf.FileOptions.java_outer_classname)
}
-inline std::string* FileOptions::mutable_java_outer_classname() {
+inline std::string* FileOptions::_internal_mutable_java_outer_classname() {
_has_bits_[0] |= 0x00000002u;
- // @@protoc_insertion_point(field_mutable:google.protobuf.FileOptions.java_outer_classname)
return java_outer_classname_.Mutable(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(), GetArenaNoVirtual());
}
inline std::string* FileOptions::release_java_outer_classname() {
@@ -9541,9 +10246,12 @@
}
// optional bool java_multiple_files = 10 [default = false];
-inline bool FileOptions::has_java_multiple_files() const {
+inline bool FileOptions::_internal_has_java_multiple_files() const {
return (_has_bits_[0] & 0x00000400u) != 0;
}
+inline bool FileOptions::has_java_multiple_files() const {
+ return _internal_has_java_multiple_files();
+}
inline void FileOptions::clear_java_multiple_files() {
java_multiple_files_ = false;
_has_bits_[0] &= ~0x00000400u;
@@ -9559,9 +10267,12 @@
}
// optional bool java_generate_equals_and_hash = 20 [deprecated = true];
-inline bool FileOptions::has_java_generate_equals_and_hash() const {
+inline bool FileOptions::_internal_has_java_generate_equals_and_hash() const {
return (_has_bits_[0] & 0x00000800u) != 0;
}
+inline bool FileOptions::has_java_generate_equals_and_hash() const {
+ return _internal_has_java_generate_equals_and_hash();
+}
inline void FileOptions::clear_java_generate_equals_and_hash() {
java_generate_equals_and_hash_ = false;
_has_bits_[0] &= ~0x00000800u;
@@ -9577,9 +10288,12 @@
}
// optional bool java_string_check_utf8 = 27 [default = false];
-inline bool FileOptions::has_java_string_check_utf8() const {
+inline bool FileOptions::_internal_has_java_string_check_utf8() const {
return (_has_bits_[0] & 0x00001000u) != 0;
}
+inline bool FileOptions::has_java_string_check_utf8() const {
+ return _internal_has_java_string_check_utf8();
+}
inline void FileOptions::clear_java_string_check_utf8() {
java_string_check_utf8_ = false;
_has_bits_[0] &= ~0x00001000u;
@@ -9595,9 +10309,12 @@
}
// optional .google.protobuf.FileOptions.OptimizeMode optimize_for = 9 [default = SPEED];
-inline bool FileOptions::has_optimize_for() const {
+inline bool FileOptions::_internal_has_optimize_for() const {
return (_has_bits_[0] & 0x00080000u) != 0;
}
+inline bool FileOptions::has_optimize_for() const {
+ return _internal_has_optimize_for();
+}
inline void FileOptions::clear_optimize_for() {
optimize_for_ = 1;
_has_bits_[0] &= ~0x00080000u;
@@ -9614,21 +10331,34 @@
}
// optional string go_package = 11;
-inline bool FileOptions::has_go_package() const {
+inline bool FileOptions::_internal_has_go_package() const {
return (_has_bits_[0] & 0x00000004u) != 0;
}
+inline bool FileOptions::has_go_package() const {
+ return _internal_has_go_package();
+}
inline void FileOptions::clear_go_package() {
go_package_.ClearToEmpty(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(), GetArenaNoVirtual());
_has_bits_[0] &= ~0x00000004u;
}
inline const std::string& FileOptions::go_package() const {
// @@protoc_insertion_point(field_get:google.protobuf.FileOptions.go_package)
- return go_package_.Get();
+ return _internal_go_package();
}
inline void FileOptions::set_go_package(const std::string& value) {
+ _internal_set_go_package(value);
+ // @@protoc_insertion_point(field_set:google.protobuf.FileOptions.go_package)
+}
+inline std::string* FileOptions::mutable_go_package() {
+ // @@protoc_insertion_point(field_mutable:google.protobuf.FileOptions.go_package)
+ return _internal_mutable_go_package();
+}
+inline const std::string& FileOptions::_internal_go_package() const {
+ return go_package_.Get();
+}
+inline void FileOptions::_internal_set_go_package(const std::string& value) {
_has_bits_[0] |= 0x00000004u;
go_package_.Set(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(), value, GetArenaNoVirtual());
- // @@protoc_insertion_point(field_set:google.protobuf.FileOptions.go_package)
}
inline void FileOptions::set_go_package(std::string&& value) {
_has_bits_[0] |= 0x00000004u;
@@ -9650,9 +10380,8 @@
reinterpret_cast<const char*>(value), size), GetArenaNoVirtual());
// @@protoc_insertion_point(field_set_pointer:google.protobuf.FileOptions.go_package)
}
-inline std::string* FileOptions::mutable_go_package() {
+inline std::string* FileOptions::_internal_mutable_go_package() {
_has_bits_[0] |= 0x00000004u;
- // @@protoc_insertion_point(field_mutable:google.protobuf.FileOptions.go_package)
return go_package_.Mutable(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(), GetArenaNoVirtual());
}
inline std::string* FileOptions::release_go_package() {
@@ -9694,9 +10423,12 @@
}
// optional bool cc_generic_services = 16 [default = false];
-inline bool FileOptions::has_cc_generic_services() const {
+inline bool FileOptions::_internal_has_cc_generic_services() const {
return (_has_bits_[0] & 0x00002000u) != 0;
}
+inline bool FileOptions::has_cc_generic_services() const {
+ return _internal_has_cc_generic_services();
+}
inline void FileOptions::clear_cc_generic_services() {
cc_generic_services_ = false;
_has_bits_[0] &= ~0x00002000u;
@@ -9712,9 +10444,12 @@
}
// optional bool java_generic_services = 17 [default = false];
-inline bool FileOptions::has_java_generic_services() const {
+inline bool FileOptions::_internal_has_java_generic_services() const {
return (_has_bits_[0] & 0x00004000u) != 0;
}
+inline bool FileOptions::has_java_generic_services() const {
+ return _internal_has_java_generic_services();
+}
inline void FileOptions::clear_java_generic_services() {
java_generic_services_ = false;
_has_bits_[0] &= ~0x00004000u;
@@ -9730,9 +10465,12 @@
}
// optional bool py_generic_services = 18 [default = false];
-inline bool FileOptions::has_py_generic_services() const {
+inline bool FileOptions::_internal_has_py_generic_services() const {
return (_has_bits_[0] & 0x00008000u) != 0;
}
+inline bool FileOptions::has_py_generic_services() const {
+ return _internal_has_py_generic_services();
+}
inline void FileOptions::clear_py_generic_services() {
py_generic_services_ = false;
_has_bits_[0] &= ~0x00008000u;
@@ -9748,9 +10486,12 @@
}
// optional bool php_generic_services = 42 [default = false];
-inline bool FileOptions::has_php_generic_services() const {
+inline bool FileOptions::_internal_has_php_generic_services() const {
return (_has_bits_[0] & 0x00010000u) != 0;
}
+inline bool FileOptions::has_php_generic_services() const {
+ return _internal_has_php_generic_services();
+}
inline void FileOptions::clear_php_generic_services() {
php_generic_services_ = false;
_has_bits_[0] &= ~0x00010000u;
@@ -9766,9 +10507,12 @@
}
// optional bool deprecated = 23 [default = false];
-inline bool FileOptions::has_deprecated() const {
+inline bool FileOptions::_internal_has_deprecated() const {
return (_has_bits_[0] & 0x00020000u) != 0;
}
+inline bool FileOptions::has_deprecated() const {
+ return _internal_has_deprecated();
+}
inline void FileOptions::clear_deprecated() {
deprecated_ = false;
_has_bits_[0] &= ~0x00020000u;
@@ -9784,9 +10528,12 @@
}
// optional bool cc_enable_arenas = 31 [default = false];
-inline bool FileOptions::has_cc_enable_arenas() const {
+inline bool FileOptions::_internal_has_cc_enable_arenas() const {
return (_has_bits_[0] & 0x00040000u) != 0;
}
+inline bool FileOptions::has_cc_enable_arenas() const {
+ return _internal_has_cc_enable_arenas();
+}
inline void FileOptions::clear_cc_enable_arenas() {
cc_enable_arenas_ = false;
_has_bits_[0] &= ~0x00040000u;
@@ -9802,21 +10549,34 @@
}
// optional string objc_class_prefix = 36;
-inline bool FileOptions::has_objc_class_prefix() const {
+inline bool FileOptions::_internal_has_objc_class_prefix() const {
return (_has_bits_[0] & 0x00000008u) != 0;
}
+inline bool FileOptions::has_objc_class_prefix() const {
+ return _internal_has_objc_class_prefix();
+}
inline void FileOptions::clear_objc_class_prefix() {
objc_class_prefix_.ClearToEmpty(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(), GetArenaNoVirtual());
_has_bits_[0] &= ~0x00000008u;
}
inline const std::string& FileOptions::objc_class_prefix() const {
// @@protoc_insertion_point(field_get:google.protobuf.FileOptions.objc_class_prefix)
- return objc_class_prefix_.Get();
+ return _internal_objc_class_prefix();
}
inline void FileOptions::set_objc_class_prefix(const std::string& value) {
+ _internal_set_objc_class_prefix(value);
+ // @@protoc_insertion_point(field_set:google.protobuf.FileOptions.objc_class_prefix)
+}
+inline std::string* FileOptions::mutable_objc_class_prefix() {
+ // @@protoc_insertion_point(field_mutable:google.protobuf.FileOptions.objc_class_prefix)
+ return _internal_mutable_objc_class_prefix();
+}
+inline const std::string& FileOptions::_internal_objc_class_prefix() const {
+ return objc_class_prefix_.Get();
+}
+inline void FileOptions::_internal_set_objc_class_prefix(const std::string& value) {
_has_bits_[0] |= 0x00000008u;
objc_class_prefix_.Set(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(), value, GetArenaNoVirtual());
- // @@protoc_insertion_point(field_set:google.protobuf.FileOptions.objc_class_prefix)
}
inline void FileOptions::set_objc_class_prefix(std::string&& value) {
_has_bits_[0] |= 0x00000008u;
@@ -9838,9 +10598,8 @@
reinterpret_cast<const char*>(value), size), GetArenaNoVirtual());
// @@protoc_insertion_point(field_set_pointer:google.protobuf.FileOptions.objc_class_prefix)
}
-inline std::string* FileOptions::mutable_objc_class_prefix() {
+inline std::string* FileOptions::_internal_mutable_objc_class_prefix() {
_has_bits_[0] |= 0x00000008u;
- // @@protoc_insertion_point(field_mutable:google.protobuf.FileOptions.objc_class_prefix)
return objc_class_prefix_.Mutable(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(), GetArenaNoVirtual());
}
inline std::string* FileOptions::release_objc_class_prefix() {
@@ -9882,21 +10641,34 @@
}
// optional string csharp_namespace = 37;
-inline bool FileOptions::has_csharp_namespace() const {
+inline bool FileOptions::_internal_has_csharp_namespace() const {
return (_has_bits_[0] & 0x00000010u) != 0;
}
+inline bool FileOptions::has_csharp_namespace() const {
+ return _internal_has_csharp_namespace();
+}
inline void FileOptions::clear_csharp_namespace() {
csharp_namespace_.ClearToEmpty(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(), GetArenaNoVirtual());
_has_bits_[0] &= ~0x00000010u;
}
inline const std::string& FileOptions::csharp_namespace() const {
// @@protoc_insertion_point(field_get:google.protobuf.FileOptions.csharp_namespace)
- return csharp_namespace_.Get();
+ return _internal_csharp_namespace();
}
inline void FileOptions::set_csharp_namespace(const std::string& value) {
+ _internal_set_csharp_namespace(value);
+ // @@protoc_insertion_point(field_set:google.protobuf.FileOptions.csharp_namespace)
+}
+inline std::string* FileOptions::mutable_csharp_namespace() {
+ // @@protoc_insertion_point(field_mutable:google.protobuf.FileOptions.csharp_namespace)
+ return _internal_mutable_csharp_namespace();
+}
+inline const std::string& FileOptions::_internal_csharp_namespace() const {
+ return csharp_namespace_.Get();
+}
+inline void FileOptions::_internal_set_csharp_namespace(const std::string& value) {
_has_bits_[0] |= 0x00000010u;
csharp_namespace_.Set(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(), value, GetArenaNoVirtual());
- // @@protoc_insertion_point(field_set:google.protobuf.FileOptions.csharp_namespace)
}
inline void FileOptions::set_csharp_namespace(std::string&& value) {
_has_bits_[0] |= 0x00000010u;
@@ -9918,9 +10690,8 @@
reinterpret_cast<const char*>(value), size), GetArenaNoVirtual());
// @@protoc_insertion_point(field_set_pointer:google.protobuf.FileOptions.csharp_namespace)
}
-inline std::string* FileOptions::mutable_csharp_namespace() {
+inline std::string* FileOptions::_internal_mutable_csharp_namespace() {
_has_bits_[0] |= 0x00000010u;
- // @@protoc_insertion_point(field_mutable:google.protobuf.FileOptions.csharp_namespace)
return csharp_namespace_.Mutable(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(), GetArenaNoVirtual());
}
inline std::string* FileOptions::release_csharp_namespace() {
@@ -9962,21 +10733,34 @@
}
// optional string swift_prefix = 39;
-inline bool FileOptions::has_swift_prefix() const {
+inline bool FileOptions::_internal_has_swift_prefix() const {
return (_has_bits_[0] & 0x00000020u) != 0;
}
+inline bool FileOptions::has_swift_prefix() const {
+ return _internal_has_swift_prefix();
+}
inline void FileOptions::clear_swift_prefix() {
swift_prefix_.ClearToEmpty(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(), GetArenaNoVirtual());
_has_bits_[0] &= ~0x00000020u;
}
inline const std::string& FileOptions::swift_prefix() const {
// @@protoc_insertion_point(field_get:google.protobuf.FileOptions.swift_prefix)
- return swift_prefix_.Get();
+ return _internal_swift_prefix();
}
inline void FileOptions::set_swift_prefix(const std::string& value) {
+ _internal_set_swift_prefix(value);
+ // @@protoc_insertion_point(field_set:google.protobuf.FileOptions.swift_prefix)
+}
+inline std::string* FileOptions::mutable_swift_prefix() {
+ // @@protoc_insertion_point(field_mutable:google.protobuf.FileOptions.swift_prefix)
+ return _internal_mutable_swift_prefix();
+}
+inline const std::string& FileOptions::_internal_swift_prefix() const {
+ return swift_prefix_.Get();
+}
+inline void FileOptions::_internal_set_swift_prefix(const std::string& value) {
_has_bits_[0] |= 0x00000020u;
swift_prefix_.Set(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(), value, GetArenaNoVirtual());
- // @@protoc_insertion_point(field_set:google.protobuf.FileOptions.swift_prefix)
}
inline void FileOptions::set_swift_prefix(std::string&& value) {
_has_bits_[0] |= 0x00000020u;
@@ -9998,9 +10782,8 @@
reinterpret_cast<const char*>(value), size), GetArenaNoVirtual());
// @@protoc_insertion_point(field_set_pointer:google.protobuf.FileOptions.swift_prefix)
}
-inline std::string* FileOptions::mutable_swift_prefix() {
+inline std::string* FileOptions::_internal_mutable_swift_prefix() {
_has_bits_[0] |= 0x00000020u;
- // @@protoc_insertion_point(field_mutable:google.protobuf.FileOptions.swift_prefix)
return swift_prefix_.Mutable(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(), GetArenaNoVirtual());
}
inline std::string* FileOptions::release_swift_prefix() {
@@ -10042,21 +10825,34 @@
}
// optional string php_class_prefix = 40;
-inline bool FileOptions::has_php_class_prefix() const {
+inline bool FileOptions::_internal_has_php_class_prefix() const {
return (_has_bits_[0] & 0x00000040u) != 0;
}
+inline bool FileOptions::has_php_class_prefix() const {
+ return _internal_has_php_class_prefix();
+}
inline void FileOptions::clear_php_class_prefix() {
php_class_prefix_.ClearToEmpty(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(), GetArenaNoVirtual());
_has_bits_[0] &= ~0x00000040u;
}
inline const std::string& FileOptions::php_class_prefix() const {
// @@protoc_insertion_point(field_get:google.protobuf.FileOptions.php_class_prefix)
- return php_class_prefix_.Get();
+ return _internal_php_class_prefix();
}
inline void FileOptions::set_php_class_prefix(const std::string& value) {
+ _internal_set_php_class_prefix(value);
+ // @@protoc_insertion_point(field_set:google.protobuf.FileOptions.php_class_prefix)
+}
+inline std::string* FileOptions::mutable_php_class_prefix() {
+ // @@protoc_insertion_point(field_mutable:google.protobuf.FileOptions.php_class_prefix)
+ return _internal_mutable_php_class_prefix();
+}
+inline const std::string& FileOptions::_internal_php_class_prefix() const {
+ return php_class_prefix_.Get();
+}
+inline void FileOptions::_internal_set_php_class_prefix(const std::string& value) {
_has_bits_[0] |= 0x00000040u;
php_class_prefix_.Set(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(), value, GetArenaNoVirtual());
- // @@protoc_insertion_point(field_set:google.protobuf.FileOptions.php_class_prefix)
}
inline void FileOptions::set_php_class_prefix(std::string&& value) {
_has_bits_[0] |= 0x00000040u;
@@ -10078,9 +10874,8 @@
reinterpret_cast<const char*>(value), size), GetArenaNoVirtual());
// @@protoc_insertion_point(field_set_pointer:google.protobuf.FileOptions.php_class_prefix)
}
-inline std::string* FileOptions::mutable_php_class_prefix() {
+inline std::string* FileOptions::_internal_mutable_php_class_prefix() {
_has_bits_[0] |= 0x00000040u;
- // @@protoc_insertion_point(field_mutable:google.protobuf.FileOptions.php_class_prefix)
return php_class_prefix_.Mutable(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(), GetArenaNoVirtual());
}
inline std::string* FileOptions::release_php_class_prefix() {
@@ -10122,21 +10917,34 @@
}
// optional string php_namespace = 41;
-inline bool FileOptions::has_php_namespace() const {
+inline bool FileOptions::_internal_has_php_namespace() const {
return (_has_bits_[0] & 0x00000080u) != 0;
}
+inline bool FileOptions::has_php_namespace() const {
+ return _internal_has_php_namespace();
+}
inline void FileOptions::clear_php_namespace() {
php_namespace_.ClearToEmpty(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(), GetArenaNoVirtual());
_has_bits_[0] &= ~0x00000080u;
}
inline const std::string& FileOptions::php_namespace() const {
// @@protoc_insertion_point(field_get:google.protobuf.FileOptions.php_namespace)
- return php_namespace_.Get();
+ return _internal_php_namespace();
}
inline void FileOptions::set_php_namespace(const std::string& value) {
+ _internal_set_php_namespace(value);
+ // @@protoc_insertion_point(field_set:google.protobuf.FileOptions.php_namespace)
+}
+inline std::string* FileOptions::mutable_php_namespace() {
+ // @@protoc_insertion_point(field_mutable:google.protobuf.FileOptions.php_namespace)
+ return _internal_mutable_php_namespace();
+}
+inline const std::string& FileOptions::_internal_php_namespace() const {
+ return php_namespace_.Get();
+}
+inline void FileOptions::_internal_set_php_namespace(const std::string& value) {
_has_bits_[0] |= 0x00000080u;
php_namespace_.Set(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(), value, GetArenaNoVirtual());
- // @@protoc_insertion_point(field_set:google.protobuf.FileOptions.php_namespace)
}
inline void FileOptions::set_php_namespace(std::string&& value) {
_has_bits_[0] |= 0x00000080u;
@@ -10158,9 +10966,8 @@
reinterpret_cast<const char*>(value), size), GetArenaNoVirtual());
// @@protoc_insertion_point(field_set_pointer:google.protobuf.FileOptions.php_namespace)
}
-inline std::string* FileOptions::mutable_php_namespace() {
+inline std::string* FileOptions::_internal_mutable_php_namespace() {
_has_bits_[0] |= 0x00000080u;
- // @@protoc_insertion_point(field_mutable:google.protobuf.FileOptions.php_namespace)
return php_namespace_.Mutable(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(), GetArenaNoVirtual());
}
inline std::string* FileOptions::release_php_namespace() {
@@ -10202,21 +11009,34 @@
}
// optional string php_metadata_namespace = 44;
-inline bool FileOptions::has_php_metadata_namespace() const {
+inline bool FileOptions::_internal_has_php_metadata_namespace() const {
return (_has_bits_[0] & 0x00000100u) != 0;
}
+inline bool FileOptions::has_php_metadata_namespace() const {
+ return _internal_has_php_metadata_namespace();
+}
inline void FileOptions::clear_php_metadata_namespace() {
php_metadata_namespace_.ClearToEmpty(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(), GetArenaNoVirtual());
_has_bits_[0] &= ~0x00000100u;
}
inline const std::string& FileOptions::php_metadata_namespace() const {
// @@protoc_insertion_point(field_get:google.protobuf.FileOptions.php_metadata_namespace)
- return php_metadata_namespace_.Get();
+ return _internal_php_metadata_namespace();
}
inline void FileOptions::set_php_metadata_namespace(const std::string& value) {
+ _internal_set_php_metadata_namespace(value);
+ // @@protoc_insertion_point(field_set:google.protobuf.FileOptions.php_metadata_namespace)
+}
+inline std::string* FileOptions::mutable_php_metadata_namespace() {
+ // @@protoc_insertion_point(field_mutable:google.protobuf.FileOptions.php_metadata_namespace)
+ return _internal_mutable_php_metadata_namespace();
+}
+inline const std::string& FileOptions::_internal_php_metadata_namespace() const {
+ return php_metadata_namespace_.Get();
+}
+inline void FileOptions::_internal_set_php_metadata_namespace(const std::string& value) {
_has_bits_[0] |= 0x00000100u;
php_metadata_namespace_.Set(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(), value, GetArenaNoVirtual());
- // @@protoc_insertion_point(field_set:google.protobuf.FileOptions.php_metadata_namespace)
}
inline void FileOptions::set_php_metadata_namespace(std::string&& value) {
_has_bits_[0] |= 0x00000100u;
@@ -10238,9 +11058,8 @@
reinterpret_cast<const char*>(value), size), GetArenaNoVirtual());
// @@protoc_insertion_point(field_set_pointer:google.protobuf.FileOptions.php_metadata_namespace)
}
-inline std::string* FileOptions::mutable_php_metadata_namespace() {
+inline std::string* FileOptions::_internal_mutable_php_metadata_namespace() {
_has_bits_[0] |= 0x00000100u;
- // @@protoc_insertion_point(field_mutable:google.protobuf.FileOptions.php_metadata_namespace)
return php_metadata_namespace_.Mutable(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(), GetArenaNoVirtual());
}
inline std::string* FileOptions::release_php_metadata_namespace() {
@@ -10282,21 +11101,34 @@
}
// optional string ruby_package = 45;
-inline bool FileOptions::has_ruby_package() const {
+inline bool FileOptions::_internal_has_ruby_package() const {
return (_has_bits_[0] & 0x00000200u) != 0;
}
+inline bool FileOptions::has_ruby_package() const {
+ return _internal_has_ruby_package();
+}
inline void FileOptions::clear_ruby_package() {
ruby_package_.ClearToEmpty(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(), GetArenaNoVirtual());
_has_bits_[0] &= ~0x00000200u;
}
inline const std::string& FileOptions::ruby_package() const {
// @@protoc_insertion_point(field_get:google.protobuf.FileOptions.ruby_package)
- return ruby_package_.Get();
+ return _internal_ruby_package();
}
inline void FileOptions::set_ruby_package(const std::string& value) {
+ _internal_set_ruby_package(value);
+ // @@protoc_insertion_point(field_set:google.protobuf.FileOptions.ruby_package)
+}
+inline std::string* FileOptions::mutable_ruby_package() {
+ // @@protoc_insertion_point(field_mutable:google.protobuf.FileOptions.ruby_package)
+ return _internal_mutable_ruby_package();
+}
+inline const std::string& FileOptions::_internal_ruby_package() const {
+ return ruby_package_.Get();
+}
+inline void FileOptions::_internal_set_ruby_package(const std::string& value) {
_has_bits_[0] |= 0x00000200u;
ruby_package_.Set(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(), value, GetArenaNoVirtual());
- // @@protoc_insertion_point(field_set:google.protobuf.FileOptions.ruby_package)
}
inline void FileOptions::set_ruby_package(std::string&& value) {
_has_bits_[0] |= 0x00000200u;
@@ -10318,9 +11150,8 @@
reinterpret_cast<const char*>(value), size), GetArenaNoVirtual());
// @@protoc_insertion_point(field_set_pointer:google.protobuf.FileOptions.ruby_package)
}
-inline std::string* FileOptions::mutable_ruby_package() {
+inline std::string* FileOptions::_internal_mutable_ruby_package() {
_has_bits_[0] |= 0x00000200u;
- // @@protoc_insertion_point(field_mutable:google.protobuf.FileOptions.ruby_package)
return ruby_package_.Mutable(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(), GetArenaNoVirtual());
}
inline std::string* FileOptions::release_ruby_package() {
@@ -10396,9 +11227,12 @@
// MessageOptions
// optional bool message_set_wire_format = 1 [default = false];
-inline bool MessageOptions::has_message_set_wire_format() const {
+inline bool MessageOptions::_internal_has_message_set_wire_format() const {
return (_has_bits_[0] & 0x00000001u) != 0;
}
+inline bool MessageOptions::has_message_set_wire_format() const {
+ return _internal_has_message_set_wire_format();
+}
inline void MessageOptions::clear_message_set_wire_format() {
message_set_wire_format_ = false;
_has_bits_[0] &= ~0x00000001u;
@@ -10414,9 +11248,12 @@
}
// optional bool no_standard_descriptor_accessor = 2 [default = false];
-inline bool MessageOptions::has_no_standard_descriptor_accessor() const {
+inline bool MessageOptions::_internal_has_no_standard_descriptor_accessor() const {
return (_has_bits_[0] & 0x00000002u) != 0;
}
+inline bool MessageOptions::has_no_standard_descriptor_accessor() const {
+ return _internal_has_no_standard_descriptor_accessor();
+}
inline void MessageOptions::clear_no_standard_descriptor_accessor() {
no_standard_descriptor_accessor_ = false;
_has_bits_[0] &= ~0x00000002u;
@@ -10432,9 +11269,12 @@
}
// optional bool deprecated = 3 [default = false];
-inline bool MessageOptions::has_deprecated() const {
+inline bool MessageOptions::_internal_has_deprecated() const {
return (_has_bits_[0] & 0x00000004u) != 0;
}
+inline bool MessageOptions::has_deprecated() const {
+ return _internal_has_deprecated();
+}
inline void MessageOptions::clear_deprecated() {
deprecated_ = false;
_has_bits_[0] &= ~0x00000004u;
@@ -10450,9 +11290,12 @@
}
// optional bool map_entry = 7;
-inline bool MessageOptions::has_map_entry() const {
+inline bool MessageOptions::_internal_has_map_entry() const {
return (_has_bits_[0] & 0x00000008u) != 0;
}
+inline bool MessageOptions::has_map_entry() const {
+ return _internal_has_map_entry();
+}
inline void MessageOptions::clear_map_entry() {
map_entry_ = false;
_has_bits_[0] &= ~0x00000008u;
@@ -10502,9 +11345,12 @@
// FieldOptions
// optional .google.protobuf.FieldOptions.CType ctype = 1 [default = STRING];
-inline bool FieldOptions::has_ctype() const {
+inline bool FieldOptions::_internal_has_ctype() const {
return (_has_bits_[0] & 0x00000001u) != 0;
}
+inline bool FieldOptions::has_ctype() const {
+ return _internal_has_ctype();
+}
inline void FieldOptions::clear_ctype() {
ctype_ = 0;
_has_bits_[0] &= ~0x00000001u;
@@ -10521,9 +11367,12 @@
}
// optional bool packed = 2;
-inline bool FieldOptions::has_packed() const {
+inline bool FieldOptions::_internal_has_packed() const {
return (_has_bits_[0] & 0x00000002u) != 0;
}
+inline bool FieldOptions::has_packed() const {
+ return _internal_has_packed();
+}
inline void FieldOptions::clear_packed() {
packed_ = false;
_has_bits_[0] &= ~0x00000002u;
@@ -10539,9 +11388,12 @@
}
// optional .google.protobuf.FieldOptions.JSType jstype = 6 [default = JS_NORMAL];
-inline bool FieldOptions::has_jstype() const {
+inline bool FieldOptions::_internal_has_jstype() const {
return (_has_bits_[0] & 0x00000020u) != 0;
}
+inline bool FieldOptions::has_jstype() const {
+ return _internal_has_jstype();
+}
inline void FieldOptions::clear_jstype() {
jstype_ = 0;
_has_bits_[0] &= ~0x00000020u;
@@ -10558,9 +11410,12 @@
}
// optional bool lazy = 5 [default = false];
-inline bool FieldOptions::has_lazy() const {
+inline bool FieldOptions::_internal_has_lazy() const {
return (_has_bits_[0] & 0x00000004u) != 0;
}
+inline bool FieldOptions::has_lazy() const {
+ return _internal_has_lazy();
+}
inline void FieldOptions::clear_lazy() {
lazy_ = false;
_has_bits_[0] &= ~0x00000004u;
@@ -10576,9 +11431,12 @@
}
// optional bool deprecated = 3 [default = false];
-inline bool FieldOptions::has_deprecated() const {
+inline bool FieldOptions::_internal_has_deprecated() const {
return (_has_bits_[0] & 0x00000008u) != 0;
}
+inline bool FieldOptions::has_deprecated() const {
+ return _internal_has_deprecated();
+}
inline void FieldOptions::clear_deprecated() {
deprecated_ = false;
_has_bits_[0] &= ~0x00000008u;
@@ -10594,9 +11452,12 @@
}
// optional bool weak = 10 [default = false];
-inline bool FieldOptions::has_weak() const {
+inline bool FieldOptions::_internal_has_weak() const {
return (_has_bits_[0] & 0x00000010u) != 0;
}
+inline bool FieldOptions::has_weak() const {
+ return _internal_has_weak();
+}
inline void FieldOptions::clear_weak() {
weak_ = false;
_has_bits_[0] &= ~0x00000010u;
@@ -10680,9 +11541,12 @@
// EnumOptions
// optional bool allow_alias = 2;
-inline bool EnumOptions::has_allow_alias() const {
+inline bool EnumOptions::_internal_has_allow_alias() const {
return (_has_bits_[0] & 0x00000001u) != 0;
}
+inline bool EnumOptions::has_allow_alias() const {
+ return _internal_has_allow_alias();
+}
inline void EnumOptions::clear_allow_alias() {
allow_alias_ = false;
_has_bits_[0] &= ~0x00000001u;
@@ -10698,9 +11562,12 @@
}
// optional bool deprecated = 3 [default = false];
-inline bool EnumOptions::has_deprecated() const {
+inline bool EnumOptions::_internal_has_deprecated() const {
return (_has_bits_[0] & 0x00000002u) != 0;
}
+inline bool EnumOptions::has_deprecated() const {
+ return _internal_has_deprecated();
+}
inline void EnumOptions::clear_deprecated() {
deprecated_ = false;
_has_bits_[0] &= ~0x00000002u;
@@ -10750,9 +11617,12 @@
// EnumValueOptions
// optional bool deprecated = 1 [default = false];
-inline bool EnumValueOptions::has_deprecated() const {
+inline bool EnumValueOptions::_internal_has_deprecated() const {
return (_has_bits_[0] & 0x00000001u) != 0;
}
+inline bool EnumValueOptions::has_deprecated() const {
+ return _internal_has_deprecated();
+}
inline void EnumValueOptions::clear_deprecated() {
deprecated_ = false;
_has_bits_[0] &= ~0x00000001u;
@@ -10802,9 +11672,12 @@
// ServiceOptions
// optional bool deprecated = 33 [default = false];
-inline bool ServiceOptions::has_deprecated() const {
+inline bool ServiceOptions::_internal_has_deprecated() const {
return (_has_bits_[0] & 0x00000001u) != 0;
}
+inline bool ServiceOptions::has_deprecated() const {
+ return _internal_has_deprecated();
+}
inline void ServiceOptions::clear_deprecated() {
deprecated_ = false;
_has_bits_[0] &= ~0x00000001u;
@@ -10854,9 +11727,12 @@
// MethodOptions
// optional bool deprecated = 33 [default = false];
-inline bool MethodOptions::has_deprecated() const {
+inline bool MethodOptions::_internal_has_deprecated() const {
return (_has_bits_[0] & 0x00000001u) != 0;
}
+inline bool MethodOptions::has_deprecated() const {
+ return _internal_has_deprecated();
+}
inline void MethodOptions::clear_deprecated() {
deprecated_ = false;
_has_bits_[0] &= ~0x00000001u;
@@ -10872,9 +11748,12 @@
}
// optional .google.protobuf.MethodOptions.IdempotencyLevel idempotency_level = 34 [default = IDEMPOTENCY_UNKNOWN];
-inline bool MethodOptions::has_idempotency_level() const {
+inline bool MethodOptions::_internal_has_idempotency_level() const {
return (_has_bits_[0] & 0x00000002u) != 0;
}
+inline bool MethodOptions::has_idempotency_level() const {
+ return _internal_has_idempotency_level();
+}
inline void MethodOptions::clear_idempotency_level() {
idempotency_level_ = 0;
_has_bits_[0] &= ~0x00000002u;
@@ -10925,21 +11804,34 @@
// UninterpretedOption_NamePart
// required string name_part = 1;
-inline bool UninterpretedOption_NamePart::has_name_part() const {
+inline bool UninterpretedOption_NamePart::_internal_has_name_part() const {
return (_has_bits_[0] & 0x00000001u) != 0;
}
+inline bool UninterpretedOption_NamePart::has_name_part() const {
+ return _internal_has_name_part();
+}
inline void UninterpretedOption_NamePart::clear_name_part() {
name_part_.ClearToEmpty(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(), GetArenaNoVirtual());
_has_bits_[0] &= ~0x00000001u;
}
inline const std::string& UninterpretedOption_NamePart::name_part() const {
// @@protoc_insertion_point(field_get:google.protobuf.UninterpretedOption.NamePart.name_part)
- return name_part_.Get();
+ return _internal_name_part();
}
inline void UninterpretedOption_NamePart::set_name_part(const std::string& value) {
+ _internal_set_name_part(value);
+ // @@protoc_insertion_point(field_set:google.protobuf.UninterpretedOption.NamePart.name_part)
+}
+inline std::string* UninterpretedOption_NamePart::mutable_name_part() {
+ // @@protoc_insertion_point(field_mutable:google.protobuf.UninterpretedOption.NamePart.name_part)
+ return _internal_mutable_name_part();
+}
+inline const std::string& UninterpretedOption_NamePart::_internal_name_part() const {
+ return name_part_.Get();
+}
+inline void UninterpretedOption_NamePart::_internal_set_name_part(const std::string& value) {
_has_bits_[0] |= 0x00000001u;
name_part_.Set(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(), value, GetArenaNoVirtual());
- // @@protoc_insertion_point(field_set:google.protobuf.UninterpretedOption.NamePart.name_part)
}
inline void UninterpretedOption_NamePart::set_name_part(std::string&& value) {
_has_bits_[0] |= 0x00000001u;
@@ -10961,9 +11853,8 @@
reinterpret_cast<const char*>(value), size), GetArenaNoVirtual());
// @@protoc_insertion_point(field_set_pointer:google.protobuf.UninterpretedOption.NamePart.name_part)
}
-inline std::string* UninterpretedOption_NamePart::mutable_name_part() {
+inline std::string* UninterpretedOption_NamePart::_internal_mutable_name_part() {
_has_bits_[0] |= 0x00000001u;
- // @@protoc_insertion_point(field_mutable:google.protobuf.UninterpretedOption.NamePart.name_part)
return name_part_.Mutable(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(), GetArenaNoVirtual());
}
inline std::string* UninterpretedOption_NamePart::release_name_part() {
@@ -11005,9 +11896,12 @@
}
// required bool is_extension = 2;
-inline bool UninterpretedOption_NamePart::has_is_extension() const {
+inline bool UninterpretedOption_NamePart::_internal_has_is_extension() const {
return (_has_bits_[0] & 0x00000002u) != 0;
}
+inline bool UninterpretedOption_NamePart::has_is_extension() const {
+ return _internal_has_is_extension();
+}
inline void UninterpretedOption_NamePart::clear_is_extension() {
is_extension_ = false;
_has_bits_[0] &= ~0x00000002u;
@@ -11057,21 +11951,34 @@
}
// optional string identifier_value = 3;
-inline bool UninterpretedOption::has_identifier_value() const {
+inline bool UninterpretedOption::_internal_has_identifier_value() const {
return (_has_bits_[0] & 0x00000001u) != 0;
}
+inline bool UninterpretedOption::has_identifier_value() const {
+ return _internal_has_identifier_value();
+}
inline void UninterpretedOption::clear_identifier_value() {
identifier_value_.ClearToEmpty(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(), GetArenaNoVirtual());
_has_bits_[0] &= ~0x00000001u;
}
inline const std::string& UninterpretedOption::identifier_value() const {
// @@protoc_insertion_point(field_get:google.protobuf.UninterpretedOption.identifier_value)
- return identifier_value_.Get();
+ return _internal_identifier_value();
}
inline void UninterpretedOption::set_identifier_value(const std::string& value) {
+ _internal_set_identifier_value(value);
+ // @@protoc_insertion_point(field_set:google.protobuf.UninterpretedOption.identifier_value)
+}
+inline std::string* UninterpretedOption::mutable_identifier_value() {
+ // @@protoc_insertion_point(field_mutable:google.protobuf.UninterpretedOption.identifier_value)
+ return _internal_mutable_identifier_value();
+}
+inline const std::string& UninterpretedOption::_internal_identifier_value() const {
+ return identifier_value_.Get();
+}
+inline void UninterpretedOption::_internal_set_identifier_value(const std::string& value) {
_has_bits_[0] |= 0x00000001u;
identifier_value_.Set(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(), value, GetArenaNoVirtual());
- // @@protoc_insertion_point(field_set:google.protobuf.UninterpretedOption.identifier_value)
}
inline void UninterpretedOption::set_identifier_value(std::string&& value) {
_has_bits_[0] |= 0x00000001u;
@@ -11093,9 +12000,8 @@
reinterpret_cast<const char*>(value), size), GetArenaNoVirtual());
// @@protoc_insertion_point(field_set_pointer:google.protobuf.UninterpretedOption.identifier_value)
}
-inline std::string* UninterpretedOption::mutable_identifier_value() {
+inline std::string* UninterpretedOption::_internal_mutable_identifier_value() {
_has_bits_[0] |= 0x00000001u;
- // @@protoc_insertion_point(field_mutable:google.protobuf.UninterpretedOption.identifier_value)
return identifier_value_.Mutable(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(), GetArenaNoVirtual());
}
inline std::string* UninterpretedOption::release_identifier_value() {
@@ -11137,9 +12043,12 @@
}
// optional uint64 positive_int_value = 4;
-inline bool UninterpretedOption::has_positive_int_value() const {
+inline bool UninterpretedOption::_internal_has_positive_int_value() const {
return (_has_bits_[0] & 0x00000008u) != 0;
}
+inline bool UninterpretedOption::has_positive_int_value() const {
+ return _internal_has_positive_int_value();
+}
inline void UninterpretedOption::clear_positive_int_value() {
positive_int_value_ = PROTOBUF_ULONGLONG(0);
_has_bits_[0] &= ~0x00000008u;
@@ -11155,9 +12064,12 @@
}
// optional int64 negative_int_value = 5;
-inline bool UninterpretedOption::has_negative_int_value() const {
+inline bool UninterpretedOption::_internal_has_negative_int_value() const {
return (_has_bits_[0] & 0x00000010u) != 0;
}
+inline bool UninterpretedOption::has_negative_int_value() const {
+ return _internal_has_negative_int_value();
+}
inline void UninterpretedOption::clear_negative_int_value() {
negative_int_value_ = PROTOBUF_LONGLONG(0);
_has_bits_[0] &= ~0x00000010u;
@@ -11173,9 +12085,12 @@
}
// optional double double_value = 6;
-inline bool UninterpretedOption::has_double_value() const {
+inline bool UninterpretedOption::_internal_has_double_value() const {
return (_has_bits_[0] & 0x00000020u) != 0;
}
+inline bool UninterpretedOption::has_double_value() const {
+ return _internal_has_double_value();
+}
inline void UninterpretedOption::clear_double_value() {
double_value_ = 0;
_has_bits_[0] &= ~0x00000020u;
@@ -11191,21 +12106,34 @@
}
// optional bytes string_value = 7;
-inline bool UninterpretedOption::has_string_value() const {
+inline bool UninterpretedOption::_internal_has_string_value() const {
return (_has_bits_[0] & 0x00000002u) != 0;
}
+inline bool UninterpretedOption::has_string_value() const {
+ return _internal_has_string_value();
+}
inline void UninterpretedOption::clear_string_value() {
string_value_.ClearToEmpty(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(), GetArenaNoVirtual());
_has_bits_[0] &= ~0x00000002u;
}
inline const std::string& UninterpretedOption::string_value() const {
// @@protoc_insertion_point(field_get:google.protobuf.UninterpretedOption.string_value)
- return string_value_.Get();
+ return _internal_string_value();
}
inline void UninterpretedOption::set_string_value(const std::string& value) {
+ _internal_set_string_value(value);
+ // @@protoc_insertion_point(field_set:google.protobuf.UninterpretedOption.string_value)
+}
+inline std::string* UninterpretedOption::mutable_string_value() {
+ // @@protoc_insertion_point(field_mutable:google.protobuf.UninterpretedOption.string_value)
+ return _internal_mutable_string_value();
+}
+inline const std::string& UninterpretedOption::_internal_string_value() const {
+ return string_value_.Get();
+}
+inline void UninterpretedOption::_internal_set_string_value(const std::string& value) {
_has_bits_[0] |= 0x00000002u;
string_value_.Set(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(), value, GetArenaNoVirtual());
- // @@protoc_insertion_point(field_set:google.protobuf.UninterpretedOption.string_value)
}
inline void UninterpretedOption::set_string_value(std::string&& value) {
_has_bits_[0] |= 0x00000002u;
@@ -11227,9 +12155,8 @@
reinterpret_cast<const char*>(value), size), GetArenaNoVirtual());
// @@protoc_insertion_point(field_set_pointer:google.protobuf.UninterpretedOption.string_value)
}
-inline std::string* UninterpretedOption::mutable_string_value() {
+inline std::string* UninterpretedOption::_internal_mutable_string_value() {
_has_bits_[0] |= 0x00000002u;
- // @@protoc_insertion_point(field_mutable:google.protobuf.UninterpretedOption.string_value)
return string_value_.Mutable(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(), GetArenaNoVirtual());
}
inline std::string* UninterpretedOption::release_string_value() {
@@ -11271,21 +12198,34 @@
}
// optional string aggregate_value = 8;
-inline bool UninterpretedOption::has_aggregate_value() const {
+inline bool UninterpretedOption::_internal_has_aggregate_value() const {
return (_has_bits_[0] & 0x00000004u) != 0;
}
+inline bool UninterpretedOption::has_aggregate_value() const {
+ return _internal_has_aggregate_value();
+}
inline void UninterpretedOption::clear_aggregate_value() {
aggregate_value_.ClearToEmpty(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(), GetArenaNoVirtual());
_has_bits_[0] &= ~0x00000004u;
}
inline const std::string& UninterpretedOption::aggregate_value() const {
// @@protoc_insertion_point(field_get:google.protobuf.UninterpretedOption.aggregate_value)
- return aggregate_value_.Get();
+ return _internal_aggregate_value();
}
inline void UninterpretedOption::set_aggregate_value(const std::string& value) {
+ _internal_set_aggregate_value(value);
+ // @@protoc_insertion_point(field_set:google.protobuf.UninterpretedOption.aggregate_value)
+}
+inline std::string* UninterpretedOption::mutable_aggregate_value() {
+ // @@protoc_insertion_point(field_mutable:google.protobuf.UninterpretedOption.aggregate_value)
+ return _internal_mutable_aggregate_value();
+}
+inline const std::string& UninterpretedOption::_internal_aggregate_value() const {
+ return aggregate_value_.Get();
+}
+inline void UninterpretedOption::_internal_set_aggregate_value(const std::string& value) {
_has_bits_[0] |= 0x00000004u;
aggregate_value_.Set(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(), value, GetArenaNoVirtual());
- // @@protoc_insertion_point(field_set:google.protobuf.UninterpretedOption.aggregate_value)
}
inline void UninterpretedOption::set_aggregate_value(std::string&& value) {
_has_bits_[0] |= 0x00000004u;
@@ -11307,9 +12247,8 @@
reinterpret_cast<const char*>(value), size), GetArenaNoVirtual());
// @@protoc_insertion_point(field_set_pointer:google.protobuf.UninterpretedOption.aggregate_value)
}
-inline std::string* UninterpretedOption::mutable_aggregate_value() {
+inline std::string* UninterpretedOption::_internal_mutable_aggregate_value() {
_has_bits_[0] |= 0x00000004u;
- // @@protoc_insertion_point(field_mutable:google.protobuf.UninterpretedOption.aggregate_value)
return aggregate_value_.Mutable(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(), GetArenaNoVirtual());
}
inline std::string* UninterpretedOption::release_aggregate_value() {
@@ -11415,21 +12354,34 @@
}
// optional string leading_comments = 3;
-inline bool SourceCodeInfo_Location::has_leading_comments() const {
+inline bool SourceCodeInfo_Location::_internal_has_leading_comments() const {
return (_has_bits_[0] & 0x00000001u) != 0;
}
+inline bool SourceCodeInfo_Location::has_leading_comments() const {
+ return _internal_has_leading_comments();
+}
inline void SourceCodeInfo_Location::clear_leading_comments() {
leading_comments_.ClearToEmpty(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(), GetArenaNoVirtual());
_has_bits_[0] &= ~0x00000001u;
}
inline const std::string& SourceCodeInfo_Location::leading_comments() const {
// @@protoc_insertion_point(field_get:google.protobuf.SourceCodeInfo.Location.leading_comments)
- return leading_comments_.Get();
+ return _internal_leading_comments();
}
inline void SourceCodeInfo_Location::set_leading_comments(const std::string& value) {
+ _internal_set_leading_comments(value);
+ // @@protoc_insertion_point(field_set:google.protobuf.SourceCodeInfo.Location.leading_comments)
+}
+inline std::string* SourceCodeInfo_Location::mutable_leading_comments() {
+ // @@protoc_insertion_point(field_mutable:google.protobuf.SourceCodeInfo.Location.leading_comments)
+ return _internal_mutable_leading_comments();
+}
+inline const std::string& SourceCodeInfo_Location::_internal_leading_comments() const {
+ return leading_comments_.Get();
+}
+inline void SourceCodeInfo_Location::_internal_set_leading_comments(const std::string& value) {
_has_bits_[0] |= 0x00000001u;
leading_comments_.Set(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(), value, GetArenaNoVirtual());
- // @@protoc_insertion_point(field_set:google.protobuf.SourceCodeInfo.Location.leading_comments)
}
inline void SourceCodeInfo_Location::set_leading_comments(std::string&& value) {
_has_bits_[0] |= 0x00000001u;
@@ -11451,9 +12403,8 @@
reinterpret_cast<const char*>(value), size), GetArenaNoVirtual());
// @@protoc_insertion_point(field_set_pointer:google.protobuf.SourceCodeInfo.Location.leading_comments)
}
-inline std::string* SourceCodeInfo_Location::mutable_leading_comments() {
+inline std::string* SourceCodeInfo_Location::_internal_mutable_leading_comments() {
_has_bits_[0] |= 0x00000001u;
- // @@protoc_insertion_point(field_mutable:google.protobuf.SourceCodeInfo.Location.leading_comments)
return leading_comments_.Mutable(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(), GetArenaNoVirtual());
}
inline std::string* SourceCodeInfo_Location::release_leading_comments() {
@@ -11495,21 +12446,34 @@
}
// optional string trailing_comments = 4;
-inline bool SourceCodeInfo_Location::has_trailing_comments() const {
+inline bool SourceCodeInfo_Location::_internal_has_trailing_comments() const {
return (_has_bits_[0] & 0x00000002u) != 0;
}
+inline bool SourceCodeInfo_Location::has_trailing_comments() const {
+ return _internal_has_trailing_comments();
+}
inline void SourceCodeInfo_Location::clear_trailing_comments() {
trailing_comments_.ClearToEmpty(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(), GetArenaNoVirtual());
_has_bits_[0] &= ~0x00000002u;
}
inline const std::string& SourceCodeInfo_Location::trailing_comments() const {
// @@protoc_insertion_point(field_get:google.protobuf.SourceCodeInfo.Location.trailing_comments)
- return trailing_comments_.Get();
+ return _internal_trailing_comments();
}
inline void SourceCodeInfo_Location::set_trailing_comments(const std::string& value) {
+ _internal_set_trailing_comments(value);
+ // @@protoc_insertion_point(field_set:google.protobuf.SourceCodeInfo.Location.trailing_comments)
+}
+inline std::string* SourceCodeInfo_Location::mutable_trailing_comments() {
+ // @@protoc_insertion_point(field_mutable:google.protobuf.SourceCodeInfo.Location.trailing_comments)
+ return _internal_mutable_trailing_comments();
+}
+inline const std::string& SourceCodeInfo_Location::_internal_trailing_comments() const {
+ return trailing_comments_.Get();
+}
+inline void SourceCodeInfo_Location::_internal_set_trailing_comments(const std::string& value) {
_has_bits_[0] |= 0x00000002u;
trailing_comments_.Set(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(), value, GetArenaNoVirtual());
- // @@protoc_insertion_point(field_set:google.protobuf.SourceCodeInfo.Location.trailing_comments)
}
inline void SourceCodeInfo_Location::set_trailing_comments(std::string&& value) {
_has_bits_[0] |= 0x00000002u;
@@ -11531,9 +12495,8 @@
reinterpret_cast<const char*>(value), size), GetArenaNoVirtual());
// @@protoc_insertion_point(field_set_pointer:google.protobuf.SourceCodeInfo.Location.trailing_comments)
}
-inline std::string* SourceCodeInfo_Location::mutable_trailing_comments() {
+inline std::string* SourceCodeInfo_Location::_internal_mutable_trailing_comments() {
_has_bits_[0] |= 0x00000002u;
- // @@protoc_insertion_point(field_mutable:google.protobuf.SourceCodeInfo.Location.trailing_comments)
return trailing_comments_.Mutable(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(), GetArenaNoVirtual());
}
inline std::string* SourceCodeInfo_Location::release_trailing_comments() {
@@ -11581,6 +12544,10 @@
inline void SourceCodeInfo_Location::clear_leading_detached_comments() {
leading_detached_comments_.Clear();
}
+inline std::string* SourceCodeInfo_Location::add_leading_detached_comments() {
+ // @@protoc_insertion_point(field_add_mutable:google.protobuf.SourceCodeInfo.Location.leading_detached_comments)
+ return _internal_add_leading_detached_comments();
+}
inline const std::string& SourceCodeInfo_Location::leading_detached_comments(int index) const {
// @@protoc_insertion_point(field_get:google.protobuf.SourceCodeInfo.Location.leading_detached_comments)
return leading_detached_comments_.Get(index);
@@ -11607,8 +12574,7 @@
reinterpret_cast<const char*>(value), size);
// @@protoc_insertion_point(field_set_pointer:google.protobuf.SourceCodeInfo.Location.leading_detached_comments)
}
-inline std::string* SourceCodeInfo_Location::add_leading_detached_comments() {
- // @@protoc_insertion_point(field_add_mutable:google.protobuf.SourceCodeInfo.Location.leading_detached_comments)
+inline std::string* SourceCodeInfo_Location::_internal_add_leading_detached_comments() {
return leading_detached_comments_.Add();
}
inline void SourceCodeInfo_Location::add_leading_detached_comments(const std::string& value) {
@@ -11708,21 +12674,34 @@
}
// optional string source_file = 2;
-inline bool GeneratedCodeInfo_Annotation::has_source_file() const {
+inline bool GeneratedCodeInfo_Annotation::_internal_has_source_file() const {
return (_has_bits_[0] & 0x00000001u) != 0;
}
+inline bool GeneratedCodeInfo_Annotation::has_source_file() const {
+ return _internal_has_source_file();
+}
inline void GeneratedCodeInfo_Annotation::clear_source_file() {
source_file_.ClearToEmpty(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(), GetArenaNoVirtual());
_has_bits_[0] &= ~0x00000001u;
}
inline const std::string& GeneratedCodeInfo_Annotation::source_file() const {
// @@protoc_insertion_point(field_get:google.protobuf.GeneratedCodeInfo.Annotation.source_file)
- return source_file_.Get();
+ return _internal_source_file();
}
inline void GeneratedCodeInfo_Annotation::set_source_file(const std::string& value) {
+ _internal_set_source_file(value);
+ // @@protoc_insertion_point(field_set:google.protobuf.GeneratedCodeInfo.Annotation.source_file)
+}
+inline std::string* GeneratedCodeInfo_Annotation::mutable_source_file() {
+ // @@protoc_insertion_point(field_mutable:google.protobuf.GeneratedCodeInfo.Annotation.source_file)
+ return _internal_mutable_source_file();
+}
+inline const std::string& GeneratedCodeInfo_Annotation::_internal_source_file() const {
+ return source_file_.Get();
+}
+inline void GeneratedCodeInfo_Annotation::_internal_set_source_file(const std::string& value) {
_has_bits_[0] |= 0x00000001u;
source_file_.Set(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(), value, GetArenaNoVirtual());
- // @@protoc_insertion_point(field_set:google.protobuf.GeneratedCodeInfo.Annotation.source_file)
}
inline void GeneratedCodeInfo_Annotation::set_source_file(std::string&& value) {
_has_bits_[0] |= 0x00000001u;
@@ -11744,9 +12723,8 @@
reinterpret_cast<const char*>(value), size), GetArenaNoVirtual());
// @@protoc_insertion_point(field_set_pointer:google.protobuf.GeneratedCodeInfo.Annotation.source_file)
}
-inline std::string* GeneratedCodeInfo_Annotation::mutable_source_file() {
+inline std::string* GeneratedCodeInfo_Annotation::_internal_mutable_source_file() {
_has_bits_[0] |= 0x00000001u;
- // @@protoc_insertion_point(field_mutable:google.protobuf.GeneratedCodeInfo.Annotation.source_file)
return source_file_.Mutable(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(), GetArenaNoVirtual());
}
inline std::string* GeneratedCodeInfo_Annotation::release_source_file() {
@@ -11788,9 +12766,12 @@
}
// optional int32 begin = 3;
-inline bool GeneratedCodeInfo_Annotation::has_begin() const {
+inline bool GeneratedCodeInfo_Annotation::_internal_has_begin() const {
return (_has_bits_[0] & 0x00000002u) != 0;
}
+inline bool GeneratedCodeInfo_Annotation::has_begin() const {
+ return _internal_has_begin();
+}
inline void GeneratedCodeInfo_Annotation::clear_begin() {
begin_ = 0;
_has_bits_[0] &= ~0x00000002u;
@@ -11806,9 +12787,12 @@
}
// optional int32 end = 4;
-inline bool GeneratedCodeInfo_Annotation::has_end() const {
+inline bool GeneratedCodeInfo_Annotation::_internal_has_end() const {
return (_has_bits_[0] & 0x00000004u) != 0;
}
+inline bool GeneratedCodeInfo_Annotation::has_end() const {
+ return _internal_has_end();
+}
inline void GeneratedCodeInfo_Annotation::clear_end() {
end_ = 0;
_has_bits_[0] &= ~0x00000004u;
diff --git a/src/google/protobuf/descriptor_database.cc b/src/google/protobuf/descriptor_database.cc
index fe6b02c..b613148 100644
--- a/src/google/protobuf/descriptor_database.cc
+++ b/src/google/protobuf/descriptor_database.cc
@@ -38,7 +38,6 @@
#include <google/protobuf/descriptor.pb.h>
#include <google/protobuf/stubs/strutil.h>
-
#include <google/protobuf/stubs/map_util.h>
#include <google/protobuf/stubs/stl_util.h>
diff --git a/src/google/protobuf/descriptor_unittest.cc b/src/google/protobuf/descriptor_unittest.cc
index 568e983..b315f26 100644
--- a/src/google/protobuf/descriptor_unittest.cc
+++ b/src/google/protobuf/descriptor_unittest.cc
@@ -4535,8 +4535,7 @@
" }"
"}",
- "foo.proto: Foo.foo: TYPE: Message extensions cannot have required "
- "fields.\n");
+ "foo.proto: Foo.foo: TYPE: The extension Foo.foo cannot be required.\n");
}
TEST_F(ValidationErrorTest, UndefinedFieldType) {
diff --git a/src/google/protobuf/duration.pb.cc b/src/google/protobuf/duration.pb.cc
index 6f0cec7..c029235 100644
--- a/src/google/protobuf/duration.pb.cc
+++ b/src/google/protobuf/duration.pb.cc
@@ -32,7 +32,7 @@
}
PROTOBUF_EXPORT ::PROTOBUF_NAMESPACE_ID::internal::SCCInfo<0> scc_info_Duration_google_2fprotobuf_2fduration_2eproto =
- {{ATOMIC_VAR_INIT(::PROTOBUF_NAMESPACE_ID::internal::SCCInfoBase::kUninitialized), 0, InitDefaultsscc_info_Duration_google_2fprotobuf_2fduration_2eproto}, {}};
+ {{ATOMIC_VAR_INIT(::PROTOBUF_NAMESPACE_ID::internal::SCCInfoBase::kUninitialized), 0, 0, InitDefaultsscc_info_Duration_google_2fprotobuf_2fduration_2eproto}, {}};
static ::PROTOBUF_NAMESPACE_ID::Metadata file_level_metadata_google_2fprotobuf_2fduration_2eproto[1];
static constexpr ::PROTOBUF_NAMESPACE_ID::EnumDescriptor const** file_level_enum_descriptors_google_2fprotobuf_2fduration_2eproto = nullptr;
diff --git a/src/google/protobuf/duration.proto b/src/google/protobuf/duration.proto
index 9d8a52d..99cb102 100644
--- a/src/google/protobuf/duration.proto
+++ b/src/google/protobuf/duration.proto
@@ -61,7 +61,7 @@
// if (duration.seconds < 0 && duration.nanos > 0) {
// duration.seconds += 1;
// duration.nanos -= 1000000000;
-// } else if (durations.seconds > 0 && duration.nanos < 0) {
+// } else if (duration.seconds > 0 && duration.nanos < 0) {
// duration.seconds -= 1;
// duration.nanos += 1000000000;
// }
diff --git a/src/google/protobuf/empty.pb.cc b/src/google/protobuf/empty.pb.cc
index caa48d0..a919ce0 100644
--- a/src/google/protobuf/empty.pb.cc
+++ b/src/google/protobuf/empty.pb.cc
@@ -32,7 +32,7 @@
}
PROTOBUF_EXPORT ::PROTOBUF_NAMESPACE_ID::internal::SCCInfo<0> scc_info_Empty_google_2fprotobuf_2fempty_2eproto =
- {{ATOMIC_VAR_INIT(::PROTOBUF_NAMESPACE_ID::internal::SCCInfoBase::kUninitialized), 0, InitDefaultsscc_info_Empty_google_2fprotobuf_2fempty_2eproto}, {}};
+ {{ATOMIC_VAR_INIT(::PROTOBUF_NAMESPACE_ID::internal::SCCInfoBase::kUninitialized), 0, 0, InitDefaultsscc_info_Empty_google_2fprotobuf_2fempty_2eproto}, {}};
static ::PROTOBUF_NAMESPACE_ID::Metadata file_level_metadata_google_2fprotobuf_2fempty_2eproto[1];
static constexpr ::PROTOBUF_NAMESPACE_ID::EnumDescriptor const** file_level_enum_descriptors_google_2fprotobuf_2fempty_2eproto = nullptr;
diff --git a/src/google/protobuf/extension_set.h b/src/google/protobuf/extension_set.h
index a7de200..81de4a4 100644
--- a/src/google/protobuf/extension_set.h
+++ b/src/google/protobuf/extension_set.h
@@ -1334,7 +1334,7 @@
// This is the type of actual extension objects. E.g. if you have:
// extends Foo with optional int32 bar = 1234;
// then "bar" will be defined in C++ as:
-// ExtensionIdentifier<Foo, PrimitiveTypeTraits<int32>, 1, false> bar(1234);
+// ExtensionIdentifier<Foo, PrimitiveTypeTraits<int32>, 5, false> bar(1234);
//
// Note that we could, in theory, supply the field number as a template
// parameter, and thus make an instance of ExtensionIdentifier have no
diff --git a/src/google/protobuf/extension_set_inl.h b/src/google/protobuf/extension_set_inl.h
index 9e15a17..ec6efee 100644
--- a/src/google/protobuf/extension_set_inl.h
+++ b/src/google/protobuf/extension_set_inl.h
@@ -84,7 +84,7 @@
#define HANDLE_VARINT_TYPE(UPPERCASE, CPP_CAMELCASE) \
case WireFormatLite::TYPE_##UPPERCASE: { \
uint64 value; \
- ptr = ParseVarint64(ptr, &value); \
+ ptr = VarintParse(ptr, &value); \
GOOGLE_PROTOBUF_PARSER_ASSERT(ptr); \
if (extension.is_repeated) { \
Add##CPP_CAMELCASE(number, WireFormatLite::TYPE_##UPPERCASE, \
@@ -103,7 +103,7 @@
#define HANDLE_SVARINT_TYPE(UPPERCASE, CPP_CAMELCASE, SIZE) \
case WireFormatLite::TYPE_##UPPERCASE: { \
uint64 val; \
- ptr = ParseVarint64(ptr, &val); \
+ ptr = VarintParse(ptr, &val); \
GOOGLE_PROTOBUF_PARSER_ASSERT(ptr); \
auto value = WireFormatLite::ZigZagDecode##SIZE(val); \
if (extension.is_repeated) { \
@@ -120,8 +120,7 @@
#undef HANDLE_SVARINT_TYPE
#define HANDLE_FIXED_TYPE(UPPERCASE, CPP_CAMELCASE, CPPTYPE) \
case WireFormatLite::TYPE_##UPPERCASE: { \
- CPPTYPE value; \
- std::memcpy(&value, ptr, sizeof(CPPTYPE)); \
+ auto value = UnalignedLoad<CPPTYPE>(ptr); \
ptr += sizeof(CPPTYPE); \
if (extension.is_repeated) { \
Add##CPP_CAMELCASE(number, WireFormatLite::TYPE_##UPPERCASE, \
@@ -143,7 +142,7 @@
case WireFormatLite::TYPE_ENUM: {
uint64 val;
- ptr = ParseVarint64(ptr, &val);
+ ptr = VarintParse(ptr, &val);
GOOGLE_PROTOBUF_PARSER_ASSERT(ptr);
int value = val;
@@ -213,7 +212,7 @@
uint32 tag = static_cast<uint8>(*ptr++);
if (tag == WireFormatLite::kMessageSetTypeIdTag) {
uint64 tmp;
- ptr = ParseVarint64Inline(ptr, &tmp);
+ ptr = ParseBigVarint(ptr, &tmp);
GOOGLE_PROTOBUF_PARSER_ASSERT(ptr);
type_id = tmp;
if (!payload.empty()) {
@@ -257,13 +256,7 @@
GOOGLE_PROTOBUF_PARSER_ASSERT(ptr);
}
} else {
- if (tag >= 128) {
- // Parse remainder of tag varint
- uint32 tmp;
- ptr = VarintParse<4>(ptr, &tmp);
- GOOGLE_PROTOBUF_PARSER_ASSERT(ptr);
- tag += (tmp - 1) << 7;
- }
+ ptr = ReadTag(ptr - 1, &tag);
if (tag == 0 || (tag & 7) == 4) {
ctx->SetLastTag(tag);
return ptr;
diff --git a/src/google/protobuf/extension_set_unittest.cc b/src/google/protobuf/extension_set_unittest.cc
index 6dd6f7d..c08782b 100644
--- a/src/google/protobuf/extension_set_unittest.cc
+++ b/src/google/protobuf/extension_set_unittest.cc
@@ -33,7 +33,6 @@
// Sanjay Ghemawat, Jeff Dean, and others.
#include <google/protobuf/stubs/casts.h>
-
#include <google/protobuf/stubs/strutil.h>
#include <google/protobuf/test_util.h>
#include <google/protobuf/test_util2.h>
diff --git a/src/google/protobuf/field_mask.pb.cc b/src/google/protobuf/field_mask.pb.cc
index 5761909..9c83c8c 100644
--- a/src/google/protobuf/field_mask.pb.cc
+++ b/src/google/protobuf/field_mask.pb.cc
@@ -32,7 +32,7 @@
}
PROTOBUF_EXPORT ::PROTOBUF_NAMESPACE_ID::internal::SCCInfo<0> scc_info_FieldMask_google_2fprotobuf_2ffield_5fmask_2eproto =
- {{ATOMIC_VAR_INIT(::PROTOBUF_NAMESPACE_ID::internal::SCCInfoBase::kUninitialized), 0, InitDefaultsscc_info_FieldMask_google_2fprotobuf_2ffield_5fmask_2eproto}, {}};
+ {{ATOMIC_VAR_INIT(::PROTOBUF_NAMESPACE_ID::internal::SCCInfoBase::kUninitialized), 0, 0, InitDefaultsscc_info_FieldMask_google_2fprotobuf_2ffield_5fmask_2eproto}, {}};
static ::PROTOBUF_NAMESPACE_ID::Metadata file_level_metadata_google_2fprotobuf_2ffield_5fmask_2eproto[1];
static constexpr ::PROTOBUF_NAMESPACE_ID::EnumDescriptor const** file_level_enum_descriptors_google_2fprotobuf_2ffield_5fmask_2eproto = nullptr;
@@ -162,10 +162,10 @@
ptr -= 1;
do {
ptr += 1;
- ptr = ::PROTOBUF_NAMESPACE_ID::internal::InlineGreedyStringParserUTF8(add_paths(), ptr, ctx, "google.protobuf.FieldMask.paths");
+ ptr = ::PROTOBUF_NAMESPACE_ID::internal::InlineGreedyStringParserUTF8(_internal_add_paths(), ptr, ctx, "google.protobuf.FieldMask.paths");
CHK_(ptr);
if (!ctx->DataAvailable(ptr)) break;
- } while (::PROTOBUF_NAMESPACE_ID::internal::UnalignedLoad<::PROTOBUF_NAMESPACE_ID::uint8>(ptr) == 10);
+ } while (::PROTOBUF_NAMESPACE_ID::internal::ExpectTag<10>(ptr));
} else goto handle_unusual;
continue;
default: {
@@ -202,10 +202,10 @@
case 1: {
if (static_cast< ::PROTOBUF_NAMESPACE_ID::uint8>(tag) == (10 & 0xFF)) {
DO_(::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::ReadString(
- input, this->add_paths()));
+ input, this->_internal_add_paths()));
DO_(::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::VerifyUtf8String(
- this->paths(this->paths_size() - 1).data(),
- static_cast<int>(this->paths(this->paths_size() - 1).length()),
+ paths_.Get(paths_.size() - 1).data(),
+ static_cast<int>(paths_.Get(paths_.size() - 1).length()),
::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::PARSE,
"google.protobuf.FieldMask.paths"));
} else {
@@ -242,8 +242,8 @@
(void) cached_has_bits;
// repeated string paths = 1;
- for (auto it = this->paths().pointer_begin(),
- end = this->paths().pointer_end(); it < end; ++it) {
+ for (auto it = paths_.pointer_begin(),
+ end = paths_.pointer_end(); it < end; ++it) {
const auto& s = **it;
::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::VerifyUtf8String(
s.data(), static_cast<int>(s.length()),
@@ -270,10 +270,10 @@
// repeated string paths = 1;
total_size += 1 *
- ::PROTOBUF_NAMESPACE_ID::internal::FromIntSize(this->paths_size());
- for (int i = 0, n = this->paths_size(); i < n; i++) {
+ ::PROTOBUF_NAMESPACE_ID::internal::FromIntSize(paths_.size());
+ for (int i = 0, n = paths_.size(); i < n; i++) {
total_size += ::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::StringSize(
- this->paths(i));
+ paths_.Get(i));
}
if (PROTOBUF_PREDICT_FALSE(_internal_metadata_.have_unknown_fields())) {
@@ -331,7 +331,7 @@
void FieldMask::InternalSwap(FieldMask* other) {
using std::swap;
_internal_metadata_.Swap(&other->_internal_metadata_);
- paths_.InternalSwap(CastToBase(&other->paths_));
+ paths_.InternalSwap(&other->paths_);
}
::PROTOBUF_NAMESPACE_ID::Metadata FieldMask::GetMetadata() const {
diff --git a/src/google/protobuf/field_mask.pb.h b/src/google/protobuf/field_mask.pb.h
index 44160db..d4937ec 100644
--- a/src/google/protobuf/field_mask.pb.h
+++ b/src/google/protobuf/field_mask.pb.h
@@ -215,6 +215,9 @@
void add_paths(const char* value, size_t size);
const ::PROTOBUF_NAMESPACE_ID::RepeatedPtrField<std::string>& paths() const;
::PROTOBUF_NAMESPACE_ID::RepeatedPtrField<std::string>* mutable_paths();
+ private:
+ std::string* _internal_add_paths();
+ public:
// @@protoc_insertion_point(class_scope:google.protobuf.FieldMask)
private:
@@ -246,6 +249,10 @@
inline void FieldMask::clear_paths() {
paths_.Clear();
}
+inline std::string* FieldMask::add_paths() {
+ // @@protoc_insertion_point(field_add_mutable:google.protobuf.FieldMask.paths)
+ return _internal_add_paths();
+}
inline const std::string& FieldMask::paths(int index) const {
// @@protoc_insertion_point(field_get:google.protobuf.FieldMask.paths)
return paths_.Get(index);
@@ -272,8 +279,7 @@
reinterpret_cast<const char*>(value), size);
// @@protoc_insertion_point(field_set_pointer:google.protobuf.FieldMask.paths)
}
-inline std::string* FieldMask::add_paths() {
- // @@protoc_insertion_point(field_add_mutable:google.protobuf.FieldMask.paths)
+inline std::string* FieldMask::_internal_add_paths() {
return paths_.Add();
}
inline void FieldMask::add_paths(const std::string& value) {
diff --git a/src/google/protobuf/generated_message_reflection.h b/src/google/protobuf/generated_message_reflection.h
index f61dce4..cbfab5e 100644
--- a/src/google/protobuf/generated_message_reflection.h
+++ b/src/google/protobuf/generated_message_reflection.h
@@ -69,7 +69,6 @@
} // namespace protobuf
} // namespace google
-
namespace google {
namespace protobuf {
namespace internal {
diff --git a/src/google/protobuf/generated_message_util.cc b/src/google/protobuf/generated_message_util.cc
index 6cf87aa..bdeabdd 100644
--- a/src/google/protobuf/generated_message_util.cc
+++ b/src/google/protobuf/generated_message_util.cc
@@ -44,19 +44,18 @@
#include <vector>
-#include <google/protobuf/io/coded_stream_inl.h>
#include <google/protobuf/io/coded_stream.h>
+#include <google/protobuf/io/zero_copy_stream_impl_lite.h>
#include <google/protobuf/arenastring.h>
#include <google/protobuf/extension_set.h>
#include <google/protobuf/generated_message_table_driven.h>
#include <google/protobuf/message_lite.h>
#include <google/protobuf/metadata_lite.h>
#include <google/protobuf/stubs/mutex.h>
+#include <google/protobuf/port_def.inc>
#include <google/protobuf/repeated_field.h>
#include <google/protobuf/wire_format_lite.h>
-#include <google/protobuf/port_def.inc>
-
namespace google {
namespace protobuf {
@@ -766,10 +765,19 @@
SCCInfoBase::kUninitialized)
return;
scc->visit_status.store(SCCInfoBase::kRunning, std::memory_order_relaxed);
- // Each base is followed by an array of pointers to deps
- auto deps = reinterpret_cast<SCCInfoBase* const*>(scc + 1);
- for (int i = 0; i < scc->num_deps; i++) {
- if (deps[i]) InitSCC_DFS(deps[i]);
+ // Each base is followed by an array of void*, containing first pointers to
+ // SCCInfoBase and then pointers-to-pointers to SCCInfoBase.
+ auto deps = reinterpret_cast<void**>(scc + 1);
+ auto strong_deps = reinterpret_cast<SCCInfoBase* const*>(deps);
+ for (int i = 0; i < scc->num_deps; ++i) {
+ if (strong_deps[i]) InitSCC_DFS(strong_deps[i]);
+ }
+ auto implicit_weak_deps =
+ reinterpret_cast<SCCInfoBase** const*>(deps + scc->num_deps);
+ for (int i = 0; i < scc->num_implicit_weak_deps; ++i) {
+ if (*implicit_weak_deps[i]) {
+ InitSCC_DFS(*implicit_weak_deps[i]);
+ }
}
scc->init_func();
// Mark done (note we use memory order release here), other threads could
diff --git a/src/google/protobuf/generated_message_util.h b/src/google/protobuf/generated_message_util.h
index 4e8ad91..ecb8c0a 100644
--- a/src/google/protobuf/generated_message_util.h
+++ b/src/google/protobuf/generated_message_util.h
@@ -197,21 +197,35 @@
std::atomic<int> visit_status;
#endif
int num_deps;
+ int num_implicit_weak_deps;
void (*init_func)();
// This is followed by an array of num_deps
// const SCCInfoBase* deps[];
};
+// Zero-length arrays are a language extension available in GCC and Clang but
+// not MSVC.
+#ifdef __GNUC__
+#define PROTOBUF_ARRAY_SIZE(n) (n)
+#else
+#define PROTOBUF_ARRAY_SIZE(n) ((n) ? (n) : 1)
+#endif
+
template <int N>
struct SCCInfo {
SCCInfoBase base;
// Semantically this is const SCCInfo<T>* which is is a templated type.
// The obvious inheriting from SCCInfoBase mucks with struct initialization.
// Attempts showed the compiler was generating dynamic initialization code.
- // Zero length arrays produce warnings with MSVC.
- SCCInfoBase* deps[N ? N : 1];
+ // This deps array consists of base.num_deps pointers to SCCInfoBase followed
+ // by base.num_implicit_weak_deps pointers to SCCInfoBase*. We need the extra
+ // pointer indirection for implicit weak fields. We cannot use a union type
+ // here, since that would prevent the array from being linker-initialized.
+ void* deps[PROTOBUF_ARRAY_SIZE(N)];
};
+#undef PROTOBUF_ARRAY_SIZE
+
PROTOBUF_EXPORT void InitSCCImpl(SCCInfoBase* scc);
inline void InitSCC(SCCInfoBase* scc) {
diff --git a/src/google/protobuf/implicit_weak_message.h b/src/google/protobuf/implicit_weak_message.h
index a0cb1c1..10d430c 100644
--- a/src/google/protobuf/implicit_weak_message.h
+++ b/src/google/protobuf/implicit_weak_message.h
@@ -32,16 +32,18 @@
#define GOOGLE_PROTOBUF_IMPLICIT_WEAK_MESSAGE_H__
#include <string>
+
#include <google/protobuf/io/coded_stream.h>
#include <google/protobuf/arena.h>
#include <google/protobuf/message_lite.h>
-
-#include <google/protobuf/port_def.inc>
+#include <google/protobuf/repeated_field.h>
#ifdef SWIG
#error "You cannot SWIG proto headers"
#endif
+#include <google/protobuf/port_def.inc>
+
// This file is logically internal-only and should only be used by protobuf
// generated code.
@@ -104,15 +106,9 @@
template <typename ImplicitWeakType>
class ImplicitWeakTypeHandler {
public:
- typedef ImplicitWeakType Type;
- typedef MessageLite WeakType;
+ typedef MessageLite Type;
static const bool Moveable = false;
- // With implicit weak fields, we need separate NewFromPrototype and
- // NewFromPrototypeWeak functions. The former is used when we want to create a
- // strong dependency on the message type, and it just delegates to the
- // GenericTypeHandler. The latter avoids creating a strong dependency, by
- // simply calling MessageLite::New.
static inline MessageLite* NewFromPrototype(const MessageLite* prototype,
Arena* arena = NULL) {
return prototype->New(arena);
@@ -133,12 +129,66 @@
static void Merge(const MessageLite& from, MessageLite* to) {
to->CheckTypeAndMergeFrom(from);
}
- static inline size_t SpaceUsedLong(const Type& value) {
- return value.SpaceUsedLong();
- }
};
} // namespace internal
+
+template <typename T>
+struct WeakRepeatedPtrField {
+ using TypeHandler = internal::ImplicitWeakTypeHandler<T>;
+ WeakRepeatedPtrField() : weak() {}
+ explicit WeakRepeatedPtrField(Arena* arena) : weak(arena) {}
+ ~WeakRepeatedPtrField() { weak.template Destroy<TypeHandler>(); }
+
+ typedef internal::RepeatedPtrIterator<MessageLite> iterator;
+ typedef internal::RepeatedPtrIterator<const MessageLite> const_iterator;
+ typedef internal::RepeatedPtrOverPtrsIterator<MessageLite*, void*>
+ pointer_iterator;
+ typedef internal::RepeatedPtrOverPtrsIterator<const MessageLite* const,
+ const void* const>
+ const_pointer_iterator;
+
+ iterator begin() { return iterator(base().raw_data()); }
+ const_iterator begin() const { return iterator(base().raw_data()); }
+ const_iterator cbegin() const { return begin(); }
+ iterator end() { return begin() + base().size(); }
+ const_iterator end() const { return begin() + base().size(); }
+ const_iterator cend() const { return end(); }
+ pointer_iterator pointer_begin() {
+ return pointer_iterator(base().raw_mutable_data());
+ }
+ const_pointer_iterator pointer_begin() const {
+ return const_pointer_iterator(base().raw_mutable_data());
+ }
+ pointer_iterator pointer_end() {
+ return pointer_iterator(base().raw_mutable_data() + base().size());
+ }
+ const_pointer_iterator pointer_end() const {
+ return const_pointer_iterator(base().raw_mutable_data() + base().size());
+ }
+
+ MessageLite* AddWeak(const MessageLite* prototype) {
+ return base().AddWeak(prototype);
+ }
+ T* Add() { return weak.Add(); }
+ void Clear() { base().template Clear<TypeHandler>(); }
+ void MergeFrom(const WeakRepeatedPtrField& other) {
+ base().template MergeFrom<TypeHandler>(other.base());
+ }
+ void InternalSwap(WeakRepeatedPtrField* other) {
+ base().InternalSwap(&other->base());
+ }
+
+ const internal::RepeatedPtrFieldBase& base() const { return weak; }
+ internal::RepeatedPtrFieldBase& base() { return weak; }
+ // Union disables running the destructor. Which would create a strong link.
+ // Instead we explicitly destroy the underlying base through the virtual
+ // destructor.
+ union {
+ RepeatedPtrField<T> weak;
+ };
+};
+
} // namespace protobuf
} // namespace google
diff --git a/src/google/protobuf/io/coded_stream.cc b/src/google/protobuf/io/coded_stream.cc
index f04dc1d..003858a 100644
--- a/src/google/protobuf/io/coded_stream.cc
+++ b/src/google/protobuf/io/coded_stream.cc
@@ -48,9 +48,9 @@
#include <google/protobuf/stubs/logging.h>
#include <google/protobuf/stubs/common.h>
-#include <google/protobuf/io/coded_stream_inl.h>
-#include <google/protobuf/io/zero_copy_stream.h>
#include <google/protobuf/arena.h>
+#include <google/protobuf/io/zero_copy_stream.h>
+#include <google/protobuf/io/zero_copy_stream_impl_lite.h>
#include <google/protobuf/stubs/stl_util.h>
@@ -190,12 +190,13 @@
}
void CodedInputStream::PrintTotalBytesLimitError() {
- GOOGLE_LOG(ERROR) << "A protocol message was rejected because it was too "
- "big (more than "
- << total_bytes_limit_
- << " bytes). To increase the limit (or to disable these "
- "warnings), see CodedInputStream::SetTotalBytesLimit() "
- "in net/proto2/io/public/coded_stream.h.";
+ GOOGLE_LOG(ERROR)
+ << "A protocol message was rejected because it was too "
+ "big (more than "
+ << total_bytes_limit_
+ << " bytes). To increase the limit (or to disable these "
+ "warnings), see CodedInputStream::SetTotalBytesLimit() "
+ "in third_party/protobuf/src/google/protobuf/io/coded_stream.h.";
}
bool CodedInputStream::SkipFallback(int count, int original_buffer_size) {
@@ -238,12 +239,39 @@
}
bool CodedInputStream::ReadRaw(void* buffer, int size) {
- return InternalReadRawInline(buffer, size);
+ int current_buffer_size;
+ while ((current_buffer_size = BufferSize()) < size) {
+ // Reading past end of buffer. Copy what we have, then refresh.
+ memcpy(buffer, buffer_, current_buffer_size);
+ buffer = reinterpret_cast<uint8*>(buffer) + current_buffer_size;
+ size -= current_buffer_size;
+ Advance(current_buffer_size);
+ if (!Refresh()) return false;
+ }
+
+ memcpy(buffer, buffer_, size);
+ Advance(size);
+
+ return true;
}
bool CodedInputStream::ReadString(std::string* buffer, int size) {
if (size < 0) return false; // security: size is often user-supplied
- return InternalReadStringInline(buffer, size);
+
+ if (BufferSize() >= size) {
+ STLStringResizeUninitialized(buffer, size);
+ std::pair<char*, bool> z = as_string_data(buffer);
+ if (z.second) {
+ // Oddly enough, memcpy() requires its first two args to be non-NULL even
+ // if we copy 0 bytes. So, we have ensured that z.first is non-NULL here.
+ GOOGLE_DCHECK(z.first != NULL);
+ memcpy(z.first, buffer_, size);
+ Advance(size);
+ }
+ return true;
+ }
+
+ return ReadStringFallback(buffer, size);
}
bool CodedInputStream::ReadStringFallback(std::string* buffer, int size) {
diff --git a/src/google/protobuf/io/coded_stream.h b/src/google/protobuf/io/coded_stream.h
index c620d89..fd75850 100755
--- a/src/google/protobuf/io/coded_stream.h
+++ b/src/google/protobuf/io/coded_stream.h
@@ -139,8 +139,8 @@
#endif
#include <google/protobuf/stubs/common.h>
#include <google/protobuf/stubs/logging.h>
-#include <google/protobuf/port.h>
#include <google/protobuf/stubs/strutil.h>
+#include <google/protobuf/port.h>
#include <google/protobuf/stubs/port.h>
@@ -219,17 +219,8 @@
// Read raw bytes, copying them into the given buffer.
bool ReadRaw(void* buffer, int size);
- // Like the above, with inlined optimizations. This should only be used
- // by the protobuf implementation.
- PROTOBUF_ALWAYS_INLINE
- bool InternalReadRawInline(void* buffer, int size);
-
// Like ReadRaw, but reads into a string.
bool ReadString(std::string* buffer, int size);
- // Like the above, with inlined optimizations. This should only be used
- // by the protobuf implementation.
- PROTOBUF_ALWAYS_INLINE
- bool InternalReadStringInline(std::string* buffer, int size);
// Read a 32-bit little-endian integer.
@@ -814,37 +805,12 @@
// remains live until all of the data has been consumed from the stream.
void EnableAliasing(bool enabled);
- // Deterministic serialization, if requested, guarantees that for a given
- // binary, equal messages will always be serialized to the same bytes. This
- // implies:
- // . repeated serialization of a message will return the same bytes
- // . different processes of the same binary (which may be executing on
- // different machines) will serialize equal messages to the same bytes.
- //
- // Note the deterministic serialization is NOT canonical across languages; it
- // is also unstable across different builds with schema changes due to unknown
- // fields. Users who need canonical serialization, e.g., persistent storage in
- // a canonical form, fingerprinting, etc., should define their own
- // canonicalization specification and implement the serializer using
- // reflection APIs rather than relying on this API.
- //
- // If deterministic serialization is requested, the serializer will
- // sort map entries by keys in lexicographical order or numerical order.
- // (This is an implementation detail and may subject to change.)
- //
- // There are two ways to determine whether serialization should be
- // deterministic for this CodedOutputStream. If SetSerializationDeterministic
- // has not yet been called, then the default comes from the global default,
- // which is false, until SetDefaultSerializationDeterministic has been called.
- // Otherwise, SetSerializationDeterministic has been called, and the last
- // value passed to it is all that matters.
+ // See documentation on CodedOutputStream::SetSerializationDeterministic.
void SetSerializationDeterministic(bool value) {
is_serialization_deterministic_ = value;
}
- // See above. Also, note that users of this CodedOutputStream may need to
- // call IsSerializationDeterministic() to serialize in the intended way. This
- // CodedOutputStream cannot enforce a desire for deterministic serialization
- // by itself.
+
+ // See documentation on CodedOutputStream::IsSerializationDeterministic.
bool IsSerializationDeterministic() const {
return is_serialization_deterministic_;
}
@@ -1233,14 +1199,32 @@
// remains live until all of the data has been consumed from the stream.
void EnableAliasing(bool enabled) { impl_.EnableAliasing(enabled); }
+ // Indicate to the serializer whether the user wants derministic
+ // serialization. The default when this is not called comes from the global
+ // default, controlled by SetDefaultSerializationDeterministic.
+ //
+ // What deterministic serialization means is entirely up to the driver of the
+ // serialization process (i.e. the caller of methods like WriteVarint32). In
+ // the case of serializing a proto buffer message using one of the methods of
+ // MessageLite, this means that for a given binary equal messages will always
+ // be serialized to the same bytes. This implies:
+ //
+ // * Repeated serialization of a message will return the same bytes.
+ //
+ // * Different processes running the same binary (including on different
+ // machines) will serialize equal messages to the same bytes.
+ //
+ // Note that this is *not* canonical across languages. It is also unstable
+ // across different builds with intervening message definition changes, due to
+ // unknown fields. Users who need canonical serialization (e.g. persistent
+ // storage in a canonical form, fingerprinting) should define their own
+ // canonicalization specification and implement the serializer using
+ // reflection APIs rather than relying on this API.
void SetSerializationDeterministic(bool value) {
impl_.SetSerializationDeterministic(value);
}
- // See above. Also, note that users of this CodedOutputStream may need to
- // call IsSerializationDeterministic() to serialize in the intended way. This
- // CodedOutputStream cannot enforce a desire for deterministic serialization
- // by itself.
+ // Return whether the user wants deterministic serialization. See above.
bool IsSerializationDeterministic() const {
return impl_.IsSerializationDeterministic();
}
diff --git a/src/google/protobuf/io/coded_stream_inl.h b/src/google/protobuf/io/coded_stream_inl.h
deleted file mode 100644
index 0c10e65..0000000
--- a/src/google/protobuf/io/coded_stream_inl.h
+++ /dev/null
@@ -1,90 +0,0 @@
-// Protocol Buffers - Google's data interchange format
-// Copyright 2008 Google Inc. All rights reserved.
-// https://developers.google.com/protocol-buffers/
-//
-// Redistribution and use in source and binary forms, with or without
-// modification, are permitted provided that the following conditions are
-// met:
-//
-// * Redistributions of source code must retain the above copyright
-// notice, this list of conditions and the following disclaimer.
-// * Redistributions in binary form must reproduce the above
-// copyright notice, this list of conditions and the following disclaimer
-// in the documentation and/or other materials provided with the
-// distribution.
-// * Neither the name of Google Inc. nor the names of its
-// contributors may be used to endorse or promote products derived from
-// this software without specific prior written permission.
-//
-// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
-// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
-// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
-// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
-// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
-// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
-// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
-// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
-// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
-// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
-// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
-
-// Author: jasonh@google.com (Jason Hsueh)
-//
-// Implements methods of coded_stream.h that need to be inlined for performance
-// reasons, but should not be defined in a public header.
-
-#ifndef GOOGLE_PROTOBUF_IO_CODED_STREAM_INL_H__
-#define GOOGLE_PROTOBUF_IO_CODED_STREAM_INL_H__
-
-#include <string>
-#include <google/protobuf/stubs/logging.h>
-#include <google/protobuf/stubs/common.h>
-#include <google/protobuf/io/coded_stream.h>
-#include <google/protobuf/io/zero_copy_stream_impl_lite.h>
-#include <google/protobuf/stubs/stl_util.h>
-
-namespace google {
-namespace protobuf {
-namespace io {
-
-inline bool CodedInputStream::InternalReadStringInline(std::string* buffer,
- int size) {
- if (size < 0) return false; // security: size is often user-supplied
-
- if (BufferSize() >= size) {
- STLStringResizeUninitialized(buffer, size);
- std::pair<char*, bool> z = as_string_data(buffer);
- if (z.second) {
- // Oddly enough, memcpy() requires its first two args to be non-NULL even
- // if we copy 0 bytes. So, we have ensured that z.first is non-NULL here.
- GOOGLE_DCHECK(z.first != NULL);
- memcpy(z.first, buffer_, size);
- Advance(size);
- }
- return true;
- }
-
- return ReadStringFallback(buffer, size);
-}
-
-inline bool CodedInputStream::InternalReadRawInline(void* buffer, int size) {
- int current_buffer_size;
- while ((current_buffer_size = BufferSize()) < size) {
- // Reading past end of buffer. Copy what we have, then refresh.
- memcpy(buffer, buffer_, current_buffer_size);
- buffer = reinterpret_cast<uint8*>(buffer) + current_buffer_size;
- size -= current_buffer_size;
- Advance(current_buffer_size);
- if (!Refresh()) return false;
- }
-
- memcpy(buffer, buffer_, size);
- Advance(size);
-
- return true;
-}
-
-} // namespace io
-} // namespace protobuf
-} // namespace google
-#endif // GOOGLE_PROTOBUF_IO_CODED_STREAM_INL_H__
diff --git a/src/google/protobuf/io/coded_stream_unittest.cc b/src/google/protobuf/io/coded_stream_unittest.cc
index 52b7a7b..6018132 100644
--- a/src/google/protobuf/io/coded_stream_unittest.cc
+++ b/src/google/protobuf/io/coded_stream_unittest.cc
@@ -34,13 +34,13 @@
//
// This file contains tests and benchmarks.
-#include <memory>
-#include <vector>
-
#include <google/protobuf/io/coded_stream.h>
#include <limits.h>
+#include <memory>
+#include <vector>
+
#include <google/protobuf/stubs/common.h>
#include <google/protobuf/stubs/logging.h>
#include <google/protobuf/stubs/logging.h>
diff --git a/src/google/protobuf/io/io_win32.cc b/src/google/protobuf/io/io_win32.cc
index eae2b7f..fe023c7 100755
--- a/src/google/protobuf/io/io_win32.cc
+++ b/src/google/protobuf/io/io_win32.cc
@@ -49,19 +49,18 @@
// debug failing tests if that's caused by the long path support.
#define SUPPORT_LONGPATHS
+#include <google/protobuf/io/io_win32.h>
+
#include <ctype.h>
#include <direct.h>
#include <errno.h>
#include <fcntl.h>
#include <io.h>
-#include <memory>
#include <sys/stat.h>
#include <sys/types.h>
#include <wctype.h>
#include <windows.h>
-#include <google/protobuf/io/io_win32.h>
-
#include <memory>
#include <sstream>
#include <string>
diff --git a/src/google/protobuf/io/io_win32.h b/src/google/protobuf/io/io_win32.h
index cf5cb32..29829a4 100755
--- a/src/google/protobuf/io/io_win32.h
+++ b/src/google/protobuf/io/io_win32.h
@@ -50,6 +50,7 @@
#if defined(_WIN32)
#include <string>
+
#include <google/protobuf/port.h>
#include <google/protobuf/port_def.inc>
diff --git a/src/google/protobuf/io/io_win32_unittest.cc b/src/google/protobuf/io/io_win32_unittest.cc
index 53aa333..76429cf 100755
--- a/src/google/protobuf/io/io_win32_unittest.cc
+++ b/src/google/protobuf/io/io_win32_unittest.cc
@@ -40,6 +40,8 @@
#if defined(_WIN32)
#define WIN32_LEAN_AND_MEAN
+#include <google/protobuf/io/io_win32.h>
+
#include <errno.h>
#include <fcntl.h>
#include <stdlib.h>
@@ -49,13 +51,12 @@
#include <wchar.h>
#include <windows.h>
-#include <google/protobuf/io/io_win32.h>
-#include <gtest/gtest.h>
-
#include <memory>
#include <sstream>
#include <string>
+#include <gtest/gtest.h>
+
namespace google {
namespace protobuf {
namespace io {
diff --git a/src/google/protobuf/io/printer.cc b/src/google/protobuf/io/printer.cc
index 6a86c58..f8d4d2b 100644
--- a/src/google/protobuf/io/printer.cc
+++ b/src/google/protobuf/io/printer.cc
@@ -32,11 +32,12 @@
// Based on original Protocol Buffers design by
// Sanjay Ghemawat, Jeff Dean, and others.
+#include <google/protobuf/io/printer.h>
+
#include <cctype>
#include <google/protobuf/stubs/logging.h>
#include <google/protobuf/stubs/common.h>
-#include <google/protobuf/io/printer.h>
#include <google/protobuf/io/zero_copy_stream.h>
namespace google {
diff --git a/src/google/protobuf/io/printer.h b/src/google/protobuf/io/printer.h
index a55946e..afd5c7e 100644
--- a/src/google/protobuf/io/printer.h
+++ b/src/google/protobuf/io/printer.h
@@ -40,8 +40,8 @@
#include <map>
#include <string>
#include <vector>
-#include <google/protobuf/stubs/common.h>
+#include <google/protobuf/stubs/common.h>
#include <google/protobuf/port_def.inc>
namespace google {
diff --git a/src/google/protobuf/io/printer_unittest.cc b/src/google/protobuf/io/printer_unittest.cc
index b847fa7..ca45d67 100644
--- a/src/google/protobuf/io/printer_unittest.cc
+++ b/src/google/protobuf/io/printer_unittest.cc
@@ -32,16 +32,16 @@
// Based on original Protocol Buffers design by
// Sanjay Ghemawat, Jeff Dean, and others.
-#include <vector>
-
#include <google/protobuf/io/printer.h>
-#include <google/protobuf/io/zero_copy_stream_impl.h>
-#include <google/protobuf/descriptor.pb.h>
+
+#include <vector>
#include <google/protobuf/stubs/logging.h>
#include <google/protobuf/stubs/common.h>
+#include <google/protobuf/descriptor.pb.h>
#include <google/protobuf/testing/googletest.h>
#include <gtest/gtest.h>
+#include <google/protobuf/io/zero_copy_stream_impl.h>
namespace google {
namespace protobuf {
diff --git a/src/google/protobuf/io/tokenizer.cc b/src/google/protobuf/io/tokenizer.cc
index f8cf2eb..ff83946 100644
--- a/src/google/protobuf/io/tokenizer.cc
+++ b/src/google/protobuf/io/tokenizer.cc
@@ -89,12 +89,13 @@
// exactly pretty.
#include <google/protobuf/io/tokenizer.h>
+
#include <google/protobuf/stubs/common.h>
#include <google/protobuf/stubs/logging.h>
#include <google/protobuf/stubs/stringprintf.h>
+#include <google/protobuf/stubs/strutil.h>
#include <google/protobuf/io/strtod.h>
#include <google/protobuf/io/zero_copy_stream.h>
-#include <google/protobuf/stubs/strutil.h>
#include <google/protobuf/stubs/stl_util.h>
namespace google {
diff --git a/src/google/protobuf/io/tokenizer.h b/src/google/protobuf/io/tokenizer.h
index cb33b93..f2e1697 100644
--- a/src/google/protobuf/io/tokenizer.h
+++ b/src/google/protobuf/io/tokenizer.h
@@ -39,9 +39,9 @@
#include <string>
#include <vector>
+
#include <google/protobuf/stubs/common.h>
#include <google/protobuf/stubs/logging.h>
-
#include <google/protobuf/port_def.inc>
namespace google {
diff --git a/src/google/protobuf/io/tokenizer_unittest.cc b/src/google/protobuf/io/tokenizer_unittest.cc
index 37628ab..82c283c 100644
--- a/src/google/protobuf/io/tokenizer_unittest.cc
+++ b/src/google/protobuf/io/tokenizer_unittest.cc
@@ -32,18 +32,18 @@
// Based on original Protocol Buffers design by
// Sanjay Ghemawat, Jeff Dean, and others.
+#include <google/protobuf/io/tokenizer.h>
+
#include <limits.h>
#include <math.h>
#include <vector>
-#include <google/protobuf/io/tokenizer.h>
-#include <google/protobuf/io/zero_copy_stream_impl.h>
-
#include <google/protobuf/stubs/common.h>
#include <google/protobuf/stubs/logging.h>
#include <google/protobuf/stubs/strutil.h>
#include <google/protobuf/stubs/substitute.h>
+#include <google/protobuf/io/zero_copy_stream_impl.h>
#include <google/protobuf/testing/googletest.h>
#include <gtest/gtest.h>
diff --git a/src/google/protobuf/io/zero_copy_stream.h b/src/google/protobuf/io/zero_copy_stream.h
index de2374b..6be63cf 100644
--- a/src/google/protobuf/io/zero_copy_stream.h
+++ b/src/google/protobuf/io/zero_copy_stream.h
@@ -108,8 +108,8 @@
#define GOOGLE_PROTOBUF_IO_ZERO_COPY_STREAM_H__
#include <string>
-#include <google/protobuf/stubs/common.h>
+#include <google/protobuf/stubs/common.h>
#include <google/protobuf/port_def.inc>
@@ -117,6 +117,10 @@
namespace protobuf {
namespace io {
+// TODO(b/136291652): remove once we have switched the default to int64_t and
+// updated everyone who derives from this class.
+using ByteCountInt64 = int64_t;
+
// Defined in this file.
class ZeroCopyInputStream;
class ZeroCopyOutputStream;
@@ -171,7 +175,7 @@
virtual bool Skip(int count) = 0;
// Returns the total number of bytes read since this object was created.
- virtual int64 ByteCount() const = 0;
+ virtual ByteCountInt64 ByteCount() const = 0;
private:
@@ -226,7 +230,7 @@
virtual void BackUp(int count) = 0;
// Returns the total number of bytes written since this object was created.
- virtual int64 ByteCount() const = 0;
+ virtual ByteCountInt64 ByteCount() const = 0;
// Write a given chunk of data to the output. Some output streams may
// implement this in a way that avoids copying. Check AllowsAliasing() before
diff --git a/src/google/protobuf/io/zero_copy_stream_impl.cc b/src/google/protobuf/io/zero_copy_stream_impl.cc
index 4af76b7..f3004e4 100644
--- a/src/google/protobuf/io/zero_copy_stream_impl.cc
+++ b/src/google/protobuf/io/zero_copy_stream_impl.cc
@@ -39,8 +39,10 @@
#include <unistd.h>
#endif
#include <errno.h>
+
#include <algorithm>
#include <iostream>
+
#include <google/protobuf/stubs/common.h>
#include <google/protobuf/stubs/logging.h>
#include <google/protobuf/io/io_win32.h>
diff --git a/src/google/protobuf/io/zero_copy_stream_impl.h b/src/google/protobuf/io/zero_copy_stream_impl.h
index fd06c06..46a8fae 100644
--- a/src/google/protobuf/io/zero_copy_stream_impl.h
+++ b/src/google/protobuf/io/zero_copy_stream_impl.h
@@ -42,6 +42,7 @@
#include <iosfwd>
#include <string>
+
#include <google/protobuf/stubs/common.h>
#include <google/protobuf/io/zero_copy_stream.h>
#include <google/protobuf/io/zero_copy_stream_impl_lite.h>
diff --git a/src/google/protobuf/io/zero_copy_stream_impl_lite.h b/src/google/protobuf/io/zero_copy_stream_impl_lite.h
index ebb2017..b8f387f 100644
--- a/src/google/protobuf/io/zero_copy_stream_impl_lite.h
+++ b/src/google/protobuf/io/zero_copy_stream_impl_lite.h
@@ -47,6 +47,7 @@
#include <iosfwd>
#include <memory>
#include <string>
+
#include <google/protobuf/stubs/callback.h>
#include <google/protobuf/stubs/common.h>
#include <google/protobuf/io/zero_copy_stream.h>
diff --git a/src/google/protobuf/io/zero_copy_stream_unittest.cc b/src/google/protobuf/io/zero_copy_stream_unittest.cc
index 5f7b610..bec9df0 100644
--- a/src/google/protobuf/io/zero_copy_stream_unittest.cc
+++ b/src/google/protobuf/io/zero_copy_stream_unittest.cc
@@ -55,13 +55,14 @@
#include <stdlib.h>
#include <sys/stat.h>
#include <sys/types.h>
+
#include <memory>
#include <sstream>
#include <google/protobuf/testing/file.h>
#include <google/protobuf/test_util2.h>
-#include <google/protobuf/io/io_win32.h>
#include <google/protobuf/io/coded_stream.h>
+#include <google/protobuf/io/io_win32.h>
#include <google/protobuf/io/zero_copy_stream_impl.h>
#if HAVE_ZLIB
diff --git a/src/google/protobuf/map_type_handler.h b/src/google/protobuf/map_type_handler.h
index b633969..71ab641 100644
--- a/src/google/protobuf/map_type_handler.h
+++ b/src/google/protobuf/map_type_handler.h
@@ -446,47 +446,33 @@
}
inline const char* ReadINT64(const char* ptr, int64* value) {
- return ParseVarint64(ptr, reinterpret_cast<uint64*>(value));
+ return VarintParse(ptr, reinterpret_cast<uint64*>(value));
}
inline const char* ReadUINT64(const char* ptr, uint64* value) {
- return ParseVarint64(ptr, value);
+ return VarintParse(ptr, value);
}
inline const char* ReadINT32(const char* ptr, int32* value) {
- uint64 tmp;
- auto res = ParseVarint64(ptr, &tmp);
- *value = static_cast<uint32>(tmp);
- return res;
+ return VarintParse(ptr, reinterpret_cast<uint32*>(value));
}
inline const char* ReadUINT32(const char* ptr, uint32* value) {
- uint64 tmp;
- auto res = ParseVarint64(ptr, &tmp);
- *value = static_cast<uint32>(tmp);
- return res;
+ return VarintParse(ptr, value);
}
inline const char* ReadSINT64(const char* ptr, int64* value) {
- uint64 tmp;
- auto res = ParseVarint64(ptr, &tmp);
- *value = WireFormatLite::ZigZagDecode64(tmp);
- return res;
+ *value = ReadVarintZigZag64(&ptr);
+ return ptr;
}
inline const char* ReadSINT32(const char* ptr, int32* value) {
- uint64 tmp;
- auto res = ParseVarint64(ptr, &tmp);
- *value = WireFormatLite::ZigZagDecode32(static_cast<uint32>(tmp));
- return res;
+ *value = ReadVarintZigZag32(&ptr);
+ return ptr;
}
template <typename E>
inline const char* ReadENUM(const char* ptr, E* value) {
- uint64 tmp;
- auto res = ParseVarint64(ptr, &tmp);
- *value = static_cast<E>(tmp);
- return res;
+ *value = static_cast<E>(ReadVarint(&ptr));
+ return ptr;
}
inline const char* ReadBOOL(const char* ptr, bool* value) {
- uint64 tmp;
- auto res = ParseVarint64(ptr, &tmp);
- *value = static_cast<bool>(tmp);
- return res;
+ *value = static_cast<bool>(ReadVarint(&ptr));
+ return ptr;
}
template <typename F>
diff --git a/src/google/protobuf/message.cc b/src/google/protobuf/message.cc
index ab7f5a2..af1c749 100644
--- a/src/google/protobuf/message.cc
+++ b/src/google/protobuf/message.cc
@@ -56,7 +56,6 @@
#include <google/protobuf/wire_format.h>
#include <google/protobuf/wire_format_lite.h>
#include <google/protobuf/stubs/strutil.h>
-
#include <google/protobuf/stubs/map_util.h>
#include <google/protobuf/stubs/stl_util.h>
#include <google/protobuf/stubs/hash.h>
diff --git a/src/google/protobuf/message_lite.cc b/src/google/protobuf/message_lite.cc
index 2babba0..4b51aff 100644
--- a/src/google/protobuf/message_lite.cc
+++ b/src/google/protobuf/message_lite.cc
@@ -51,7 +51,6 @@
#include <google/protobuf/generated_message_table_driven.h>
#include <google/protobuf/generated_message_util.h>
#include <google/protobuf/repeated_field.h>
-
#include <google/protobuf/stubs/strutil.h>
#include <google/protobuf/stubs/stl_util.h>
diff --git a/src/google/protobuf/message_lite.h b/src/google/protobuf/message_lite.h
index 949e200..1da0d11 100644
--- a/src/google/protobuf/message_lite.h
+++ b/src/google/protobuf/message_lite.h
@@ -446,21 +446,6 @@
#endif // GOOGLE_PROTOBUF_ENABLE_EXPERIMENTAL_PARSER
protected:
- // CastToBase allows generated code to cast a RepeatedPtrField<T> to
- // RepeatedPtrFieldBase. We try to restrict access to RepeatedPtrFieldBase
- // because it is an implementation detail that user code should not access
- // directly.
- template <typename T>
- static internal::RepeatedPtrFieldBase* CastToBase(
- RepeatedPtrField<T>* repeated) {
- return repeated;
- }
- template <typename T>
- static const internal::RepeatedPtrFieldBase& CastToBase(
- const RepeatedPtrField<T>& repeated) {
- return repeated;
- }
-
template <typename T>
static T* CreateMaybeMessage(Arena* arena) {
return Arena::CreateMaybeMessage<T>(arena);
diff --git a/src/google/protobuf/message_unittest.inc b/src/google/protobuf/message_unittest.inc
index e92171f..93fcb5e 100644
--- a/src/google/protobuf/message_unittest.inc
+++ b/src/google/protobuf/message_unittest.inc
@@ -50,7 +50,6 @@
#include <google/protobuf/stubs/common.h>
#include <google/protobuf/stubs/logging.h>
#include <google/protobuf/test_util2.h>
-#include <google/protobuf/io/io_win32.h>
#include <google/protobuf/io/coded_stream.h>
#include <google/protobuf/io/zero_copy_stream.h>
#include <google/protobuf/io/zero_copy_stream_impl.h>
@@ -60,6 +59,7 @@
#include <google/protobuf/generated_message_reflection.h>
#include <google/protobuf/testing/googletest.h>
#include <gtest/gtest.h>
+#include <google/protobuf/io/io_win32.h>
namespace google {
diff --git a/src/google/protobuf/parse_context.cc b/src/google/protobuf/parse_context.cc
index d514079..17d6453 100644
--- a/src/google/protobuf/parse_context.cc
+++ b/src/google/protobuf/parse_context.cc
@@ -64,7 +64,7 @@
switch (tag & 7) {
case 0: { // Varint
uint64 val;
- ptr = ParseVarint64(ptr, &val);
+ ptr = VarintParse(ptr, &val);
if (ptr == nullptr) return false;
break;
}
@@ -232,6 +232,19 @@
return ptr;
}
+template <int>
+void byteswap(void* p);
+template <>
+void byteswap<1>(void* p) {}
+template <>
+void byteswap<4>(void* p) {
+ *static_cast<uint32*>(p) = bswap_32(*static_cast<uint32*>(p));
+}
+template <>
+void byteswap<8>(void* p) {
+ *static_cast<uint64*>(p) = bswap_64(*static_cast<uint64*>(p));
+}
+
template <typename T>
const char* EpsCopyInputStream::ReadPackedFixed(const char* ptr, int size,
RepeatedField<T>* out) {
@@ -241,7 +254,13 @@
int old_entries = out->size();
out->Reserve(old_entries + num);
int block_size = num * sizeof(T);
- std::memcpy(out->AddNAlreadyReserved(num), ptr, block_size);
+ auto dst = out->AddNAlreadyReserved(num);
+#ifdef PROTOBUF_LITTLE_ENDIAN
+ std::memcpy(dst, ptr, block_size);
+#else
+ for (int i = 0; i < num; i++)
+ dst[i] = UnalignedLoad<T>(ptr + i * sizeof(T));
+#endif
ptr += block_size;
size -= block_size;
if (DoneWithCheck(&ptr, -1)) return nullptr;
@@ -251,7 +270,12 @@
int old_entries = out->size();
out->Reserve(old_entries + num);
int block_size = num * sizeof(T);
- std::memcpy(out->AddNAlreadyReserved(num), ptr, block_size);
+ auto dst = out->AddNAlreadyReserved(num);
+#ifdef PROTOBUF_LITTLE_ENDIAN
+ std::memcpy(dst, ptr, block_size);
+#else
+ for (int i = 0; i < num; i++) dst[i] = UnalignedLoad<T>(ptr + i * sizeof(T));
+#endif
ptr += block_size;
if (size != block_size) return nullptr;
return ptr;
@@ -316,10 +340,17 @@
s->append(val.data(), val.size());
}
-std::pair<const char*, uint32> ReadTagFallback(const char* p, uint32 res) {
- for (std::uint32_t i = 0; i < 3; i++) {
- std::uint32_t byte = static_cast<uint8>(p[i]);
- res += (byte - 1) << (7 * (i + 2));
+std::pair<const char*, uint32> VarintParseSlow32(const char* p, uint32 res) {
+ for (std::uint32_t i = 2; i < 5; i++) {
+ uint32 byte = static_cast<uint8>(p[i]);
+ res += (byte - 1) << (7 * i);
+ if (PROTOBUF_PREDICT_TRUE(byte < 128)) {
+ return {p + i + 1, res};
+ }
+ }
+ // Accept >5 bytes
+ for (std::uint32_t i = 5; i < 10; i++) {
+ uint32 byte = static_cast<uint8>(p[i]);
if (PROTOBUF_PREDICT_TRUE(byte < 128)) {
return {p + i + 1, res};
}
@@ -327,16 +358,47 @@
return {nullptr, 0};
}
-std::pair<const char*, uint64> ParseVarint64Fallback(const char* p,
- uint64 res) {
- return ParseVarint64FallbackInline(p, res);
+std::pair<const char*, uint64> VarintParseSlow64(const char* p, uint32 res32) {
+ uint64 res = res32;
+ for (std::uint32_t i = 2; i < 10; i++) {
+ uint64 byte = static_cast<uint8>(p[i]);
+ res += (byte - 1) << (7 * i);
+ if (PROTOBUF_PREDICT_TRUE(byte < 128)) {
+ return {p + i + 1, res};
+ }
+ }
+ return {nullptr, 0};
}
-std::pair<const char*, int32> ReadSizeFallback(const char* p, uint32 first) {
- uint32 tmp;
- auto res = VarintParse<4>(p + 1, &tmp);
- if (tmp >= (1 << 24) - ParseContext::kSlopBytes) return {nullptr, 0};
- return {res, (tmp << 7) + first - 0x80};
+std::pair<const char*, uint32> ReadTagFallback(const char* p, uint32 res) {
+ for (std::uint32_t i = 2; i < 5; i++) {
+ uint32 byte = static_cast<uint8>(p[i]);
+ res += (byte - 1) << (7 * i);
+ if (PROTOBUF_PREDICT_TRUE(byte < 128)) {
+ return {p + i + 1, res};
+ }
+ }
+ return {nullptr, 0};
+}
+
+std::pair<const char*, int32> ReadSizeFallback(const char* p, uint32 res) {
+ for (std::uint32_t i = 1; i < 4; i++) {
+ uint32 byte = static_cast<uint8>(p[i]);
+ res += (byte - 1) << (7 * i);
+ if (PROTOBUF_PREDICT_TRUE(byte < 128)) {
+ return {p + i + 1, res};
+ }
+ }
+ std::uint32_t byte = static_cast<uint8>(p[4]);
+ if (PROTOBUF_PREDICT_FALSE(byte >= 8)) return {nullptr, 0}; // size >= 2gb
+ res += (byte - 1) << 28;
+ // Protect against sign integer overflow in PushLimit. Limits are relative
+ // to buffer ends and ptr could potential be kSlopBytes beyond a buffer end.
+ // To protect against overflow we reject limits absurdly close to INT_MAX.
+ if (PROTOBUF_PREDICT_FALSE(res > INT_MAX - ParseContext::kSlopBytes)) {
+ return {nullptr, 0};
+ }
+ return {p + 5, res};
}
const char* StringParser(const char* begin, const char* end, void* object,
@@ -501,7 +563,8 @@
if (unknown_ == nullptr) return;
WriteVarint(num * 8 + 1, unknown_);
char buffer[8];
- std::memcpy(buffer, &value, 8);
+ io::CodedOutputStream::WriteLittleEndian64ToArray(
+ value, reinterpret_cast<uint8*>(buffer));
unknown_->append(buffer, 8);
}
const char* ParseLengthDelimited(uint32 num, const char* ptr,
@@ -524,7 +587,8 @@
if (unknown_ == nullptr) return;
WriteVarint(num * 8 + 5, unknown_);
char buffer[4];
- std::memcpy(buffer, &value, 4);
+ io::CodedOutputStream::WriteLittleEndian32ToArray(
+ value, reinterpret_cast<uint8*>(buffer));
unknown_->append(buffer, 4);
}
diff --git a/src/google/protobuf/parse_context.h b/src/google/protobuf/parse_context.h
index 72355f8..bc7a0ad 100644
--- a/src/google/protobuf/parse_context.h
+++ b/src/google/protobuf/parse_context.h
@@ -124,7 +124,9 @@
// If return value is negative it's an error
PROTOBUF_MUST_USE_RESULT int PushLimit(const char* ptr, int limit) {
- GOOGLE_DCHECK(limit >= 0);
+ GOOGLE_DCHECK(limit >= 0 && limit <= INT_MAX - kSlopBytes);
+ // This add is safe due to the invariant above, because
+ // ptr - buffer_end_ <= kSlopBytes.
limit += static_cast<int>(ptr - buffer_end_);
limit_end_ = buffer_end_ + (std::min)(0, limit);
auto old_limit = limit_;
@@ -343,8 +345,7 @@
const Data& data() const { return data_; }
template <typename T>
- PROTOBUF_MUST_USE_RESULT PROTOBUF_ALWAYS_INLINE const char* ParseMessage(
- T* msg, const char* ptr);
+ PROTOBUF_MUST_USE_RESULT const char* ParseMessage(T* msg, const char* ptr);
// We outline when the type is generic and we go through a virtual
const char* ParseMessage(MessageLite* msg, const char* ptr);
const char* ParseMessage(Message* msg, const char* ptr);
@@ -374,32 +375,122 @@
Data data_;
};
+template <uint32 tag>
+bool ExpectTag(const char* ptr) {
+ if (tag < 128) {
+ return *ptr == tag;
+ } else {
+ static_assert(tag < 128 * 128, "We only expect tags for 1 or 2 bytes");
+ char buf[2] = {static_cast<char>(tag | 0x80), static_cast<char>(tag >> 7)};
+ return std::memcmp(ptr, buf, 2) == 0;
+ }
+}
+
+template <int>
+struct EndianHelper;
+
+template <>
+struct EndianHelper<1> {
+ static uint8 Load(const void* p) { return *static_cast<const uint8*>(p); }
+};
+
+template <>
+struct EndianHelper<2> {
+ static uint16 Load(const void* p) {
+ uint16 tmp;
+ std::memcpy(&tmp, p, 2);
+#ifndef PROTOBUF_LITTLE_ENDIAN
+ tmp = bswap_16(tmp);
+#endif
+ return tmp;
+ }
+};
+
+template <>
+struct EndianHelper<4> {
+ static uint32 Load(const void* p) {
+ uint32 tmp;
+ std::memcpy(&tmp, p, 4);
+#ifndef PROTOBUF_LITTLE_ENDIAN
+ tmp = bswap_32(tmp);
+#endif
+ return tmp;
+ }
+};
+
+template <>
+struct EndianHelper<8> {
+ static uint64 Load(const void* p) {
+ uint64 tmp;
+ std::memcpy(&tmp, p, 8);
+#ifndef PROTOBUF_LITTLE_ENDIAN
+ tmp = bswap_64(tmp);
+#endif
+ return tmp;
+ }
+};
+
template <typename T>
-T UnalignedLoad(const void* p) {
+T UnalignedLoad(const char* p) {
+ auto tmp = EndianHelper<sizeof(T)>::Load(p);
T res;
- memcpy(&res, p, sizeof(T));
+ memcpy(&res, &tmp, sizeof(T));
return res;
}
-// TODO(gerbens) Experiment with best implementation.
-// Clang unrolls loop and generating pretty good code on O2, gcc doesn't.
-// Unclear if we want 64 bit parse loop unrolled, inlined or opaque function
-// call. Hence experimentation is needed.
-// Important guarantee is that it doesn't read more than size bytes from p.
-template <int size, typename T>
+std::pair<const char*, uint32> VarintParseSlow32(const char* p, uint32 res);
+std::pair<const char*, uint64> VarintParseSlow64(const char* p, uint32 res);
+
+inline const char* VarintParseSlow(const char* p, uint32 res, uint32* out) {
+ auto tmp = VarintParseSlow32(p, res);
+ *out = tmp.second;
+ return tmp.first;
+}
+
+inline const char* VarintParseSlow(const char* p, uint32 res, uint64* out) {
+ auto tmp = VarintParseSlow64(p, res);
+ *out = tmp.second;
+ return tmp.first;
+}
+
+template <typename T>
PROTOBUF_MUST_USE_RESULT const char* VarintParse(const char* p, T* out) {
- T res = 1;
- for (int i = 0; i < size; i++) {
- T byte = static_cast<uint8>(p[i]);
- res += (byte - 1) << (i * 7);
- int j = i + 1;
- if (PROTOBUF_PREDICT_TRUE(byte < 128)) {
- *out = res;
- return p + j;
- }
+ auto ptr = reinterpret_cast<const uint8*>(p);
+ uint32 res = ptr[0];
+ if (!(res & 0x80)) {
+ *out = res;
+ return p + 1;
}
- *out = 0;
- return nullptr;
+ uint32 byte = ptr[1];
+ res += (byte - 1) << 7;
+ if (!(byte & 0x80)) {
+ *out = res;
+ return p + 2;
+ }
+ return VarintParseSlow(p, res, out);
+}
+
+// Used for tags, could read up to 5 bytes which must be available.
+// Caller must ensure its safe to call.
+
+std::pair<const char*, uint32> ReadTagFallback(const char* p, uint32 res);
+
+// Same as ParseVarint but only accept 5 bytes at most.
+inline const char* ReadTag(const char* p, uint32* out, uint32 max_tag = 0) {
+ uint32 res = static_cast<uint8>(p[0]);
+ if (res < 128) {
+ *out = res;
+ return p + 1;
+ }
+ uint32 second = static_cast<uint8>(p[1]);
+ res += (second - 1) << 7;
+ if (second < 128) {
+ *out = res;
+ return p + 2;
+ }
+ auto tmp = ReadTagFallback(p, res);
+ *out = tmp.second;
+ return tmp.first;
}
// Decode 2 consecutive bytes of a varint and returns the value, shifted left
@@ -412,7 +503,8 @@
// adc [rsi], 1
// add eax, eax
// and eax, edi
-inline uint32 DecodeTwoBytes(uint32 value, const char** ptr) {
+inline uint32 DecodeTwoBytes(const char** ptr) {
+ uint32 value = UnalignedLoad<uint16>(*ptr);
// Sign extend the low byte continuation bit
uint32_t x = static_cast<int8_t>(value);
// This add is an amazing operation, it cancels the low byte continuation bit
@@ -425,90 +517,25 @@
return value & (x + x); // Mask out the high byte iff no continuation
}
-// Used for tags, could read up to 5 bytes which must be available.
-// Caller must ensure its safe to call.
-
-std::pair<const char*, uint32> ReadTagFallback(const char* p, uint32 res);
-
-inline const char* ReadTag(const char* p, uint32* out) {
- uint32 res = static_cast<uint8>(p[0]);
- if (res < 128) {
+// More efficient varint parsing for big varints
+inline const char* ParseBigVarint(const char* p, uint64* out) {
+ auto pnew = p;
+ auto tmp = DecodeTwoBytes(&pnew);
+ uint64 res = tmp >> 1;
+ if (PROTOBUF_PREDICT_TRUE(std::int16_t(tmp) >= 0)) {
*out = res;
- return p + 1;
+ return pnew;
}
- uint32 second = static_cast<uint8>(p[1]);
- res += (second - 1) << 7;
- if (second < 128) {
- *out = res;
- return p + 2;
- }
- auto tmp = ReadTagFallback(p + 2, res);
- *out = tmp.second;
- return tmp.first;
-}
-
-// Will preload the next 2 bytes
-inline const char* ReadTag(const char* p, uint32* out, uint32* preload) {
- uint32 res = static_cast<uint8>(p[0]);
- if (res < 128) {
- *out = res;
- *preload = UnalignedLoad<uint16>(p + 1);
- return p + 1;
- }
- uint32 second = static_cast<uint8>(p[1]);
- res += (second - 1) << 7;
- if (second < 128) {
- *out = res;
- *preload = UnalignedLoad<uint16>(p + 2);
- return p + 2;
- }
- auto tmp = ReadTagFallback(p + 2, res);
- *out = tmp.second;
- return tmp.first;
-}
-
-inline std::pair<const char*, uint64> ParseVarint64FallbackInline(const char* p,
- uint64 res) {
- res >>= 1;
- for (std::uint32_t i = 0; i < 4; i++) {
- auto pnew = p + 2 * i;
- auto tmp = DecodeTwoBytes(UnalignedLoad<uint16>(pnew), &pnew);
- res += (static_cast<std::uint64_t>(tmp) - 2) << (14 * (i + 1) - 1);
+ for (std::uint32_t i = 1; i < 5; i++) {
+ pnew = p + 2 * i;
+ tmp = DecodeTwoBytes(&pnew);
+ res += (static_cast<std::uint64_t>(tmp) - 2) << (14 * i - 1);
if (PROTOBUF_PREDICT_TRUE(std::int16_t(tmp) >= 0)) {
- return {pnew, res};
+ *out = res;
+ return pnew;
}
}
- return {nullptr, res};
-}
-
-inline const char* ParseVarint64Inline(const char* p, uint64* out) {
- auto tmp = DecodeTwoBytes(UnalignedLoad<uint16>(p), &p);
- if (PROTOBUF_PREDICT_TRUE(static_cast<int16>(tmp) >= 0)) {
- *out = tmp >> 1;
- return p;
- }
- auto x = ParseVarint64FallbackInline(p, tmp);
- *out = x.second;
- return x.first;
-}
-
-std::pair<const char*, uint64> ParseVarint64Fallback(const char* p, uint64 res);
-
-inline const char* ParseVarint64(const char* p, uint32 preload, uint64* out) {
- auto tmp = DecodeTwoBytes(preload, &p);
- if (PROTOBUF_PREDICT_TRUE(static_cast<int16>(tmp) >= 0)) {
- *out = tmp >> 1;
- return p;
- }
- auto x = ParseVarint64Fallback(p, tmp);
- *out = x.second;
- return x.first;
-}
-
-// Used for reading varint wiretype values, could read up to 10 bytes.
-// Caller must ensure its safe to call.
-inline const char* ParseVarint64(const char* p, uint64* out) {
- return ParseVarint64(p, UnalignedLoad<uint16>(p), out);
+ return nullptr;
}
std::pair<const char*, int32> ReadSizeFallback(const char* p, uint32 first);
@@ -534,37 +561,19 @@
// stack frames that scale as O(num fields).
inline uint64 ReadVarint(const char** p) {
uint64 tmp;
- *p = ParseVarint64(*p, &tmp);
+ *p = VarintParse(*p, &tmp);
return tmp;
}
inline int64 ReadVarintZigZag64(const char** p) {
uint64 tmp;
- *p = ParseVarint64(*p, &tmp);
+ *p = VarintParse(*p, &tmp);
return WireFormatLite::ZigZagDecode64(tmp);
}
inline int32 ReadVarintZigZag32(const char** p) {
uint64 tmp;
- *p = ParseVarint64(*p, &tmp);
- return WireFormatLite::ZigZagDecode32(static_cast<uint32>(tmp));
-}
-
-inline uint64 ReadVarint(const char** p, uint32 preload) {
- uint64 tmp;
- *p = ParseVarint64(*p, preload, &tmp);
- return tmp;
-}
-
-inline int64 ReadVarintZigZag64(const char** p, uint32 preload) {
- uint64 tmp;
- *p = ParseVarint64(*p, preload, &tmp);
- return WireFormatLite::ZigZagDecode64(tmp);
-}
-
-inline int32 ReadVarintZigZag32(const char** p, uint32 preload) {
- uint64 tmp;
- *p = ParseVarint64(*p, preload, &tmp);
+ *p = VarintParse(*p, &tmp);
return WireFormatLite::ZigZagDecode32(static_cast<uint32>(tmp));
}
@@ -590,7 +599,7 @@
if (old < 0) return nullptr;
while (!DoneWithCheck(&ptr, -1)) {
uint64 varint;
- ptr = ParseVarint64(ptr, &varint);
+ ptr = VarintParse(ptr, &varint);
if (!ptr) return nullptr;
add(varint);
}
@@ -643,7 +652,7 @@
switch (tag & 7) {
case WireType::WIRETYPE_VARINT: {
uint64 value;
- ptr = ParseVarint64(ptr, &value);
+ ptr = VarintParse(ptr, &value);
GOOGLE_PROTOBUF_PARSER_ASSERT(ptr);
field_parser.AddVarint(number, value);
break;
diff --git a/src/google/protobuf/port_def.inc b/src/google/protobuf/port_def.inc
index 17ab7ed..7b754dd 100644
--- a/src/google/protobuf/port_def.inc
+++ b/src/google/protobuf/port_def.inc
@@ -160,10 +160,11 @@
#ifdef GOOGLE_ATTRIBUTE_ALWAYS_INLINE
#define PROTOBUF_ALWAYS_INLINE GOOGLE_ATTRIBUTE_ALWAYS_INLINE
#else
-#if defined(__GNUC__) && (__GNUC__ > 3 ||(__GNUC__ == 3 && __GNUC_MINOR__ >= 1))
+#if defined(__GNUC__) && \
+ (__GNUC__ > 3 || (__GNUC__ == 3 && __GNUC_MINOR__ >= 1))
// For functions we want to force inline.
// Introduced in gcc 3.1.
-#define PROTOBUF_ALWAYS_INLINE __attribute__ ((always_inline))
+#define PROTOBUF_ALWAYS_INLINE __attribute__((always_inline))
#else
// Other compilers will have to figure it out for themselves.
#define PROTOBUF_ALWAYS_INLINE
@@ -173,10 +174,11 @@
#ifdef GOOGLE_ATTRIBUTE_NOINLINE
#define PROTOBUF_NOINLINE GOOGLE_ATTRIBUTE_NOINLINE
#else
-#if defined(__GNUC__) && (__GNUC__ > 3 ||(__GNUC__ == 3 && __GNUC_MINOR__ >= 1))
+#if defined(__GNUC__) && \
+ (__GNUC__ > 3 || (__GNUC__ == 3 && __GNUC_MINOR__ >= 1))
// For functions we want to force not inline.
// Introduced in gcc 3.1.
-#define PROTOBUF_NOINLINE __attribute__ ((noinline))
+#define PROTOBUF_NOINLINE __attribute__((noinline))
#elif defined(_MSC_VER) && (_MSC_VER >= 1400)
// Seems to have been around since at least Visual Studio 2005
#define PROTOBUF_NOINLINE __declspec(noinline)
@@ -190,9 +192,10 @@
#define PROTOBUF_FUNC_ALIGN GOOGLE_ATTRIBUTE_FUNC_ALIGN
#else
#if defined(__clang__) || \
- defined(__GNUC__) && (__GNUC__ > 4 ||(__GNUC__ == 4 && __GNUC_MINOR__ >= 3))
+ defined(__GNUC__) && \
+ (__GNUC__ > 4 || (__GNUC__ == 4 && __GNUC_MINOR__ >= 3))
// Function alignment attribute introduced in gcc 4.3
-#define PROTOBUF_FUNC_ALIGN(bytes) __attribute__ ((aligned(bytes)))
+#define PROTOBUF_FUNC_ALIGN(bytes) __attribute__((aligned(bytes)))
#else
#define PROTOBUF_FUNC_ALIGN(bytes)
#endif
@@ -312,10 +315,10 @@
// For Clang we use __builtin_offsetof() and suppress the warning,
// to avoid Control Flow Integrity and UBSan vptr sanitizers from
// crashing while trying to validate the invalid reinterpet_casts.
-#define PROTOBUF_FIELD_OFFSET(TYPE, FIELD) \
- _Pragma("clang diagnostic push") \
- _Pragma("clang diagnostic ignored \"-Winvalid-offsetof\"") \
- __builtin_offsetof(TYPE, FIELD) \
+#define PROTOBUF_FIELD_OFFSET(TYPE, FIELD) \
+ _Pragma("clang diagnostic push") \
+ _Pragma("clang diagnostic ignored \"-Winvalid-offsetof\"") \
+ __builtin_offsetof(TYPE, FIELD) \
_Pragma("clang diagnostic pop")
#else
// Note that we calculate relative to the pointer value 16 here since if we
@@ -328,7 +331,6 @@
reinterpret_cast<const char*>(16))
#endif
-
#if defined(_MSC_VER) && defined(PROTOBUF_USE_DLLS)
#ifdef LIBPROTOBUF_EXPORTS
#define PROTOBUF_EXPORT __declspec(dllexport)
diff --git a/src/google/protobuf/reflection_ops.cc b/src/google/protobuf/reflection_ops.cc
index 3ced141..f2852f8 100644
--- a/src/google/protobuf/reflection_ops.cc
+++ b/src/google/protobuf/reflection_ops.cc
@@ -45,7 +45,6 @@
#include <google/protobuf/unknown_field_set.h>
#include <google/protobuf/stubs/strutil.h>
-
#include <google/protobuf/port_def.inc>
namespace google {
diff --git a/src/google/protobuf/repeated_field.cc b/src/google/protobuf/repeated_field.cc
index e5dbe02..bac3550 100644
--- a/src/google/protobuf/repeated_field.cc
+++ b/src/google/protobuf/repeated_field.cc
@@ -32,11 +32,13 @@
// Based on original Protocol Buffers design by
// Sanjay Ghemawat, Jeff Dean, and others.
+#include <google/protobuf/repeated_field.h>
+
#include <algorithm>
#include <google/protobuf/stubs/logging.h>
#include <google/protobuf/stubs/common.h>
-#include <google/protobuf/repeated_field.h>
+#include <google/protobuf/implicit_weak_message.h>
#include <google/protobuf/port_def.inc>
diff --git a/src/google/protobuf/repeated_field.h b/src/google/protobuf/repeated_field.h
index 47c9987..fb8301b 100644
--- a/src/google/protobuf/repeated_field.h
+++ b/src/google/protobuf/repeated_field.h
@@ -56,10 +56,10 @@
#include <limits>
#include <string>
#include <type_traits>
+
#include <google/protobuf/stubs/logging.h>
#include <google/protobuf/stubs/common.h>
#include <google/protobuf/arena.h>
-#include <google/protobuf/implicit_weak_message.h>
#include <google/protobuf/message_lite.h>
#include <google/protobuf/port.h>
#include <google/protobuf/stubs/casts.h>
@@ -72,19 +72,15 @@
#error "You cannot SWIG proto headers"
#endif
-// Forward-declare these so that we can make them friends.
-namespace upb {
-namespace google_opensource {
-class GMR_Handlers;
-} // namespace google_opensource
-} // namespace upb
-
namespace google {
namespace protobuf {
class Message;
class Reflection;
+template <typename T>
+struct WeakRepeatedPtrField;
+
namespace internal {
class MergePartialFromCodedStreamHelper;
@@ -323,7 +319,6 @@
friend class Arena;
typedef void InternalArenaConstructable_;
-
// Move the contents of |from| into |to|, possibly clobbering |from| in the
// process. For primitive types this is just a memcpy(), but it could be
// specialized for non-primitive types to, say, swap each element instead.
@@ -443,11 +438,8 @@
// class TypeHandler {
// public:
// typedef MyType Type;
-// // WeakType is almost always the same as MyType, but we use it in
-// // ImplicitWeakTypeHandler.
-// typedef MyType WeakType;
// static Type* New();
-// static WeakType* NewFromPrototype(const WeakType* prototype,
+// static Type* NewFromPrototype(const Type* prototype,
// Arena* arena);
// static void Delete(Type*);
// static void Clear(Type*);
@@ -460,12 +452,20 @@
protected:
RepeatedPtrFieldBase();
explicit RepeatedPtrFieldBase(Arena* arena);
- ~RepeatedPtrFieldBase() {}
+ ~RepeatedPtrFieldBase() {
+#ifndef NDEBUG
+ // Try to trigger segfault / asan failure in non-opt builds. If arena_
+ // lifetime has ended before the destructor.
+ if (arena_) (void)arena_->SpaceAllocated();
+#endif
+ }
+ public:
// Must be called from destructor.
template <typename TypeHandler>
void Destroy();
+ protected:
bool empty() const;
int size() const;
@@ -487,7 +487,7 @@
// application code.
template <typename TypeHandler>
- const typename TypeHandler::WeakType& Get(int index) const;
+ const typename TypeHandler::Type& Get(int index) const;
// Creates and adds an element using the given prototype, without introducing
// a link-time dependency on the concrete message type. This method is used to
@@ -662,12 +662,9 @@
// The table-driven MergePartialFromCodedStream implementation needs to
// operate on RepeatedPtrField<MessageLite>.
friend class MergePartialFromCodedStreamHelper;
-
- // To parse directly into a proto2 generated class, the upb class GMR_Handlers
- // needs to be able to modify a RepeatedPtrFieldBase directly.
- friend class upb::google_opensource::GMR_Handlers;
-
friend class AccessorHelper;
+ template <typename T>
+ friend struct google::protobuf::WeakRepeatedPtrField;
GOOGLE_DISALLOW_EVIL_CONSTRUCTORS(RepeatedPtrFieldBase);
};
@@ -676,7 +673,6 @@
class GenericTypeHandler {
public:
typedef GenericType Type;
- typedef GenericType WeakType;
using Movable = IsMovable<GenericType>;
static inline GenericType* New(Arena* arena) {
@@ -744,31 +740,21 @@
void GenericTypeHandler<std::string>::Merge(const std::string& from,
std::string* to);
-// Declarations of the specialization as we cannot define them here, as the
-// header that defines ProtocolMessage depends on types defined in this header.
-#define DECLARE_SPECIALIZATIONS_FOR_BASE_PROTO_TYPES(TypeName) \
- template <> \
- PROTOBUF_EXPORT TypeName* GenericTypeHandler<TypeName>::NewFromPrototype( \
- const TypeName* prototype, Arena* arena); \
- template <> \
- PROTOBUF_EXPORT Arena* GenericTypeHandler<TypeName>::GetArena( \
- TypeName* value); \
- template <> \
- PROTOBUF_EXPORT void* GenericTypeHandler<TypeName>::GetMaybeArenaPointer( \
- TypeName* value);
-
// Message specialization bodies defined in message.cc. This split is necessary
// to allow proto2-lite (which includes this header) to be independent of
// Message.
-DECLARE_SPECIALIZATIONS_FOR_BASE_PROTO_TYPES(Message)
-
-
-#undef DECLARE_SPECIALIZATIONS_FOR_BASE_PROTO_TYPES
+template <>
+PROTOBUF_EXPORT Message* GenericTypeHandler<Message>::NewFromPrototype(
+ const Message* prototype, Arena* arena);
+template <>
+PROTOBUF_EXPORT Arena* GenericTypeHandler<Message>::GetArena(Message* value);
+template <>
+PROTOBUF_EXPORT void* GenericTypeHandler<Message>::GetMaybeArenaPointer(
+ Message* value);
class StringTypeHandler {
public:
typedef std::string Type;
- typedef std::string WeakType;
using Movable = IsMovable<Type>;
static inline std::string* New(Arena* arena) {
@@ -1037,7 +1023,9 @@
// For internal use only.
//
// This is public due to it being called by generated code.
- using RepeatedPtrFieldBase::InternalSwap;
+ void InternalSwap(RepeatedPtrField* other) {
+ internal::RepeatedPtrFieldBase::InternalSwap(other);
+ }
private:
// Note: RepeatedPtrField SHOULD NOT be subclassed by users.
@@ -1056,7 +1044,9 @@
std::false_type);
friend class Arena;
- friend class MessageLite;
+
+ template <typename T>
+ friend struct WeakRepeatedPtrField;
typedef void InternalArenaConstructable_;
@@ -1543,7 +1533,7 @@
inline int RepeatedPtrFieldBase::size() const { return current_size_; }
template <typename TypeHandler>
-inline const typename TypeHandler::WeakType& RepeatedPtrFieldBase::Get(
+inline const typename TypeHandler::Type& RepeatedPtrFieldBase::Get(
int index) const {
GOOGLE_DCHECK_GE(index, 0);
GOOGLE_DCHECK_LT(index, current_size_);
@@ -1670,18 +1660,18 @@
// to avoid a branch within the loop.
for (int i = 0; i < already_allocated && i < length; i++) {
// Already allocated: use existing element.
- typename TypeHandler::WeakType* other_elem =
- reinterpret_cast<typename TypeHandler::WeakType*>(other_elems[i]);
- typename TypeHandler::WeakType* new_elem =
- reinterpret_cast<typename TypeHandler::WeakType*>(our_elems[i]);
+ typename TypeHandler::Type* other_elem =
+ reinterpret_cast<typename TypeHandler::Type*>(other_elems[i]);
+ typename TypeHandler::Type* new_elem =
+ reinterpret_cast<typename TypeHandler::Type*>(our_elems[i]);
TypeHandler::Merge(*other_elem, new_elem);
}
Arena* arena = GetArenaNoVirtual();
for (int i = already_allocated; i < length; i++) {
// Not allocated: alloc a new element first, then merge it.
- typename TypeHandler::WeakType* other_elem =
- reinterpret_cast<typename TypeHandler::WeakType*>(other_elems[i]);
- typename TypeHandler::WeakType* new_elem =
+ typename TypeHandler::Type* other_elem =
+ reinterpret_cast<typename TypeHandler::Type*>(other_elems[i]);
+ typename TypeHandler::Type* new_elem =
TypeHandler::NewFromPrototype(other_elem, arena);
TypeHandler::Merge(*other_elem, new_elem);
our_elems[i] = new_elem;
diff --git a/src/google/protobuf/repeated_field_unittest.cc b/src/google/protobuf/repeated_field_unittest.cc
index dd79d42..ca5452b 100644
--- a/src/google/protobuf/repeated_field_unittest.cc
+++ b/src/google/protobuf/repeated_field_unittest.cc
@@ -51,7 +51,6 @@
#include <gmock/gmock.h>
#include <google/protobuf/testing/googletest.h>
#include <gtest/gtest.h>
-
#include <google/protobuf/stubs/stl_util.h>
namespace google {
diff --git a/src/google/protobuf/source_context.pb.cc b/src/google/protobuf/source_context.pb.cc
index 877814b..6dea4e8 100644
--- a/src/google/protobuf/source_context.pb.cc
+++ b/src/google/protobuf/source_context.pb.cc
@@ -32,7 +32,7 @@
}
PROTOBUF_EXPORT ::PROTOBUF_NAMESPACE_ID::internal::SCCInfo<0> scc_info_SourceContext_google_2fprotobuf_2fsource_5fcontext_2eproto =
- {{ATOMIC_VAR_INIT(::PROTOBUF_NAMESPACE_ID::internal::SCCInfoBase::kUninitialized), 0, InitDefaultsscc_info_SourceContext_google_2fprotobuf_2fsource_5fcontext_2eproto}, {}};
+ {{ATOMIC_VAR_INIT(::PROTOBUF_NAMESPACE_ID::internal::SCCInfoBase::kUninitialized), 0, 0, InitDefaultsscc_info_SourceContext_google_2fprotobuf_2fsource_5fcontext_2eproto}, {}};
static ::PROTOBUF_NAMESPACE_ID::Metadata file_level_metadata_google_2fprotobuf_2fsource_5fcontext_2eproto[1];
static constexpr ::PROTOBUF_NAMESPACE_ID::EnumDescriptor const** file_level_enum_descriptors_google_2fprotobuf_2fsource_5fcontext_2eproto = nullptr;
@@ -99,7 +99,7 @@
_internal_metadata_(nullptr) {
_internal_metadata_.MergeFrom(from._internal_metadata_);
file_name_.UnsafeSetDefault(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited());
- if (!from.file_name().empty()) {
+ if (!from._internal_file_name().empty()) {
file_name_.AssignWithDefault(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(), from.file_name_);
}
// @@protoc_insertion_point(copy_constructor:google.protobuf.SourceContext)
@@ -149,7 +149,7 @@
// string file_name = 1;
case 1:
if (PROTOBUF_PREDICT_TRUE(static_cast<::PROTOBUF_NAMESPACE_ID::uint8>(tag) == 10)) {
- ptr = ::PROTOBUF_NAMESPACE_ID::internal::InlineGreedyStringParserUTF8(mutable_file_name(), ptr, ctx, "google.protobuf.SourceContext.file_name");
+ ptr = ::PROTOBUF_NAMESPACE_ID::internal::InlineGreedyStringParserUTF8(_internal_mutable_file_name(), ptr, ctx, "google.protobuf.SourceContext.file_name");
CHK_(ptr);
} else goto handle_unusual;
continue;
@@ -187,9 +187,9 @@
case 1: {
if (static_cast< ::PROTOBUF_NAMESPACE_ID::uint8>(tag) == (10 & 0xFF)) {
DO_(::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::ReadString(
- input, this->mutable_file_name()));
+ input, this->_internal_mutable_file_name()));
DO_(::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::VerifyUtf8String(
- this->file_name().data(), static_cast<int>(this->file_name().length()),
+ this->_internal_file_name().data(), static_cast<int>(this->_internal_file_name().length()),
::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::PARSE,
"google.protobuf.SourceContext.file_name"));
} else {
@@ -228,11 +228,11 @@
// string file_name = 1;
if (this->file_name().size() > 0) {
::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::VerifyUtf8String(
- this->file_name().data(), static_cast<int>(this->file_name().length()),
+ this->_internal_file_name().data(), static_cast<int>(this->_internal_file_name().length()),
::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::SERIALIZE,
"google.protobuf.SourceContext.file_name");
target = stream->WriteStringMaybeAliased(
- 1, this->file_name(), target);
+ 1, this->_internal_file_name(), target);
}
if (PROTOBUF_PREDICT_FALSE(_internal_metadata_.have_unknown_fields())) {
@@ -255,7 +255,7 @@
if (this->file_name().size() > 0) {
total_size += 1 +
::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::StringSize(
- this->file_name());
+ this->_internal_file_name());
}
if (PROTOBUF_PREDICT_FALSE(_internal_metadata_.have_unknown_fields())) {
diff --git a/src/google/protobuf/source_context.pb.h b/src/google/protobuf/source_context.pb.h
index 13c4e07..27a1a4a 100644
--- a/src/google/protobuf/source_context.pb.h
+++ b/src/google/protobuf/source_context.pb.h
@@ -189,6 +189,11 @@
std::string* mutable_file_name();
std::string* release_file_name();
void set_allocated_file_name(std::string* file_name);
+ private:
+ const std::string& _internal_file_name() const;
+ void _internal_set_file_name(const std::string& value);
+ std::string* _internal_mutable_file_name();
+ public:
// @@protoc_insertion_point(class_scope:google.protobuf.SourceContext)
private:
@@ -216,12 +221,22 @@
}
inline const std::string& SourceContext::file_name() const {
// @@protoc_insertion_point(field_get:google.protobuf.SourceContext.file_name)
- return file_name_.GetNoArena();
+ return _internal_file_name();
}
inline void SourceContext::set_file_name(const std::string& value) {
+ _internal_set_file_name(value);
+ // @@protoc_insertion_point(field_set:google.protobuf.SourceContext.file_name)
+}
+inline std::string* SourceContext::mutable_file_name() {
+ // @@protoc_insertion_point(field_mutable:google.protobuf.SourceContext.file_name)
+ return _internal_mutable_file_name();
+}
+inline const std::string& SourceContext::_internal_file_name() const {
+ return file_name_.GetNoArena();
+}
+inline void SourceContext::_internal_set_file_name(const std::string& value) {
file_name_.SetNoArena(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(), value);
- // @@protoc_insertion_point(field_set:google.protobuf.SourceContext.file_name)
}
inline void SourceContext::set_file_name(std::string&& value) {
@@ -241,9 +256,8 @@
::std::string(reinterpret_cast<const char*>(value), size));
// @@protoc_insertion_point(field_set_pointer:google.protobuf.SourceContext.file_name)
}
-inline std::string* SourceContext::mutable_file_name() {
+inline std::string* SourceContext::_internal_mutable_file_name() {
- // @@protoc_insertion_point(field_mutable:google.protobuf.SourceContext.file_name)
return file_name_.MutableNoArena(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited());
}
inline std::string* SourceContext::release_file_name() {
diff --git a/src/google/protobuf/struct.pb.cc b/src/google/protobuf/struct.pb.cc
index 2f9876f..cd49d6d 100644
--- a/src/google/protobuf/struct.pb.cc
+++ b/src/google/protobuf/struct.pb.cc
@@ -68,7 +68,7 @@
}
PROTOBUF_EXPORT ::PROTOBUF_NAMESPACE_ID::internal::SCCInfo<0> scc_info_ListValue_google_2fprotobuf_2fstruct_2eproto =
- {{ATOMIC_VAR_INIT(::PROTOBUF_NAMESPACE_ID::internal::SCCInfoBase::kUninitialized), 0, InitDefaultsscc_info_ListValue_google_2fprotobuf_2fstruct_2eproto}, {}};
+ {{ATOMIC_VAR_INIT(::PROTOBUF_NAMESPACE_ID::internal::SCCInfoBase::kUninitialized), 0, 0, InitDefaultsscc_info_ListValue_google_2fprotobuf_2fstruct_2eproto}, {}};
static ::PROTOBUF_NAMESPACE_ID::Metadata file_level_metadata_google_2fprotobuf_2fstruct_2eproto[4];
static const ::PROTOBUF_NAMESPACE_ID::EnumDescriptor* file_level_enum_descriptors_google_2fprotobuf_2fstruct_2eproto[1];
@@ -275,7 +275,7 @@
ptr = ctx->ParseMessage(&fields_, ptr);
CHK_(ptr);
if (!ctx->DataAvailable(ptr)) break;
- } while (::PROTOBUF_NAMESPACE_ID::internal::UnalignedLoad<::PROTOBUF_NAMESPACE_ID::uint8>(ptr) == 10);
+ } while (::PROTOBUF_NAMESPACE_ID::internal::ExpectTag<10>(ptr));
} else goto handle_unusual;
continue;
default: {
@@ -570,7 +570,7 @@
break;
}
case kStringValue: {
- set_string_value(from.string_value());
+ _internal_set_string_value(from._internal_string_value());
break;
}
case kBoolValue: {
@@ -701,7 +701,7 @@
// string string_value = 3;
case 3:
if (PROTOBUF_PREDICT_TRUE(static_cast<::PROTOBUF_NAMESPACE_ID::uint8>(tag) == 26)) {
- ptr = ::PROTOBUF_NAMESPACE_ID::internal::InlineGreedyStringParserUTF8(mutable_string_value(), ptr, ctx, "google.protobuf.Value.string_value");
+ ptr = ::PROTOBUF_NAMESPACE_ID::internal::InlineGreedyStringParserUTF8(_internal_mutable_string_value(), ptr, ctx, "google.protobuf.Value.string_value");
CHK_(ptr);
} else goto handle_unusual;
continue;
@@ -788,9 +788,9 @@
case 3: {
if (static_cast< ::PROTOBUF_NAMESPACE_ID::uint8>(tag) == (26 & 0xFF)) {
DO_(::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::ReadString(
- input, this->mutable_string_value()));
+ input, this->_internal_mutable_string_value()));
DO_(::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::VerifyUtf8String(
- this->string_value().data(), static_cast<int>(this->string_value().length()),
+ this->_internal_string_value().data(), static_cast<int>(this->_internal_string_value().length()),
::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::PARSE,
"google.protobuf.Value.string_value"));
} else {
@@ -878,11 +878,11 @@
// string string_value = 3;
if (has_string_value()) {
::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::VerifyUtf8String(
- this->string_value().data(), static_cast<int>(this->string_value().length()),
+ this->_internal_string_value().data(), static_cast<int>(this->_internal_string_value().length()),
::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::SERIALIZE,
"google.protobuf.Value.string_value");
target = stream->WriteStringMaybeAliased(
- 3, this->string_value(), target);
+ 3, this->_internal_string_value(), target);
}
// bool bool_value = 4;
@@ -939,7 +939,7 @@
case kStringValue: {
total_size += 1 +
::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::StringSize(
- this->string_value());
+ this->_internal_string_value());
break;
}
// bool bool_value = 4;
@@ -1006,7 +1006,7 @@
break;
}
case kStringValue: {
- set_string_value(from.string_value());
+ _internal_set_string_value(from._internal_string_value());
break;
}
case kBoolValue: {
@@ -1142,7 +1142,7 @@
ptr = ctx->ParseMessage(add_values(), ptr);
CHK_(ptr);
if (!ctx->DataAvailable(ptr)) break;
- } while (::PROTOBUF_NAMESPACE_ID::internal::UnalignedLoad<::PROTOBUF_NAMESPACE_ID::uint8>(ptr) == 10);
+ } while (::PROTOBUF_NAMESPACE_ID::internal::ExpectTag<10>(ptr));
} else goto handle_unusual;
continue;
default: {
@@ -1214,8 +1214,8 @@
(void) cached_has_bits;
// repeated .google.protobuf.Value values = 1;
- for (auto it = this->values().pointer_begin(),
- end = this->values().pointer_end(); it < end; ++it) {
+ for (auto it = this->values_.pointer_begin(),
+ end = this->values_.pointer_end(); it < end; ++it) {
stream->EnsureSpace(&target);
target = ::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::
InternalWriteMessageToArray(1, **it, target, stream);
@@ -1238,14 +1238,10 @@
(void) cached_has_bits;
// repeated .google.protobuf.Value values = 1;
- {
- unsigned int count = static_cast<unsigned int>(this->values_size());
- total_size += 1UL * count;
- for (unsigned int i = 0; i < count; i++) {
- total_size +=
- ::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::MessageSize(
- this->values(static_cast<int>(i)));
- }
+ total_size += 1UL * this->values_size();
+ for (const auto& msg : this->values_) {
+ total_size +=
+ ::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::MessageSize(msg);
}
if (PROTOBUF_PREDICT_FALSE(_internal_metadata_.have_unknown_fields())) {
@@ -1303,7 +1299,7 @@
void ListValue::InternalSwap(ListValue* other) {
using std::swap;
_internal_metadata_.Swap(&other->_internal_metadata_);
- CastToBase(&values_)->InternalSwap(CastToBase(&other->values_));
+ values_.InternalSwap(&other->values_);
}
::PROTOBUF_NAMESPACE_ID::Metadata ListValue::GetMetadata() const {
diff --git a/src/google/protobuf/struct.pb.h b/src/google/protobuf/struct.pb.h
index c7c08f1..124016b 100644
--- a/src/google/protobuf/struct.pb.h
+++ b/src/google/protobuf/struct.pb.h
@@ -485,6 +485,11 @@
" future release.")
void unsafe_arena_set_allocated_string_value(
std::string* string_value);
+ private:
+ const std::string& _internal_string_value() const;
+ void _internal_set_string_value(const std::string& value);
+ std::string* _internal_mutable_string_value();
+ public:
// bool bool_value = 4;
private:
@@ -496,6 +501,9 @@
// .google.protobuf.Struct struct_value = 5;
bool has_struct_value() const;
+ private:
+ bool _internal_has_struct_value() const;
+ public:
void clear_struct_value();
const PROTOBUF_NAMESPACE_ID::Struct& struct_value() const;
PROTOBUF_NAMESPACE_ID::Struct* release_struct_value();
@@ -507,6 +515,9 @@
// .google.protobuf.ListValue list_value = 6;
bool has_list_value() const;
+ private:
+ bool _internal_has_list_value() const;
+ public:
void clear_list_value();
const PROTOBUF_NAMESPACE_ID::ListValue& list_value() const;
PROTOBUF_NAMESPACE_ID::ListValue* release_list_value();
@@ -816,12 +827,23 @@
}
inline const std::string& Value::string_value() const {
// @@protoc_insertion_point(field_get:google.protobuf.Value.string_value)
+ return _internal_string_value();
+}
+inline void Value::set_string_value(const std::string& value) {
+ _internal_set_string_value(value);
+ // @@protoc_insertion_point(field_set:google.protobuf.Value.string_value)
+}
+inline std::string* Value::mutable_string_value() {
+ // @@protoc_insertion_point(field_mutable:google.protobuf.Value.string_value)
+ return _internal_mutable_string_value();
+}
+inline const std::string& Value::_internal_string_value() const {
if (has_string_value()) {
return kind_.string_value_.Get();
}
return *&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited();
}
-inline void Value::set_string_value(const std::string& value) {
+inline void Value::_internal_set_string_value(const std::string& value) {
if (!has_string_value()) {
clear_kind();
set_has_string_value();
@@ -829,7 +851,6 @@
}
kind_.string_value_.Set(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(), value,
GetArenaNoVirtual());
- // @@protoc_insertion_point(field_set:google.protobuf.Value.string_value)
}
inline void Value::set_string_value(std::string&& value) {
// @@protoc_insertion_point(field_set:google.protobuf.Value.string_value)
@@ -866,7 +887,7 @@
GetArenaNoVirtual());
// @@protoc_insertion_point(field_set_pointer:google.protobuf.Value.string_value)
}
-inline std::string* Value::mutable_string_value() {
+inline std::string* Value::_internal_mutable_string_value() {
if (!has_string_value()) {
clear_kind();
set_has_string_value();
@@ -874,7 +895,6 @@
}
return kind_.string_value_.Mutable(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(),
GetArenaNoVirtual());
- // @@protoc_insertion_point(field_mutable:google.protobuf.Value.string_value)
}
inline std::string* Value::release_string_value() {
// @@protoc_insertion_point(field_release:google.protobuf.Value.string_value)
diff --git a/src/google/protobuf/test_util2.h b/src/google/protobuf/test_util2.h
index d1cf211..f12addb 100644
--- a/src/google/protobuf/test_util2.h
+++ b/src/google/protobuf/test_util2.h
@@ -36,7 +36,6 @@
#include <google/protobuf/util/message_differencer.h>
#include <google/protobuf/testing/googletest.h>
-
namespace google {
namespace protobuf {
namespace TestUtil {
diff --git a/src/google/protobuf/text_format.cc b/src/google/protobuf/text_format.cc
index 420c1e8..75d1007 100644
--- a/src/google/protobuf/text_format.cc
+++ b/src/google/protobuf/text_format.cc
@@ -37,6 +37,7 @@
#include <float.h>
#include <math.h>
#include <stdio.h>
+
#include <algorithm>
#include <climits>
#include <limits>
@@ -45,7 +46,6 @@
#include <google/protobuf/stubs/stringprintf.h>
#include <google/protobuf/any.h>
#include <google/protobuf/descriptor.pb.h>
-#include <google/protobuf/io/strtod.h>
#include <google/protobuf/io/coded_stream.h>
#include <google/protobuf/io/tokenizer.h>
#include <google/protobuf/io/zero_copy_stream.h>
@@ -54,18 +54,15 @@
#include <google/protobuf/dynamic_message.h>
#include <google/protobuf/map_field.h>
#include <google/protobuf/message.h>
+#include <google/protobuf/port_def.inc>
#include <google/protobuf/repeated_field.h>
#include <google/protobuf/unknown_field_set.h>
#include <google/protobuf/wire_format_lite.h>
#include <google/protobuf/stubs/strutil.h>
-
-
-
+#include <google/protobuf/io/strtod.h>
#include <google/protobuf/stubs/map_util.h>
#include <google/protobuf/stubs/stl_util.h>
-#include <google/protobuf/port_def.inc>
-
namespace google {
namespace protobuf {
@@ -1239,6 +1236,10 @@
--indent_level_;
}
+ size_t GetCurrentIndentationSize() const override {
+ return 2 * indent_level_;
+ }
+
// Print text to the output stream.
void Print(const char* text, size_t size) override {
if (indent_level_ > 0) {
@@ -1309,7 +1310,7 @@
return;
}
GOOGLE_DCHECK(!failed_);
- int size = 2 * indent_level_;
+ int size = GetCurrentIndentationSize();
while (size > buffer_size_) {
// Data exceeds space in the buffer. Write what we can and request a new
diff --git a/src/google/protobuf/text_format.h b/src/google/protobuf/text_format.h
index 2d755a9..86ca3d7 100644
--- a/src/google/protobuf/text_format.h
+++ b/src/google/protobuf/text_format.h
@@ -103,6 +103,8 @@
virtual void Indent() {}
virtual void Outdent() {}
+ // Returns the current indentation size in characters.
+ virtual size_t GetCurrentIndentationSize() const { return 0; }
// Print text to the output stream.
virtual void Print(const char* text, size_t size) = 0;
diff --git a/src/google/protobuf/text_format_unittest.cc b/src/google/protobuf/text_format_unittest.cc
index 56801c3..fcabc5f 100644
--- a/src/google/protobuf/text_format_unittest.cc
+++ b/src/google/protobuf/text_format_unittest.cc
@@ -54,8 +54,6 @@
#include <google/protobuf/io/tokenizer.h>
#include <google/protobuf/io/zero_copy_stream_impl.h>
#include <google/protobuf/stubs/strutil.h>
-
-
#include <google/protobuf/stubs/substitute.h>
#include <google/protobuf/testing/googletest.h>
#include <gtest/gtest.h>
diff --git a/src/google/protobuf/timestamp.pb.cc b/src/google/protobuf/timestamp.pb.cc
index 009320e..01e1acf 100644
--- a/src/google/protobuf/timestamp.pb.cc
+++ b/src/google/protobuf/timestamp.pb.cc
@@ -32,7 +32,7 @@
}
PROTOBUF_EXPORT ::PROTOBUF_NAMESPACE_ID::internal::SCCInfo<0> scc_info_Timestamp_google_2fprotobuf_2ftimestamp_2eproto =
- {{ATOMIC_VAR_INIT(::PROTOBUF_NAMESPACE_ID::internal::SCCInfoBase::kUninitialized), 0, InitDefaultsscc_info_Timestamp_google_2fprotobuf_2ftimestamp_2eproto}, {}};
+ {{ATOMIC_VAR_INIT(::PROTOBUF_NAMESPACE_ID::internal::SCCInfoBase::kUninitialized), 0, 0, InitDefaultsscc_info_Timestamp_google_2fprotobuf_2ftimestamp_2eproto}, {}};
static ::PROTOBUF_NAMESPACE_ID::Metadata file_level_metadata_google_2fprotobuf_2ftimestamp_2eproto[1];
static constexpr ::PROTOBUF_NAMESPACE_ID::EnumDescriptor const** file_level_enum_descriptors_google_2fprotobuf_2ftimestamp_2eproto = nullptr;
diff --git a/src/google/protobuf/type.pb.cc b/src/google/protobuf/type.pb.cc
index 734010d..caf16c9 100644
--- a/src/google/protobuf/type.pb.cc
+++ b/src/google/protobuf/type.pb.cc
@@ -53,7 +53,7 @@
}
PROTOBUF_EXPORT ::PROTOBUF_NAMESPACE_ID::internal::SCCInfo<3> scc_info_Enum_google_2fprotobuf_2ftype_2eproto =
- {{ATOMIC_VAR_INIT(::PROTOBUF_NAMESPACE_ID::internal::SCCInfoBase::kUninitialized), 3, InitDefaultsscc_info_Enum_google_2fprotobuf_2ftype_2eproto}, {
+ {{ATOMIC_VAR_INIT(::PROTOBUF_NAMESPACE_ID::internal::SCCInfoBase::kUninitialized), 3, 0, InitDefaultsscc_info_Enum_google_2fprotobuf_2ftype_2eproto}, {
&scc_info_EnumValue_google_2fprotobuf_2ftype_2eproto.base,
&scc_info_Option_google_2fprotobuf_2ftype_2eproto.base,
&scc_info_SourceContext_google_2fprotobuf_2fsource_5fcontext_2eproto.base,}};
@@ -70,7 +70,7 @@
}
PROTOBUF_EXPORT ::PROTOBUF_NAMESPACE_ID::internal::SCCInfo<1> scc_info_EnumValue_google_2fprotobuf_2ftype_2eproto =
- {{ATOMIC_VAR_INIT(::PROTOBUF_NAMESPACE_ID::internal::SCCInfoBase::kUninitialized), 1, InitDefaultsscc_info_EnumValue_google_2fprotobuf_2ftype_2eproto}, {
+ {{ATOMIC_VAR_INIT(::PROTOBUF_NAMESPACE_ID::internal::SCCInfoBase::kUninitialized), 1, 0, InitDefaultsscc_info_EnumValue_google_2fprotobuf_2ftype_2eproto}, {
&scc_info_Option_google_2fprotobuf_2ftype_2eproto.base,}};
static void InitDefaultsscc_info_Field_google_2fprotobuf_2ftype_2eproto() {
@@ -85,7 +85,7 @@
}
PROTOBUF_EXPORT ::PROTOBUF_NAMESPACE_ID::internal::SCCInfo<1> scc_info_Field_google_2fprotobuf_2ftype_2eproto =
- {{ATOMIC_VAR_INIT(::PROTOBUF_NAMESPACE_ID::internal::SCCInfoBase::kUninitialized), 1, InitDefaultsscc_info_Field_google_2fprotobuf_2ftype_2eproto}, {
+ {{ATOMIC_VAR_INIT(::PROTOBUF_NAMESPACE_ID::internal::SCCInfoBase::kUninitialized), 1, 0, InitDefaultsscc_info_Field_google_2fprotobuf_2ftype_2eproto}, {
&scc_info_Option_google_2fprotobuf_2ftype_2eproto.base,}};
static void InitDefaultsscc_info_Option_google_2fprotobuf_2ftype_2eproto() {
@@ -100,7 +100,7 @@
}
PROTOBUF_EXPORT ::PROTOBUF_NAMESPACE_ID::internal::SCCInfo<1> scc_info_Option_google_2fprotobuf_2ftype_2eproto =
- {{ATOMIC_VAR_INIT(::PROTOBUF_NAMESPACE_ID::internal::SCCInfoBase::kUninitialized), 1, InitDefaultsscc_info_Option_google_2fprotobuf_2ftype_2eproto}, {
+ {{ATOMIC_VAR_INIT(::PROTOBUF_NAMESPACE_ID::internal::SCCInfoBase::kUninitialized), 1, 0, InitDefaultsscc_info_Option_google_2fprotobuf_2ftype_2eproto}, {
&scc_info_Any_google_2fprotobuf_2fany_2eproto.base,}};
static void InitDefaultsscc_info_Type_google_2fprotobuf_2ftype_2eproto() {
@@ -115,7 +115,7 @@
}
PROTOBUF_EXPORT ::PROTOBUF_NAMESPACE_ID::internal::SCCInfo<3> scc_info_Type_google_2fprotobuf_2ftype_2eproto =
- {{ATOMIC_VAR_INIT(::PROTOBUF_NAMESPACE_ID::internal::SCCInfoBase::kUninitialized), 3, InitDefaultsscc_info_Type_google_2fprotobuf_2ftype_2eproto}, {
+ {{ATOMIC_VAR_INIT(::PROTOBUF_NAMESPACE_ID::internal::SCCInfoBase::kUninitialized), 3, 0, InitDefaultsscc_info_Type_google_2fprotobuf_2ftype_2eproto}, {
&scc_info_Field_google_2fprotobuf_2ftype_2eproto.base,
&scc_info_Option_google_2fprotobuf_2ftype_2eproto.base,
&scc_info_SourceContext_google_2fprotobuf_2fsource_5fcontext_2eproto.base,}};
@@ -410,8 +410,8 @@
options_(from.options_) {
_internal_metadata_.MergeFrom(from._internal_metadata_);
name_.UnsafeSetDefault(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited());
- if (!from.name().empty()) {
- name_.Set(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(), from.name(),
+ if (!from._internal_name().empty()) {
+ name_.Set(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(), from._internal_name(),
GetArenaNoVirtual());
}
if (from.has_source_context()) {
@@ -487,7 +487,7 @@
// string name = 1;
case 1:
if (PROTOBUF_PREDICT_TRUE(static_cast<::PROTOBUF_NAMESPACE_ID::uint8>(tag) == 10)) {
- ptr = ::PROTOBUF_NAMESPACE_ID::internal::InlineGreedyStringParserUTF8(mutable_name(), ptr, ctx, "google.protobuf.Type.name");
+ ptr = ::PROTOBUF_NAMESPACE_ID::internal::InlineGreedyStringParserUTF8(_internal_mutable_name(), ptr, ctx, "google.protobuf.Type.name");
CHK_(ptr);
} else goto handle_unusual;
continue;
@@ -500,7 +500,7 @@
ptr = ctx->ParseMessage(add_fields(), ptr);
CHK_(ptr);
if (!ctx->DataAvailable(ptr)) break;
- } while (::PROTOBUF_NAMESPACE_ID::internal::UnalignedLoad<::PROTOBUF_NAMESPACE_ID::uint8>(ptr) == 18);
+ } while (::PROTOBUF_NAMESPACE_ID::internal::ExpectTag<18>(ptr));
} else goto handle_unusual;
continue;
// repeated string oneofs = 3;
@@ -509,10 +509,10 @@
ptr -= 1;
do {
ptr += 1;
- ptr = ::PROTOBUF_NAMESPACE_ID::internal::InlineGreedyStringParserUTF8(add_oneofs(), ptr, ctx, "google.protobuf.Type.oneofs");
+ ptr = ::PROTOBUF_NAMESPACE_ID::internal::InlineGreedyStringParserUTF8(_internal_add_oneofs(), ptr, ctx, "google.protobuf.Type.oneofs");
CHK_(ptr);
if (!ctx->DataAvailable(ptr)) break;
- } while (::PROTOBUF_NAMESPACE_ID::internal::UnalignedLoad<::PROTOBUF_NAMESPACE_ID::uint8>(ptr) == 26);
+ } while (::PROTOBUF_NAMESPACE_ID::internal::ExpectTag<26>(ptr));
} else goto handle_unusual;
continue;
// repeated .google.protobuf.Option options = 4;
@@ -524,7 +524,7 @@
ptr = ctx->ParseMessage(add_options(), ptr);
CHK_(ptr);
if (!ctx->DataAvailable(ptr)) break;
- } while (::PROTOBUF_NAMESPACE_ID::internal::UnalignedLoad<::PROTOBUF_NAMESPACE_ID::uint8>(ptr) == 34);
+ } while (::PROTOBUF_NAMESPACE_ID::internal::ExpectTag<34>(ptr));
} else goto handle_unusual;
continue;
// .google.protobuf.SourceContext source_context = 5;
@@ -576,9 +576,9 @@
case 1: {
if (static_cast< ::PROTOBUF_NAMESPACE_ID::uint8>(tag) == (10 & 0xFF)) {
DO_(::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::ReadString(
- input, this->mutable_name()));
+ input, this->_internal_mutable_name()));
DO_(::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::VerifyUtf8String(
- this->name().data(), static_cast<int>(this->name().length()),
+ this->_internal_name().data(), static_cast<int>(this->_internal_name().length()),
::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::PARSE,
"google.protobuf.Type.name"));
} else {
@@ -602,10 +602,10 @@
case 3: {
if (static_cast< ::PROTOBUF_NAMESPACE_ID::uint8>(tag) == (26 & 0xFF)) {
DO_(::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::ReadString(
- input, this->add_oneofs()));
+ input, this->_internal_add_oneofs()));
DO_(::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::VerifyUtf8String(
- this->oneofs(this->oneofs_size() - 1).data(),
- static_cast<int>(this->oneofs(this->oneofs_size() - 1).length()),
+ oneofs_.Get(oneofs_.size() - 1).data(),
+ static_cast<int>(oneofs_.Get(oneofs_.size() - 1).length()),
::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::PARSE,
"google.protobuf.Type.oneofs"));
} else {
@@ -680,24 +680,24 @@
// string name = 1;
if (this->name().size() > 0) {
::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::VerifyUtf8String(
- this->name().data(), static_cast<int>(this->name().length()),
+ this->_internal_name().data(), static_cast<int>(this->_internal_name().length()),
::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::SERIALIZE,
"google.protobuf.Type.name");
target = stream->WriteStringMaybeAliased(
- 1, this->name(), target);
+ 1, this->_internal_name(), target);
}
// repeated .google.protobuf.Field fields = 2;
- for (auto it = this->fields().pointer_begin(),
- end = this->fields().pointer_end(); it < end; ++it) {
+ for (auto it = this->fields_.pointer_begin(),
+ end = this->fields_.pointer_end(); it < end; ++it) {
stream->EnsureSpace(&target);
target = ::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::
InternalWriteMessageToArray(2, **it, target, stream);
}
// repeated string oneofs = 3;
- for (auto it = this->oneofs().pointer_begin(),
- end = this->oneofs().pointer_end(); it < end; ++it) {
+ for (auto it = oneofs_.pointer_begin(),
+ end = oneofs_.pointer_end(); it < end; ++it) {
const auto& s = **it;
::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::VerifyUtf8String(
s.data(), static_cast<int>(s.length()),
@@ -707,8 +707,8 @@
}
// repeated .google.protobuf.Option options = 4;
- for (auto it = this->options().pointer_begin(),
- end = this->options().pointer_end(); it < end; ++it) {
+ for (auto it = this->options_.pointer_begin(),
+ end = this->options_.pointer_end(); it < end; ++it) {
stream->EnsureSpace(&target);
target = ::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::
InternalWriteMessageToArray(4, **it, target, stream);
@@ -746,40 +746,32 @@
(void) cached_has_bits;
// repeated .google.protobuf.Field fields = 2;
- {
- unsigned int count = static_cast<unsigned int>(this->fields_size());
- total_size += 1UL * count;
- for (unsigned int i = 0; i < count; i++) {
- total_size +=
- ::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::MessageSize(
- this->fields(static_cast<int>(i)));
- }
+ total_size += 1UL * this->fields_size();
+ for (const auto& msg : this->fields_) {
+ total_size +=
+ ::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::MessageSize(msg);
}
// repeated string oneofs = 3;
total_size += 1 *
- ::PROTOBUF_NAMESPACE_ID::internal::FromIntSize(this->oneofs_size());
- for (int i = 0, n = this->oneofs_size(); i < n; i++) {
+ ::PROTOBUF_NAMESPACE_ID::internal::FromIntSize(oneofs_.size());
+ for (int i = 0, n = oneofs_.size(); i < n; i++) {
total_size += ::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::StringSize(
- this->oneofs(i));
+ oneofs_.Get(i));
}
// repeated .google.protobuf.Option options = 4;
- {
- unsigned int count = static_cast<unsigned int>(this->options_size());
- total_size += 1UL * count;
- for (unsigned int i = 0; i < count; i++) {
- total_size +=
- ::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::MessageSize(
- this->options(static_cast<int>(i)));
- }
+ total_size += 1UL * this->options_size();
+ for (const auto& msg : this->options_) {
+ total_size +=
+ ::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::MessageSize(msg);
}
// string name = 1;
if (this->name().size() > 0) {
total_size += 1 +
::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::StringSize(
- this->name());
+ this->_internal_name());
}
// .google.protobuf.SourceContext source_context = 5;
@@ -830,7 +822,7 @@
oneofs_.MergeFrom(from.oneofs_);
options_.MergeFrom(from.options_);
if (from.name().size() > 0) {
- set_name(from.name());
+ _internal_set_name(from._internal_name());
}
if (from.has_source_context()) {
mutable_source_context()->PROTOBUF_NAMESPACE_ID::SourceContext::MergeFrom(from.source_context());
@@ -861,9 +853,9 @@
void Type::InternalSwap(Type* other) {
using std::swap;
_internal_metadata_.Swap(&other->_internal_metadata_);
- CastToBase(&fields_)->InternalSwap(CastToBase(&other->fields_));
- oneofs_.InternalSwap(CastToBase(&other->oneofs_));
- CastToBase(&options_)->InternalSwap(CastToBase(&other->options_));
+ fields_.InternalSwap(&other->fields_);
+ oneofs_.InternalSwap(&other->oneofs_);
+ options_.InternalSwap(&other->options_);
name_.Swap(&other->name_, &::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(),
GetArenaNoVirtual());
swap(source_context_, other->source_context_);
@@ -902,23 +894,23 @@
options_(from.options_) {
_internal_metadata_.MergeFrom(from._internal_metadata_);
name_.UnsafeSetDefault(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited());
- if (!from.name().empty()) {
- name_.Set(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(), from.name(),
+ if (!from._internal_name().empty()) {
+ name_.Set(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(), from._internal_name(),
GetArenaNoVirtual());
}
type_url_.UnsafeSetDefault(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited());
- if (!from.type_url().empty()) {
- type_url_.Set(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(), from.type_url(),
+ if (!from._internal_type_url().empty()) {
+ type_url_.Set(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(), from._internal_type_url(),
GetArenaNoVirtual());
}
json_name_.UnsafeSetDefault(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited());
- if (!from.json_name().empty()) {
- json_name_.Set(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(), from.json_name(),
+ if (!from._internal_json_name().empty()) {
+ json_name_.Set(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(), from._internal_json_name(),
GetArenaNoVirtual());
}
default_value_.UnsafeSetDefault(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited());
- if (!from.default_value().empty()) {
- default_value_.Set(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(), from.default_value(),
+ if (!from._internal_default_value().empty()) {
+ default_value_.Set(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(), from._internal_default_value(),
GetArenaNoVirtual());
}
::memcpy(&kind_, &from.kind_,
@@ -1018,14 +1010,14 @@
// string name = 4;
case 4:
if (PROTOBUF_PREDICT_TRUE(static_cast<::PROTOBUF_NAMESPACE_ID::uint8>(tag) == 34)) {
- ptr = ::PROTOBUF_NAMESPACE_ID::internal::InlineGreedyStringParserUTF8(mutable_name(), ptr, ctx, "google.protobuf.Field.name");
+ ptr = ::PROTOBUF_NAMESPACE_ID::internal::InlineGreedyStringParserUTF8(_internal_mutable_name(), ptr, ctx, "google.protobuf.Field.name");
CHK_(ptr);
} else goto handle_unusual;
continue;
// string type_url = 6;
case 6:
if (PROTOBUF_PREDICT_TRUE(static_cast<::PROTOBUF_NAMESPACE_ID::uint8>(tag) == 50)) {
- ptr = ::PROTOBUF_NAMESPACE_ID::internal::InlineGreedyStringParserUTF8(mutable_type_url(), ptr, ctx, "google.protobuf.Field.type_url");
+ ptr = ::PROTOBUF_NAMESPACE_ID::internal::InlineGreedyStringParserUTF8(_internal_mutable_type_url(), ptr, ctx, "google.protobuf.Field.type_url");
CHK_(ptr);
} else goto handle_unusual;
continue;
@@ -1052,20 +1044,20 @@
ptr = ctx->ParseMessage(add_options(), ptr);
CHK_(ptr);
if (!ctx->DataAvailable(ptr)) break;
- } while (::PROTOBUF_NAMESPACE_ID::internal::UnalignedLoad<::PROTOBUF_NAMESPACE_ID::uint8>(ptr) == 74);
+ } while (::PROTOBUF_NAMESPACE_ID::internal::ExpectTag<74>(ptr));
} else goto handle_unusual;
continue;
// string json_name = 10;
case 10:
if (PROTOBUF_PREDICT_TRUE(static_cast<::PROTOBUF_NAMESPACE_ID::uint8>(tag) == 82)) {
- ptr = ::PROTOBUF_NAMESPACE_ID::internal::InlineGreedyStringParserUTF8(mutable_json_name(), ptr, ctx, "google.protobuf.Field.json_name");
+ ptr = ::PROTOBUF_NAMESPACE_ID::internal::InlineGreedyStringParserUTF8(_internal_mutable_json_name(), ptr, ctx, "google.protobuf.Field.json_name");
CHK_(ptr);
} else goto handle_unusual;
continue;
// string default_value = 11;
case 11:
if (PROTOBUF_PREDICT_TRUE(static_cast<::PROTOBUF_NAMESPACE_ID::uint8>(tag) == 90)) {
- ptr = ::PROTOBUF_NAMESPACE_ID::internal::InlineGreedyStringParserUTF8(mutable_default_value(), ptr, ctx, "google.protobuf.Field.default_value");
+ ptr = ::PROTOBUF_NAMESPACE_ID::internal::InlineGreedyStringParserUTF8(_internal_mutable_default_value(), ptr, ctx, "google.protobuf.Field.default_value");
CHK_(ptr);
} else goto handle_unusual;
continue;
@@ -1144,9 +1136,9 @@
case 4: {
if (static_cast< ::PROTOBUF_NAMESPACE_ID::uint8>(tag) == (34 & 0xFF)) {
DO_(::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::ReadString(
- input, this->mutable_name()));
+ input, this->_internal_mutable_name()));
DO_(::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::VerifyUtf8String(
- this->name().data(), static_cast<int>(this->name().length()),
+ this->_internal_name().data(), static_cast<int>(this->_internal_name().length()),
::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::PARSE,
"google.protobuf.Field.name"));
} else {
@@ -1159,9 +1151,9 @@
case 6: {
if (static_cast< ::PROTOBUF_NAMESPACE_ID::uint8>(tag) == (50 & 0xFF)) {
DO_(::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::ReadString(
- input, this->mutable_type_url()));
+ input, this->_internal_mutable_type_url()));
DO_(::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::VerifyUtf8String(
- this->type_url().data(), static_cast<int>(this->type_url().length()),
+ this->_internal_type_url().data(), static_cast<int>(this->_internal_type_url().length()),
::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::PARSE,
"google.protobuf.Field.type_url"));
} else {
@@ -1211,9 +1203,9 @@
case 10: {
if (static_cast< ::PROTOBUF_NAMESPACE_ID::uint8>(tag) == (82 & 0xFF)) {
DO_(::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::ReadString(
- input, this->mutable_json_name()));
+ input, this->_internal_mutable_json_name()));
DO_(::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::VerifyUtf8String(
- this->json_name().data(), static_cast<int>(this->json_name().length()),
+ this->_internal_json_name().data(), static_cast<int>(this->_internal_json_name().length()),
::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::PARSE,
"google.protobuf.Field.json_name"));
} else {
@@ -1226,9 +1218,9 @@
case 11: {
if (static_cast< ::PROTOBUF_NAMESPACE_ID::uint8>(tag) == (90 & 0xFF)) {
DO_(::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::ReadString(
- input, this->mutable_default_value()));
+ input, this->_internal_mutable_default_value()));
DO_(::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::VerifyUtf8String(
- this->default_value().data(), static_cast<int>(this->default_value().length()),
+ this->_internal_default_value().data(), static_cast<int>(this->_internal_default_value().length()),
::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::PARSE,
"google.protobuf.Field.default_value"));
} else {
@@ -1287,21 +1279,21 @@
// string name = 4;
if (this->name().size() > 0) {
::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::VerifyUtf8String(
- this->name().data(), static_cast<int>(this->name().length()),
+ this->_internal_name().data(), static_cast<int>(this->_internal_name().length()),
::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::SERIALIZE,
"google.protobuf.Field.name");
target = stream->WriteStringMaybeAliased(
- 4, this->name(), target);
+ 4, this->_internal_name(), target);
}
// string type_url = 6;
if (this->type_url().size() > 0) {
::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::VerifyUtf8String(
- this->type_url().data(), static_cast<int>(this->type_url().length()),
+ this->_internal_type_url().data(), static_cast<int>(this->_internal_type_url().length()),
::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::SERIALIZE,
"google.protobuf.Field.type_url");
target = stream->WriteStringMaybeAliased(
- 6, this->type_url(), target);
+ 6, this->_internal_type_url(), target);
}
// int32 oneof_index = 7;
@@ -1317,8 +1309,8 @@
}
// repeated .google.protobuf.Option options = 9;
- for (auto it = this->options().pointer_begin(),
- end = this->options().pointer_end(); it < end; ++it) {
+ for (auto it = this->options_.pointer_begin(),
+ end = this->options_.pointer_end(); it < end; ++it) {
stream->EnsureSpace(&target);
target = ::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::
InternalWriteMessageToArray(9, **it, target, stream);
@@ -1327,21 +1319,21 @@
// string json_name = 10;
if (this->json_name().size() > 0) {
::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::VerifyUtf8String(
- this->json_name().data(), static_cast<int>(this->json_name().length()),
+ this->_internal_json_name().data(), static_cast<int>(this->_internal_json_name().length()),
::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::SERIALIZE,
"google.protobuf.Field.json_name");
target = stream->WriteStringMaybeAliased(
- 10, this->json_name(), target);
+ 10, this->_internal_json_name(), target);
}
// string default_value = 11;
if (this->default_value().size() > 0) {
::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::VerifyUtf8String(
- this->default_value().data(), static_cast<int>(this->default_value().length()),
+ this->_internal_default_value().data(), static_cast<int>(this->_internal_default_value().length()),
::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::SERIALIZE,
"google.protobuf.Field.default_value");
target = stream->WriteStringMaybeAliased(
- 11, this->default_value(), target);
+ 11, this->_internal_default_value(), target);
}
if (PROTOBUF_PREDICT_FALSE(_internal_metadata_.have_unknown_fields())) {
@@ -1361,42 +1353,38 @@
(void) cached_has_bits;
// repeated .google.protobuf.Option options = 9;
- {
- unsigned int count = static_cast<unsigned int>(this->options_size());
- total_size += 1UL * count;
- for (unsigned int i = 0; i < count; i++) {
- total_size +=
- ::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::MessageSize(
- this->options(static_cast<int>(i)));
- }
+ total_size += 1UL * this->options_size();
+ for (const auto& msg : this->options_) {
+ total_size +=
+ ::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::MessageSize(msg);
}
// string name = 4;
if (this->name().size() > 0) {
total_size += 1 +
::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::StringSize(
- this->name());
+ this->_internal_name());
}
// string type_url = 6;
if (this->type_url().size() > 0) {
total_size += 1 +
::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::StringSize(
- this->type_url());
+ this->_internal_type_url());
}
// string json_name = 10;
if (this->json_name().size() > 0) {
total_size += 1 +
::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::StringSize(
- this->json_name());
+ this->_internal_json_name());
}
// string default_value = 11;
if (this->default_value().size() > 0) {
total_size += 1 +
::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::StringSize(
- this->default_value());
+ this->_internal_default_value());
}
// .google.protobuf.Field.Kind kind = 1;
@@ -1463,16 +1451,16 @@
options_.MergeFrom(from.options_);
if (from.name().size() > 0) {
- set_name(from.name());
+ _internal_set_name(from._internal_name());
}
if (from.type_url().size() > 0) {
- set_type_url(from.type_url());
+ _internal_set_type_url(from._internal_type_url());
}
if (from.json_name().size() > 0) {
- set_json_name(from.json_name());
+ _internal_set_json_name(from._internal_json_name());
}
if (from.default_value().size() > 0) {
- set_default_value(from.default_value());
+ _internal_set_default_value(from._internal_default_value());
}
if (from.kind() != 0) {
set_kind(from.kind());
@@ -1512,7 +1500,7 @@
void Field::InternalSwap(Field* other) {
using std::swap;
_internal_metadata_.Swap(&other->_internal_metadata_);
- CastToBase(&options_)->InternalSwap(CastToBase(&other->options_));
+ options_.InternalSwap(&other->options_);
name_.Swap(&other->name_, &::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(),
GetArenaNoVirtual());
type_url_.Swap(&other->type_url_, &::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(),
@@ -1588,8 +1576,8 @@
options_(from.options_) {
_internal_metadata_.MergeFrom(from._internal_metadata_);
name_.UnsafeSetDefault(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited());
- if (!from.name().empty()) {
- name_.Set(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(), from.name(),
+ if (!from._internal_name().empty()) {
+ name_.Set(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(), from._internal_name(),
GetArenaNoVirtual());
}
if (from.has_source_context()) {
@@ -1664,7 +1652,7 @@
// string name = 1;
case 1:
if (PROTOBUF_PREDICT_TRUE(static_cast<::PROTOBUF_NAMESPACE_ID::uint8>(tag) == 10)) {
- ptr = ::PROTOBUF_NAMESPACE_ID::internal::InlineGreedyStringParserUTF8(mutable_name(), ptr, ctx, "google.protobuf.Enum.name");
+ ptr = ::PROTOBUF_NAMESPACE_ID::internal::InlineGreedyStringParserUTF8(_internal_mutable_name(), ptr, ctx, "google.protobuf.Enum.name");
CHK_(ptr);
} else goto handle_unusual;
continue;
@@ -1677,7 +1665,7 @@
ptr = ctx->ParseMessage(add_enumvalue(), ptr);
CHK_(ptr);
if (!ctx->DataAvailable(ptr)) break;
- } while (::PROTOBUF_NAMESPACE_ID::internal::UnalignedLoad<::PROTOBUF_NAMESPACE_ID::uint8>(ptr) == 18);
+ } while (::PROTOBUF_NAMESPACE_ID::internal::ExpectTag<18>(ptr));
} else goto handle_unusual;
continue;
// repeated .google.protobuf.Option options = 3;
@@ -1689,7 +1677,7 @@
ptr = ctx->ParseMessage(add_options(), ptr);
CHK_(ptr);
if (!ctx->DataAvailable(ptr)) break;
- } while (::PROTOBUF_NAMESPACE_ID::internal::UnalignedLoad<::PROTOBUF_NAMESPACE_ID::uint8>(ptr) == 26);
+ } while (::PROTOBUF_NAMESPACE_ID::internal::ExpectTag<26>(ptr));
} else goto handle_unusual;
continue;
// .google.protobuf.SourceContext source_context = 4;
@@ -1741,9 +1729,9 @@
case 1: {
if (static_cast< ::PROTOBUF_NAMESPACE_ID::uint8>(tag) == (10 & 0xFF)) {
DO_(::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::ReadString(
- input, this->mutable_name()));
+ input, this->_internal_mutable_name()));
DO_(::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::VerifyUtf8String(
- this->name().data(), static_cast<int>(this->name().length()),
+ this->_internal_name().data(), static_cast<int>(this->_internal_name().length()),
::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::PARSE,
"google.protobuf.Enum.name"));
} else {
@@ -1829,24 +1817,24 @@
// string name = 1;
if (this->name().size() > 0) {
::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::VerifyUtf8String(
- this->name().data(), static_cast<int>(this->name().length()),
+ this->_internal_name().data(), static_cast<int>(this->_internal_name().length()),
::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::SERIALIZE,
"google.protobuf.Enum.name");
target = stream->WriteStringMaybeAliased(
- 1, this->name(), target);
+ 1, this->_internal_name(), target);
}
// repeated .google.protobuf.EnumValue enumvalue = 2;
- for (auto it = this->enumvalue().pointer_begin(),
- end = this->enumvalue().pointer_end(); it < end; ++it) {
+ for (auto it = this->enumvalue_.pointer_begin(),
+ end = this->enumvalue_.pointer_end(); it < end; ++it) {
stream->EnsureSpace(&target);
target = ::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::
InternalWriteMessageToArray(2, **it, target, stream);
}
// repeated .google.protobuf.Option options = 3;
- for (auto it = this->options().pointer_begin(),
- end = this->options().pointer_end(); it < end; ++it) {
+ for (auto it = this->options_.pointer_begin(),
+ end = this->options_.pointer_end(); it < end; ++it) {
stream->EnsureSpace(&target);
target = ::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::
InternalWriteMessageToArray(3, **it, target, stream);
@@ -1884,32 +1872,24 @@
(void) cached_has_bits;
// repeated .google.protobuf.EnumValue enumvalue = 2;
- {
- unsigned int count = static_cast<unsigned int>(this->enumvalue_size());
- total_size += 1UL * count;
- for (unsigned int i = 0; i < count; i++) {
- total_size +=
- ::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::MessageSize(
- this->enumvalue(static_cast<int>(i)));
- }
+ total_size += 1UL * this->enumvalue_size();
+ for (const auto& msg : this->enumvalue_) {
+ total_size +=
+ ::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::MessageSize(msg);
}
// repeated .google.protobuf.Option options = 3;
- {
- unsigned int count = static_cast<unsigned int>(this->options_size());
- total_size += 1UL * count;
- for (unsigned int i = 0; i < count; i++) {
- total_size +=
- ::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::MessageSize(
- this->options(static_cast<int>(i)));
- }
+ total_size += 1UL * this->options_size();
+ for (const auto& msg : this->options_) {
+ total_size +=
+ ::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::MessageSize(msg);
}
// string name = 1;
if (this->name().size() > 0) {
total_size += 1 +
::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::StringSize(
- this->name());
+ this->_internal_name());
}
// .google.protobuf.SourceContext source_context = 4;
@@ -1959,7 +1939,7 @@
enumvalue_.MergeFrom(from.enumvalue_);
options_.MergeFrom(from.options_);
if (from.name().size() > 0) {
- set_name(from.name());
+ _internal_set_name(from._internal_name());
}
if (from.has_source_context()) {
mutable_source_context()->PROTOBUF_NAMESPACE_ID::SourceContext::MergeFrom(from.source_context());
@@ -1990,8 +1970,8 @@
void Enum::InternalSwap(Enum* other) {
using std::swap;
_internal_metadata_.Swap(&other->_internal_metadata_);
- CastToBase(&enumvalue_)->InternalSwap(CastToBase(&other->enumvalue_));
- CastToBase(&options_)->InternalSwap(CastToBase(&other->options_));
+ enumvalue_.InternalSwap(&other->enumvalue_);
+ options_.InternalSwap(&other->options_);
name_.Swap(&other->name_, &::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(),
GetArenaNoVirtual());
swap(source_context_, other->source_context_);
@@ -2030,8 +2010,8 @@
options_(from.options_) {
_internal_metadata_.MergeFrom(from._internal_metadata_);
name_.UnsafeSetDefault(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited());
- if (!from.name().empty()) {
- name_.Set(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(), from.name(),
+ if (!from._internal_name().empty()) {
+ name_.Set(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(), from._internal_name(),
GetArenaNoVirtual());
}
number_ = from.number_;
@@ -2093,7 +2073,7 @@
// string name = 1;
case 1:
if (PROTOBUF_PREDICT_TRUE(static_cast<::PROTOBUF_NAMESPACE_ID::uint8>(tag) == 10)) {
- ptr = ::PROTOBUF_NAMESPACE_ID::internal::InlineGreedyStringParserUTF8(mutable_name(), ptr, ctx, "google.protobuf.EnumValue.name");
+ ptr = ::PROTOBUF_NAMESPACE_ID::internal::InlineGreedyStringParserUTF8(_internal_mutable_name(), ptr, ctx, "google.protobuf.EnumValue.name");
CHK_(ptr);
} else goto handle_unusual;
continue;
@@ -2113,7 +2093,7 @@
ptr = ctx->ParseMessage(add_options(), ptr);
CHK_(ptr);
if (!ctx->DataAvailable(ptr)) break;
- } while (::PROTOBUF_NAMESPACE_ID::internal::UnalignedLoad<::PROTOBUF_NAMESPACE_ID::uint8>(ptr) == 26);
+ } while (::PROTOBUF_NAMESPACE_ID::internal::ExpectTag<26>(ptr));
} else goto handle_unusual;
continue;
default: {
@@ -2150,9 +2130,9 @@
case 1: {
if (static_cast< ::PROTOBUF_NAMESPACE_ID::uint8>(tag) == (10 & 0xFF)) {
DO_(::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::ReadString(
- input, this->mutable_name()));
+ input, this->_internal_mutable_name()));
DO_(::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::VerifyUtf8String(
- this->name().data(), static_cast<int>(this->name().length()),
+ this->_internal_name().data(), static_cast<int>(this->_internal_name().length()),
::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::PARSE,
"google.protobuf.EnumValue.name"));
} else {
@@ -2215,11 +2195,11 @@
// string name = 1;
if (this->name().size() > 0) {
::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::VerifyUtf8String(
- this->name().data(), static_cast<int>(this->name().length()),
+ this->_internal_name().data(), static_cast<int>(this->_internal_name().length()),
::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::SERIALIZE,
"google.protobuf.EnumValue.name");
target = stream->WriteStringMaybeAliased(
- 1, this->name(), target);
+ 1, this->_internal_name(), target);
}
// int32 number = 2;
@@ -2229,8 +2209,8 @@
}
// repeated .google.protobuf.Option options = 3;
- for (auto it = this->options().pointer_begin(),
- end = this->options().pointer_end(); it < end; ++it) {
+ for (auto it = this->options_.pointer_begin(),
+ end = this->options_.pointer_end(); it < end; ++it) {
stream->EnsureSpace(&target);
target = ::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::
InternalWriteMessageToArray(3, **it, target, stream);
@@ -2253,21 +2233,17 @@
(void) cached_has_bits;
// repeated .google.protobuf.Option options = 3;
- {
- unsigned int count = static_cast<unsigned int>(this->options_size());
- total_size += 1UL * count;
- for (unsigned int i = 0; i < count; i++) {
- total_size +=
- ::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::MessageSize(
- this->options(static_cast<int>(i)));
- }
+ total_size += 1UL * this->options_size();
+ for (const auto& msg : this->options_) {
+ total_size +=
+ ::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::MessageSize(msg);
}
// string name = 1;
if (this->name().size() > 0) {
total_size += 1 +
::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::StringSize(
- this->name());
+ this->_internal_name());
}
// int32 number = 2;
@@ -2310,7 +2286,7 @@
options_.MergeFrom(from.options_);
if (from.name().size() > 0) {
- set_name(from.name());
+ _internal_set_name(from._internal_name());
}
if (from.number() != 0) {
set_number(from.number());
@@ -2338,7 +2314,7 @@
void EnumValue::InternalSwap(EnumValue* other) {
using std::swap;
_internal_metadata_.Swap(&other->_internal_metadata_);
- CastToBase(&options_)->InternalSwap(CastToBase(&other->options_));
+ options_.InternalSwap(&other->options_);
name_.Swap(&other->name_, &::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(),
GetArenaNoVirtual());
swap(number_, other->number_);
@@ -2400,8 +2376,8 @@
_internal_metadata_(nullptr) {
_internal_metadata_.MergeFrom(from._internal_metadata_);
name_.UnsafeSetDefault(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited());
- if (!from.name().empty()) {
- name_.Set(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(), from.name(),
+ if (!from._internal_name().empty()) {
+ name_.Set(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(), from._internal_name(),
GetArenaNoVirtual());
}
if (from.has_value()) {
@@ -2470,7 +2446,7 @@
// string name = 1;
case 1:
if (PROTOBUF_PREDICT_TRUE(static_cast<::PROTOBUF_NAMESPACE_ID::uint8>(tag) == 10)) {
- ptr = ::PROTOBUF_NAMESPACE_ID::internal::InlineGreedyStringParserUTF8(mutable_name(), ptr, ctx, "google.protobuf.Option.name");
+ ptr = ::PROTOBUF_NAMESPACE_ID::internal::InlineGreedyStringParserUTF8(_internal_mutable_name(), ptr, ctx, "google.protobuf.Option.name");
CHK_(ptr);
} else goto handle_unusual;
continue;
@@ -2515,9 +2491,9 @@
case 1: {
if (static_cast< ::PROTOBUF_NAMESPACE_ID::uint8>(tag) == (10 & 0xFF)) {
DO_(::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::ReadString(
- input, this->mutable_name()));
+ input, this->_internal_mutable_name()));
DO_(::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::VerifyUtf8String(
- this->name().data(), static_cast<int>(this->name().length()),
+ this->_internal_name().data(), static_cast<int>(this->_internal_name().length()),
::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::PARSE,
"google.protobuf.Option.name"));
} else {
@@ -2567,11 +2543,11 @@
// string name = 1;
if (this->name().size() > 0) {
::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::VerifyUtf8String(
- this->name().data(), static_cast<int>(this->name().length()),
+ this->_internal_name().data(), static_cast<int>(this->_internal_name().length()),
::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::SERIALIZE,
"google.protobuf.Option.name");
target = stream->WriteStringMaybeAliased(
- 1, this->name(), target);
+ 1, this->_internal_name(), target);
}
// .google.protobuf.Any value = 2;
@@ -2602,7 +2578,7 @@
if (this->name().size() > 0) {
total_size += 1 +
::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::StringSize(
- this->name());
+ this->_internal_name());
}
// .google.protobuf.Any value = 2;
@@ -2644,7 +2620,7 @@
(void) cached_has_bits;
if (from.name().size() > 0) {
- set_name(from.name());
+ _internal_set_name(from._internal_name());
}
if (from.has_value()) {
mutable_value()->PROTOBUF_NAMESPACE_ID::Any::MergeFrom(from.value());
diff --git a/src/google/protobuf/type.pb.h b/src/google/protobuf/type.pb.h
index 4742aec..49550a9 100644
--- a/src/google/protobuf/type.pb.h
+++ b/src/google/protobuf/type.pb.h
@@ -344,6 +344,9 @@
void add_oneofs(const char* value, size_t size);
const ::PROTOBUF_NAMESPACE_ID::RepeatedPtrField<std::string>& oneofs() const;
::PROTOBUF_NAMESPACE_ID::RepeatedPtrField<std::string>* mutable_oneofs();
+ private:
+ std::string* _internal_add_oneofs();
+ public:
// repeated .google.protobuf.Option options = 4;
int options_size() const;
@@ -375,9 +378,17 @@
" future release.")
void unsafe_arena_set_allocated_name(
std::string* name);
+ private:
+ const std::string& _internal_name() const;
+ void _internal_set_name(const std::string& value);
+ std::string* _internal_mutable_name();
+ public:
// .google.protobuf.SourceContext source_context = 5;
bool has_source_context() const;
+ private:
+ bool _internal_has_source_context() const;
+ public:
void clear_source_context();
const PROTOBUF_NAMESPACE_ID::SourceContext& source_context() const;
PROTOBUF_NAMESPACE_ID::SourceContext* release_source_context();
@@ -681,6 +692,11 @@
" future release.")
void unsafe_arena_set_allocated_name(
std::string* name);
+ private:
+ const std::string& _internal_name() const;
+ void _internal_set_name(const std::string& value);
+ std::string* _internal_mutable_name();
+ public:
// string type_url = 6;
void clear_type_url();
@@ -701,6 +717,11 @@
" future release.")
void unsafe_arena_set_allocated_type_url(
std::string* type_url);
+ private:
+ const std::string& _internal_type_url() const;
+ void _internal_set_type_url(const std::string& value);
+ std::string* _internal_mutable_type_url();
+ public:
// string json_name = 10;
void clear_json_name();
@@ -721,6 +742,11 @@
" future release.")
void unsafe_arena_set_allocated_json_name(
std::string* json_name);
+ private:
+ const std::string& _internal_json_name() const;
+ void _internal_set_json_name(const std::string& value);
+ std::string* _internal_mutable_json_name();
+ public:
// string default_value = 11;
void clear_default_value();
@@ -741,6 +767,11 @@
" future release.")
void unsafe_arena_set_allocated_default_value(
std::string* default_value);
+ private:
+ const std::string& _internal_default_value() const;
+ void _internal_set_default_value(const std::string& value);
+ std::string* _internal_mutable_default_value();
+ public:
// .google.protobuf.Field.Kind kind = 1;
void clear_kind();
@@ -968,9 +999,17 @@
" future release.")
void unsafe_arena_set_allocated_name(
std::string* name);
+ private:
+ const std::string& _internal_name() const;
+ void _internal_set_name(const std::string& value);
+ std::string* _internal_mutable_name();
+ public:
// .google.protobuf.SourceContext source_context = 4;
bool has_source_context() const;
+ private:
+ bool _internal_has_source_context() const;
+ public:
void clear_source_context();
const PROTOBUF_NAMESPACE_ID::SourceContext& source_context() const;
PROTOBUF_NAMESPACE_ID::SourceContext* release_source_context();
@@ -1168,6 +1207,11 @@
" future release.")
void unsafe_arena_set_allocated_name(
std::string* name);
+ private:
+ const std::string& _internal_name() const;
+ void _internal_set_name(const std::string& value);
+ std::string* _internal_mutable_name();
+ public:
// int32 number = 2;
void clear_number();
@@ -1343,9 +1387,17 @@
" future release.")
void unsafe_arena_set_allocated_name(
std::string* name);
+ private:
+ const std::string& _internal_name() const;
+ void _internal_set_name(const std::string& value);
+ std::string* _internal_mutable_name();
+ public:
// .google.protobuf.Any value = 2;
bool has_value() const;
+ private:
+ bool _internal_has_value() const;
+ public:
void clear_value();
const PROTOBUF_NAMESPACE_ID::Any& value() const;
PROTOBUF_NAMESPACE_ID::Any* release_value();
@@ -1385,12 +1437,22 @@
}
inline const std::string& Type::name() const {
// @@protoc_insertion_point(field_get:google.protobuf.Type.name)
- return name_.Get();
+ return _internal_name();
}
inline void Type::set_name(const std::string& value) {
+ _internal_set_name(value);
+ // @@protoc_insertion_point(field_set:google.protobuf.Type.name)
+}
+inline std::string* Type::mutable_name() {
+ // @@protoc_insertion_point(field_mutable:google.protobuf.Type.name)
+ return _internal_mutable_name();
+}
+inline const std::string& Type::_internal_name() const {
+ return name_.Get();
+}
+inline void Type::_internal_set_name(const std::string& value) {
name_.Set(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(), value, GetArenaNoVirtual());
- // @@protoc_insertion_point(field_set:google.protobuf.Type.name)
}
inline void Type::set_name(std::string&& value) {
@@ -1412,9 +1474,8 @@
reinterpret_cast<const char*>(value), size), GetArenaNoVirtual());
// @@protoc_insertion_point(field_set_pointer:google.protobuf.Type.name)
}
-inline std::string* Type::mutable_name() {
+inline std::string* Type::_internal_mutable_name() {
- // @@protoc_insertion_point(field_mutable:google.protobuf.Type.name)
return name_.Mutable(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(), GetArenaNoVirtual());
}
inline std::string* Type::release_name() {
@@ -1489,6 +1550,10 @@
inline void Type::clear_oneofs() {
oneofs_.Clear();
}
+inline std::string* Type::add_oneofs() {
+ // @@protoc_insertion_point(field_add_mutable:google.protobuf.Type.oneofs)
+ return _internal_add_oneofs();
+}
inline const std::string& Type::oneofs(int index) const {
// @@protoc_insertion_point(field_get:google.protobuf.Type.oneofs)
return oneofs_.Get(index);
@@ -1515,8 +1580,7 @@
reinterpret_cast<const char*>(value), size);
// @@protoc_insertion_point(field_set_pointer:google.protobuf.Type.oneofs)
}
-inline std::string* Type::add_oneofs() {
- // @@protoc_insertion_point(field_add_mutable:google.protobuf.Type.oneofs)
+inline std::string* Type::_internal_add_oneofs() {
return oneofs_.Add();
}
inline void Type::add_oneofs(const std::string& value) {
@@ -1588,17 +1652,14 @@
&PROTOBUF_NAMESPACE_ID::_SourceContext_default_instance_);
}
inline PROTOBUF_NAMESPACE_ID::SourceContext* Type::release_source_context() {
- // @@protoc_insertion_point(field_release:google.protobuf.Type.source_context)
-
- PROTOBUF_NAMESPACE_ID::SourceContext* temp = source_context_;
+ auto temp = unsafe_arena_release_source_context();
if (GetArenaNoVirtual() != nullptr) {
temp = ::PROTOBUF_NAMESPACE_ID::internal::DuplicateIfNonNull(temp);
}
- source_context_ = nullptr;
return temp;
}
inline PROTOBUF_NAMESPACE_ID::SourceContext* Type::unsafe_arena_release_source_context() {
- // @@protoc_insertion_point(field_unsafe_arena_release:google.protobuf.Type.source_context)
+ // @@protoc_insertion_point(field_release:google.protobuf.Type.source_context)
PROTOBUF_NAMESPACE_ID::SourceContext* temp = source_context_;
source_context_ = nullptr;
@@ -1698,12 +1759,22 @@
}
inline const std::string& Field::name() const {
// @@protoc_insertion_point(field_get:google.protobuf.Field.name)
- return name_.Get();
+ return _internal_name();
}
inline void Field::set_name(const std::string& value) {
+ _internal_set_name(value);
+ // @@protoc_insertion_point(field_set:google.protobuf.Field.name)
+}
+inline std::string* Field::mutable_name() {
+ // @@protoc_insertion_point(field_mutable:google.protobuf.Field.name)
+ return _internal_mutable_name();
+}
+inline const std::string& Field::_internal_name() const {
+ return name_.Get();
+}
+inline void Field::_internal_set_name(const std::string& value) {
name_.Set(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(), value, GetArenaNoVirtual());
- // @@protoc_insertion_point(field_set:google.protobuf.Field.name)
}
inline void Field::set_name(std::string&& value) {
@@ -1725,9 +1796,8 @@
reinterpret_cast<const char*>(value), size), GetArenaNoVirtual());
// @@protoc_insertion_point(field_set_pointer:google.protobuf.Field.name)
}
-inline std::string* Field::mutable_name() {
+inline std::string* Field::_internal_mutable_name() {
- // @@protoc_insertion_point(field_mutable:google.protobuf.Field.name)
return name_.Mutable(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(), GetArenaNoVirtual());
}
inline std::string* Field::release_name() {
@@ -1771,12 +1841,22 @@
}
inline const std::string& Field::type_url() const {
// @@protoc_insertion_point(field_get:google.protobuf.Field.type_url)
- return type_url_.Get();
+ return _internal_type_url();
}
inline void Field::set_type_url(const std::string& value) {
+ _internal_set_type_url(value);
+ // @@protoc_insertion_point(field_set:google.protobuf.Field.type_url)
+}
+inline std::string* Field::mutable_type_url() {
+ // @@protoc_insertion_point(field_mutable:google.protobuf.Field.type_url)
+ return _internal_mutable_type_url();
+}
+inline const std::string& Field::_internal_type_url() const {
+ return type_url_.Get();
+}
+inline void Field::_internal_set_type_url(const std::string& value) {
type_url_.Set(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(), value, GetArenaNoVirtual());
- // @@protoc_insertion_point(field_set:google.protobuf.Field.type_url)
}
inline void Field::set_type_url(std::string&& value) {
@@ -1798,9 +1878,8 @@
reinterpret_cast<const char*>(value), size), GetArenaNoVirtual());
// @@protoc_insertion_point(field_set_pointer:google.protobuf.Field.type_url)
}
-inline std::string* Field::mutable_type_url() {
+inline std::string* Field::_internal_mutable_type_url() {
- // @@protoc_insertion_point(field_mutable:google.protobuf.Field.type_url)
return type_url_.Mutable(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(), GetArenaNoVirtual());
}
inline std::string* Field::release_type_url() {
@@ -1902,12 +1981,22 @@
}
inline const std::string& Field::json_name() const {
// @@protoc_insertion_point(field_get:google.protobuf.Field.json_name)
- return json_name_.Get();
+ return _internal_json_name();
}
inline void Field::set_json_name(const std::string& value) {
+ _internal_set_json_name(value);
+ // @@protoc_insertion_point(field_set:google.protobuf.Field.json_name)
+}
+inline std::string* Field::mutable_json_name() {
+ // @@protoc_insertion_point(field_mutable:google.protobuf.Field.json_name)
+ return _internal_mutable_json_name();
+}
+inline const std::string& Field::_internal_json_name() const {
+ return json_name_.Get();
+}
+inline void Field::_internal_set_json_name(const std::string& value) {
json_name_.Set(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(), value, GetArenaNoVirtual());
- // @@protoc_insertion_point(field_set:google.protobuf.Field.json_name)
}
inline void Field::set_json_name(std::string&& value) {
@@ -1929,9 +2018,8 @@
reinterpret_cast<const char*>(value), size), GetArenaNoVirtual());
// @@protoc_insertion_point(field_set_pointer:google.protobuf.Field.json_name)
}
-inline std::string* Field::mutable_json_name() {
+inline std::string* Field::_internal_mutable_json_name() {
- // @@protoc_insertion_point(field_mutable:google.protobuf.Field.json_name)
return json_name_.Mutable(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(), GetArenaNoVirtual());
}
inline std::string* Field::release_json_name() {
@@ -1975,12 +2063,22 @@
}
inline const std::string& Field::default_value() const {
// @@protoc_insertion_point(field_get:google.protobuf.Field.default_value)
- return default_value_.Get();
+ return _internal_default_value();
}
inline void Field::set_default_value(const std::string& value) {
+ _internal_set_default_value(value);
+ // @@protoc_insertion_point(field_set:google.protobuf.Field.default_value)
+}
+inline std::string* Field::mutable_default_value() {
+ // @@protoc_insertion_point(field_mutable:google.protobuf.Field.default_value)
+ return _internal_mutable_default_value();
+}
+inline const std::string& Field::_internal_default_value() const {
+ return default_value_.Get();
+}
+inline void Field::_internal_set_default_value(const std::string& value) {
default_value_.Set(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(), value, GetArenaNoVirtual());
- // @@protoc_insertion_point(field_set:google.protobuf.Field.default_value)
}
inline void Field::set_default_value(std::string&& value) {
@@ -2002,9 +2100,8 @@
reinterpret_cast<const char*>(value), size), GetArenaNoVirtual());
// @@protoc_insertion_point(field_set_pointer:google.protobuf.Field.default_value)
}
-inline std::string* Field::mutable_default_value() {
+inline std::string* Field::_internal_mutable_default_value() {
- // @@protoc_insertion_point(field_mutable:google.protobuf.Field.default_value)
return default_value_.Mutable(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(), GetArenaNoVirtual());
}
inline std::string* Field::release_default_value() {
@@ -2052,12 +2149,22 @@
}
inline const std::string& Enum::name() const {
// @@protoc_insertion_point(field_get:google.protobuf.Enum.name)
- return name_.Get();
+ return _internal_name();
}
inline void Enum::set_name(const std::string& value) {
+ _internal_set_name(value);
+ // @@protoc_insertion_point(field_set:google.protobuf.Enum.name)
+}
+inline std::string* Enum::mutable_name() {
+ // @@protoc_insertion_point(field_mutable:google.protobuf.Enum.name)
+ return _internal_mutable_name();
+}
+inline const std::string& Enum::_internal_name() const {
+ return name_.Get();
+}
+inline void Enum::_internal_set_name(const std::string& value) {
name_.Set(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(), value, GetArenaNoVirtual());
- // @@protoc_insertion_point(field_set:google.protobuf.Enum.name)
}
inline void Enum::set_name(std::string&& value) {
@@ -2079,9 +2186,8 @@
reinterpret_cast<const char*>(value), size), GetArenaNoVirtual());
// @@protoc_insertion_point(field_set_pointer:google.protobuf.Enum.name)
}
-inline std::string* Enum::mutable_name() {
+inline std::string* Enum::_internal_mutable_name() {
- // @@protoc_insertion_point(field_mutable:google.protobuf.Enum.name)
return name_.Mutable(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(), GetArenaNoVirtual());
}
inline std::string* Enum::release_name() {
@@ -2190,17 +2296,14 @@
&PROTOBUF_NAMESPACE_ID::_SourceContext_default_instance_);
}
inline PROTOBUF_NAMESPACE_ID::SourceContext* Enum::release_source_context() {
- // @@protoc_insertion_point(field_release:google.protobuf.Enum.source_context)
-
- PROTOBUF_NAMESPACE_ID::SourceContext* temp = source_context_;
+ auto temp = unsafe_arena_release_source_context();
if (GetArenaNoVirtual() != nullptr) {
temp = ::PROTOBUF_NAMESPACE_ID::internal::DuplicateIfNonNull(temp);
}
- source_context_ = nullptr;
return temp;
}
inline PROTOBUF_NAMESPACE_ID::SourceContext* Enum::unsafe_arena_release_source_context() {
- // @@protoc_insertion_point(field_unsafe_arena_release:google.protobuf.Enum.source_context)
+ // @@protoc_insertion_point(field_release:google.protobuf.Enum.source_context)
PROTOBUF_NAMESPACE_ID::SourceContext* temp = source_context_;
source_context_ = nullptr;
@@ -2258,12 +2361,22 @@
}
inline const std::string& EnumValue::name() const {
// @@protoc_insertion_point(field_get:google.protobuf.EnumValue.name)
- return name_.Get();
+ return _internal_name();
}
inline void EnumValue::set_name(const std::string& value) {
+ _internal_set_name(value);
+ // @@protoc_insertion_point(field_set:google.protobuf.EnumValue.name)
+}
+inline std::string* EnumValue::mutable_name() {
+ // @@protoc_insertion_point(field_mutable:google.protobuf.EnumValue.name)
+ return _internal_mutable_name();
+}
+inline const std::string& EnumValue::_internal_name() const {
+ return name_.Get();
+}
+inline void EnumValue::_internal_set_name(const std::string& value) {
name_.Set(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(), value, GetArenaNoVirtual());
- // @@protoc_insertion_point(field_set:google.protobuf.EnumValue.name)
}
inline void EnumValue::set_name(std::string&& value) {
@@ -2285,9 +2398,8 @@
reinterpret_cast<const char*>(value), size), GetArenaNoVirtual());
// @@protoc_insertion_point(field_set_pointer:google.protobuf.EnumValue.name)
}
-inline std::string* EnumValue::mutable_name() {
+inline std::string* EnumValue::_internal_mutable_name() {
- // @@protoc_insertion_point(field_mutable:google.protobuf.EnumValue.name)
return name_.Mutable(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(), GetArenaNoVirtual());
}
inline std::string* EnumValue::release_name() {
@@ -2379,12 +2491,22 @@
}
inline const std::string& Option::name() const {
// @@protoc_insertion_point(field_get:google.protobuf.Option.name)
- return name_.Get();
+ return _internal_name();
}
inline void Option::set_name(const std::string& value) {
+ _internal_set_name(value);
+ // @@protoc_insertion_point(field_set:google.protobuf.Option.name)
+}
+inline std::string* Option::mutable_name() {
+ // @@protoc_insertion_point(field_mutable:google.protobuf.Option.name)
+ return _internal_mutable_name();
+}
+inline const std::string& Option::_internal_name() const {
+ return name_.Get();
+}
+inline void Option::_internal_set_name(const std::string& value) {
name_.Set(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(), value, GetArenaNoVirtual());
- // @@protoc_insertion_point(field_set:google.protobuf.Option.name)
}
inline void Option::set_name(std::string&& value) {
@@ -2406,9 +2528,8 @@
reinterpret_cast<const char*>(value), size), GetArenaNoVirtual());
// @@protoc_insertion_point(field_set_pointer:google.protobuf.Option.name)
}
-inline std::string* Option::mutable_name() {
+inline std::string* Option::_internal_mutable_name() {
- // @@protoc_insertion_point(field_mutable:google.protobuf.Option.name)
return name_.Mutable(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(), GetArenaNoVirtual());
}
inline std::string* Option::release_name() {
@@ -2457,17 +2578,14 @@
&PROTOBUF_NAMESPACE_ID::_Any_default_instance_);
}
inline PROTOBUF_NAMESPACE_ID::Any* Option::release_value() {
- // @@protoc_insertion_point(field_release:google.protobuf.Option.value)
-
- PROTOBUF_NAMESPACE_ID::Any* temp = value_;
+ auto temp = unsafe_arena_release_value();
if (GetArenaNoVirtual() != nullptr) {
temp = ::PROTOBUF_NAMESPACE_ID::internal::DuplicateIfNonNull(temp);
}
- value_ = nullptr;
return temp;
}
inline PROTOBUF_NAMESPACE_ID::Any* Option::unsafe_arena_release_value() {
- // @@protoc_insertion_point(field_unsafe_arena_release:google.protobuf.Option.value)
+ // @@protoc_insertion_point(field_release:google.protobuf.Option.value)
PROTOBUF_NAMESPACE_ID::Any* temp = value_;
value_ = nullptr;
diff --git a/src/google/protobuf/unknown_field_set_unittest.cc b/src/google/protobuf/unknown_field_set_unittest.cc
index 6d76b67..b3af94b 100644
--- a/src/google/protobuf/unknown_field_set_unittest.cc
+++ b/src/google/protobuf/unknown_field_set_unittest.cc
@@ -49,8 +49,6 @@
#include <google/protobuf/stubs/logging.h>
#include <google/protobuf/testing/googletest.h>
#include <gtest/gtest.h>
-
-
#include <google/protobuf/stubs/stl_util.h>
namespace google {
diff --git a/src/google/protobuf/util/field_mask_util.cc b/src/google/protobuf/util/field_mask_util.cc
index c4b2758..d3f347e 100644
--- a/src/google/protobuf/util/field_mask_util.cc
+++ b/src/google/protobuf/util/field_mask_util.cc
@@ -31,7 +31,6 @@
#include <google/protobuf/util/field_mask_util.h>
#include <google/protobuf/stubs/strutil.h>
-
#include <google/protobuf/stubs/map_util.h>
#include <google/protobuf/port_def.inc>
diff --git a/src/google/protobuf/util/internal/datapiece.cc b/src/google/protobuf/util/internal/datapiece.cc
index 55af434..8ffd824 100644
--- a/src/google/protobuf/util/internal/datapiece.cc
+++ b/src/google/protobuf/util/internal/datapiece.cc
@@ -34,7 +34,6 @@
#include <google/protobuf/type.pb.h>
#include <google/protobuf/descriptor.h>
#include <google/protobuf/util/internal/utility.h>
-
#include <google/protobuf/stubs/strutil.h>
#include <google/protobuf/stubs/mathlimits.h>
#include <google/protobuf/stubs/mathutil.h>
diff --git a/src/google/protobuf/util/internal/default_value_objectwriter.cc b/src/google/protobuf/util/internal/default_value_objectwriter.cc
index 6c3b58b..ec9ede8 100644
--- a/src/google/protobuf/util/internal/default_value_objectwriter.cc
+++ b/src/google/protobuf/util/internal/default_value_objectwriter.cc
@@ -67,7 +67,6 @@
suppress_empty_list_(false),
preserve_proto_field_names_(false),
use_ints_for_enums_(false),
- field_scrub_callback_(nullptr),
ow_(ow) {}
DefaultValueObjectWriter::~DefaultValueObjectWriter() {
@@ -183,8 +182,8 @@
}
void DefaultValueObjectWriter::RegisterFieldScrubCallBack(
- FieldScrubCallBackPtr field_scrub_callback) {
- field_scrub_callback_.reset(field_scrub_callback.release());
+ FieldScrubCallBack field_scrub_callback) {
+ field_scrub_callback_ = std::move(field_scrub_callback);
}
DefaultValueObjectWriter::Node* DefaultValueObjectWriter::CreateNewNode(
@@ -192,10 +191,10 @@
const DataPiece& data, bool is_placeholder,
const std::vector<std::string>& path, bool suppress_empty_list,
bool preserve_proto_field_names, bool use_ints_for_enums,
- FieldScrubCallBack* field_scrub_callback) {
+ FieldScrubCallBack field_scrub_callback) {
return new Node(name, type, kind, data, is_placeholder, path,
suppress_empty_list, preserve_proto_field_names,
- use_ints_for_enums, field_scrub_callback);
+ use_ints_for_enums, std::move(field_scrub_callback));
}
DefaultValueObjectWriter::Node::Node(
@@ -203,7 +202,7 @@
const DataPiece& data, bool is_placeholder,
const std::vector<std::string>& path, bool suppress_empty_list,
bool preserve_proto_field_names, bool use_ints_for_enums,
- FieldScrubCallBack* field_scrub_callback)
+ FieldScrubCallBack field_scrub_callback)
: name_(name),
type_(type),
kind_(kind),
@@ -214,7 +213,7 @@
suppress_empty_list_(suppress_empty_list),
preserve_proto_field_names_(preserve_proto_field_names),
use_ints_for_enums_(use_ints_for_enums),
- field_scrub_callback_(field_scrub_callback) {}
+ field_scrub_callback_(std::move(field_scrub_callback)) {}
DefaultValueObjectWriter::Node* DefaultValueObjectWriter::Node::FindChild(
StringPiece name) {
@@ -329,8 +328,7 @@
path.insert(path.begin(), path_.begin(), path_.end());
}
path.push_back(field.name());
- if (field_scrub_callback_ != nullptr &&
- field_scrub_callback_->Run(path, &field)) {
+ if (field_scrub_callback_ && field_scrub_callback_(path, &field)) {
continue;
}
@@ -491,10 +489,10 @@
StringPiece name) {
if (current_ == nullptr) {
std::vector<std::string> path;
- root_.reset(CreateNewNode(
- std::string(name), &type_, OBJECT, DataPiece::NullData(), false, path,
- suppress_empty_list_, preserve_proto_field_names_, use_ints_for_enums_,
- field_scrub_callback_.get()));
+ root_.reset(CreateNewNode(std::string(name), &type_, OBJECT,
+ DataPiece::NullData(), false, path,
+ suppress_empty_list_, preserve_proto_field_names_,
+ use_ints_for_enums_, field_scrub_callback_));
root_->PopulateChildren(typeinfo_);
current_ = root_.get();
return this;
@@ -512,7 +510,7 @@
OBJECT, DataPiece::NullData(), false,
child == nullptr ? current_->path() : child->path(),
suppress_empty_list_, preserve_proto_field_names_,
- use_ints_for_enums_, field_scrub_callback_.get()));
+ use_ints_for_enums_, field_scrub_callback_));
child = node.get();
current_->AddChild(node.release());
}
@@ -542,10 +540,10 @@
StringPiece name) {
if (current_ == nullptr) {
std::vector<std::string> path;
- root_.reset(CreateNewNode(
- std::string(name), &type_, LIST, DataPiece::NullData(), false, path,
- suppress_empty_list_, preserve_proto_field_names_, use_ints_for_enums_,
- field_scrub_callback_.get()));
+ root_.reset(CreateNewNode(std::string(name), &type_, LIST,
+ DataPiece::NullData(), false, path,
+ suppress_empty_list_, preserve_proto_field_names_,
+ use_ints_for_enums_, field_scrub_callback_));
current_ = root_.get();
return this;
}
@@ -556,7 +554,7 @@
std::string(name), nullptr, LIST, DataPiece::NullData(), false,
child == nullptr ? current_->path() : child->path(),
suppress_empty_list_, preserve_proto_field_names_, use_ints_for_enums_,
- field_scrub_callback_.get()));
+ field_scrub_callback_));
child = node.get();
current_->AddChild(node.release());
}
@@ -618,7 +616,7 @@
CreateNewNode(std::string(name), nullptr, PRIMITIVE, data, false,
child == nullptr ? current_->path() : child->path(),
suppress_empty_list_, preserve_proto_field_names_,
- use_ints_for_enums_, field_scrub_callback_.get()));
+ use_ints_for_enums_, field_scrub_callback_));
current_->AddChild(node.release());
} else {
child->set_data(data);
diff --git a/src/google/protobuf/util/internal/default_value_objectwriter.h b/src/google/protobuf/util/internal/default_value_objectwriter.h
index e3f34a7..2975513 100644
--- a/src/google/protobuf/util/internal/default_value_objectwriter.h
+++ b/src/google/protobuf/util/internal/default_value_objectwriter.h
@@ -31,11 +31,11 @@
#ifndef GOOGLE_PROTOBUF_UTIL_CONVERTER_DEFAULT_VALUE_OBJECTWRITER_H__
#define GOOGLE_PROTOBUF_UTIL_CONVERTER_DEFAULT_VALUE_OBJECTWRITER_H__
+#include <functional>
#include <memory>
#include <stack>
#include <vector>
-#include <google/protobuf/stubs/callback.h>
#include <google/protobuf/stubs/common.h>
#include <google/protobuf/util/internal/type_info.h>
#include <google/protobuf/util/internal/datapiece.h>
@@ -44,6 +44,7 @@
#include <google/protobuf/util/type_resolver.h>
#include <google/protobuf/stubs/stringpiece.h>
+// Must be included last.
#include <google/protobuf/port_def.inc>
namespace google {
@@ -70,14 +71,11 @@
// "b", "c" }.
//
// The Field* should point to the google::protobuf::Field of "c".
- typedef ResultCallback2<bool /*return*/,
- const std::vector<std::string>& /*path of the field*/,
- const google::protobuf::Field* /*field*/>
+ typedef std::function<bool(
+ const std::vector<std::string>& /*path of the field*/,
+ const google::protobuf::Field* /*field*/)>
FieldScrubCallBack;
- // A unique pointer to a DefaultValueObjectWriter::FieldScrubCallBack.
- typedef std::unique_ptr<FieldScrubCallBack> FieldScrubCallBackPtr;
-
DefaultValueObjectWriter(TypeResolver* type_resolver,
const google::protobuf::Type& type,
ObjectWriter* ow);
@@ -121,9 +119,8 @@
virtual DefaultValueObjectWriter* RenderNull(StringPiece name);
- // Register the callback for scrubbing of fields. Owership of
- // field_scrub_callback pointer is also transferred to this class
- void RegisterFieldScrubCallBack(FieldScrubCallBackPtr field_scrub_callback);
+ // Register the callback for scrubbing of fields.
+ void RegisterFieldScrubCallBack(FieldScrubCallBack field_scrub_callback);
// If set to true, empty lists are suppressed from output when default values
// are written.
@@ -154,7 +151,7 @@
NodeKind kind, const DataPiece& data, bool is_placeholder,
const std::vector<std::string>& path, bool suppress_empty_list,
bool preserve_proto_field_names, bool use_ints_for_enums,
- FieldScrubCallBack* field_scrub_callback);
+ FieldScrubCallBack field_scrub_callback);
virtual ~Node() {
for (int i = 0; i < children_.size(); ++i) {
delete children_[i];
@@ -239,9 +236,8 @@
// Whether to always print enums as ints
bool use_ints_for_enums_;
- // Pointer to function for determining whether a field needs to be scrubbed
- // or not. This callback is owned by the creator of this node.
- FieldScrubCallBack* field_scrub_callback_;
+ // Function for determining whether a field needs to be scrubbed or not.
+ FieldScrubCallBack field_scrub_callback_;
private:
GOOGLE_DISALLOW_EVIL_CONSTRUCTORS(Node);
@@ -255,7 +251,7 @@
bool suppress_empty_list,
bool preserve_proto_field_names,
bool use_ints_for_enums,
- FieldScrubCallBack* field_scrub_callback);
+ FieldScrubCallBack field_scrub_callback);
// Creates a DataPiece containing the default value of the type of the field.
static DataPiece CreateDefaultDataPieceForField(
@@ -317,9 +313,8 @@
// Whether to always print enums as ints
bool use_ints_for_enums_;
- // Unique Pointer to function for determining whether a field needs to be
- // scrubbed or not.
- FieldScrubCallBackPtr field_scrub_callback_;
+ // Function for determining whether a field needs to be scrubbed or not.
+ FieldScrubCallBack field_scrub_callback_;
ObjectWriter* ow_;
diff --git a/src/google/protobuf/util/internal/json_objectwriter.cc b/src/google/protobuf/util/internal/json_objectwriter.cc
index 04908c5..faa00f7 100644
--- a/src/google/protobuf/util/internal/json_objectwriter.cc
+++ b/src/google/protobuf/util/internal/json_objectwriter.cc
@@ -36,7 +36,6 @@
#include <google/protobuf/stubs/logging.h>
#include <google/protobuf/stubs/common.h>
#include <google/protobuf/util/internal/utility.h>
-
#include <google/protobuf/util/internal/json_escaping.h>
#include <google/protobuf/stubs/strutil.h>
#include <google/protobuf/stubs/mathlimits.h>
diff --git a/src/google/protobuf/util/internal/json_stream_parser.cc b/src/google/protobuf/util/internal/json_stream_parser.cc
index b7a8c78..8fb6e95 100644
--- a/src/google/protobuf/util/internal/json_stream_parser.cc
+++ b/src/google/protobuf/util/internal/json_stream_parser.cc
@@ -40,7 +40,6 @@
#include <google/protobuf/stubs/logging.h>
#include <google/protobuf/stubs/common.h>
#include <google/protobuf/stubs/strutil.h>
-
#include <google/protobuf/util/internal/object_writer.h>
#include <google/protobuf/util/internal/json_escaping.h>
#include <google/protobuf/stubs/mathlimits.h>
diff --git a/src/google/protobuf/util/internal/json_stream_parser_test.cc b/src/google/protobuf/util/internal/json_stream_parser_test.cc
index 7916085..b7db879 100644
--- a/src/google/protobuf/util/internal/json_stream_parser_test.cc
+++ b/src/google/protobuf/util/internal/json_stream_parser_test.cc
@@ -37,7 +37,6 @@
#include <google/protobuf/util/internal/object_writer.h>
#include <google/protobuf/stubs/strutil.h>
#include <gtest/gtest.h>
-
#include <google/protobuf/stubs/status.h>
diff --git a/src/google/protobuf/util/internal/protostream_objectsource.cc b/src/google/protobuf/util/internal/protostream_objectsource.cc
index 1e247eb..495ccc2 100644
--- a/src/google/protobuf/util/internal/protostream_objectsource.cc
+++ b/src/google/protobuf/util/internal/protostream_objectsource.cc
@@ -49,8 +49,6 @@
#include <google/protobuf/util/internal/utility.h>
#include <google/protobuf/stubs/strutil.h>
#include <google/protobuf/stubs/casts.h>
-
-
#include <google/protobuf/stubs/map_util.h>
#include <google/protobuf/stubs/status_macros.h>
diff --git a/src/google/protobuf/util/internal/protostream_objectwriter.cc b/src/google/protobuf/util/internal/protostream_objectwriter.cc
index 7865f78..17b17d8 100644
--- a/src/google/protobuf/util/internal/protostream_objectwriter.cc
+++ b/src/google/protobuf/util/internal/protostream_objectwriter.cc
@@ -43,8 +43,6 @@
#include <google/protobuf/util/internal/constants.h>
#include <google/protobuf/util/internal/utility.h>
#include <google/protobuf/stubs/strutil.h>
-
-
#include <google/protobuf/stubs/map_util.h>
#include <google/protobuf/stubs/statusor.h>
@@ -879,7 +877,32 @@
const DataPiece& data) {
std::string struct_field_name;
switch (data.type()) {
- // Our JSON parser parses numbers as either int64, uint64, or double.
+ case DataPiece::TYPE_INT32: {
+ if (ow->options_.struct_integers_as_strings) {
+ StatusOr<int32> int_value = data.ToInt32();
+ if (int_value.ok()) {
+ ow->ProtoWriter::RenderDataPiece(
+ "string_value",
+ DataPiece(SimpleDtoa(int_value.ValueOrDie()), true));
+ return Status();
+ }
+ }
+ struct_field_name = "number_value";
+ break;
+ }
+ case DataPiece::TYPE_UINT32: {
+ if (ow->options_.struct_integers_as_strings) {
+ StatusOr<uint32> int_value = data.ToUint32();
+ if (int_value.ok()) {
+ ow->ProtoWriter::RenderDataPiece(
+ "string_value",
+ DataPiece(SimpleDtoa(int_value.ValueOrDie()), true));
+ return Status();
+ }
+ }
+ struct_field_name = "number_value";
+ break;
+ }
case DataPiece::TYPE_INT64: {
// If the option to treat integers as strings is set, then render them as
// strings. Otherwise, fallback to rendering them as double.
@@ -910,6 +933,19 @@
struct_field_name = "number_value";
break;
}
+ case DataPiece::TYPE_FLOAT: {
+ if (ow->options_.struct_integers_as_strings) {
+ StatusOr<float> float_value = data.ToFloat();
+ if (float_value.ok()) {
+ ow->ProtoWriter::RenderDataPiece(
+ "string_value",
+ DataPiece(SimpleDtoa(float_value.ValueOrDie()), true));
+ return Status();
+ }
+ }
+ struct_field_name = "number_value";
+ break;
+ }
case DataPiece::TYPE_DOUBLE: {
if (ow->options_.struct_integers_as_strings) {
StatusOr<double> double_value = data.ToDouble();
diff --git a/src/google/protobuf/util/internal/protostream_objectwriter_test.cc b/src/google/protobuf/util/internal/protostream_objectwriter_test.cc
index c4baaed..2148933 100644
--- a/src/google/protobuf/util/internal/protostream_objectwriter_test.cc
+++ b/src/google/protobuf/util/internal/protostream_objectwriter_test.cc
@@ -1719,6 +1719,45 @@
CheckOutput(struct_type);
}
+TEST_P(ProtoStreamObjectWriterStructTest, Struct32BitIntsAndFloatsTest) {
+ StructType struct_type;
+ google::protobuf::Struct* s = struct_type.mutable_object();
+ s->mutable_fields()->operator[]("k1").set_number_value(1.5);
+ s->mutable_fields()->operator[]("k2").set_number_value(100);
+ s->mutable_fields()->operator[]("k3").set_number_value(100);
+ ResetProtoWriter();
+
+ ow_->StartObject("")
+ ->StartObject("object")
+ ->RenderFloat("k1", 1.5)
+ ->RenderInt32("k2", 100)
+ ->RenderUint32("k3", 100)
+ ->EndObject()
+ ->EndObject();
+ CheckOutput(struct_type);
+}
+
+TEST_P(ProtoStreamObjectWriterStructTest,
+ Struct32BitIntsAndFloatsAsStringsTest) {
+ StructType struct_type;
+ google::protobuf::Struct* s = struct_type.mutable_object();
+ s->mutable_fields()->operator[]("k1").set_string_value("1.5");
+ s->mutable_fields()->operator[]("k2").set_string_value("100");
+ s->mutable_fields()->operator[]("k3").set_string_value("100");
+
+ options_.struct_integers_as_strings = true;
+ ResetProtoWriter();
+
+ ow_->StartObject("")
+ ->StartObject("object")
+ ->RenderFloat("k1", 1.5)
+ ->RenderInt32("k2", 100)
+ ->RenderUint32("k3", 100)
+ ->EndObject()
+ ->EndObject();
+ CheckOutput(struct_type);
+}
+
TEST_P(ProtoStreamObjectWriterStructTest, ValuePreservesNull) {
ValueWrapper value;
value.mutable_value()->set_null_value(google::protobuf::NULL_VALUE);
diff --git a/src/google/protobuf/util/internal/utility.h b/src/google/protobuf/util/internal/utility.h
index c960d9e..703d2a7 100644
--- a/src/google/protobuf/util/internal/utility.h
+++ b/src/google/protobuf/util/internal/utility.h
@@ -42,7 +42,6 @@
#include <google/protobuf/repeated_field.h>
#include <google/protobuf/stubs/strutil.h>
#include <google/protobuf/stubs/stringpiece.h>
-
#include <google/protobuf/stubs/status.h>
#include <google/protobuf/stubs/statusor.h>
diff --git a/src/google/protobuf/util/json_util.cc b/src/google/protobuf/util/json_util.cc
index 52ce331..2f3e6c6 100644
--- a/src/google/protobuf/util/json_util.cc
+++ b/src/google/protobuf/util/json_util.cc
@@ -43,7 +43,6 @@
#include <google/protobuf/util/type_resolver.h>
#include <google/protobuf/util/type_resolver_util.h>
#include <google/protobuf/stubs/bytestream.h>
-
#include <google/protobuf/stubs/strutil.h>
#include <google/protobuf/stubs/status_macros.h>
diff --git a/src/google/protobuf/util/message_differencer.cc b/src/google/protobuf/util/message_differencer.cc
index 421db45..de08096 100644
--- a/src/google/protobuf/util/message_differencer.cc
+++ b/src/google/protobuf/util/message_differencer.cc
@@ -35,12 +35,12 @@
#include <google/protobuf/util/message_differencer.h>
#include <algorithm>
+#include <functional>
#include <memory>
#include <utility>
-#include <google/protobuf/stubs/callback.h>
-#include <google/protobuf/stubs/common.h>
#include <google/protobuf/stubs/logging.h>
+#include <google/protobuf/stubs/common.h>
#include <google/protobuf/stubs/stringprintf.h>
#include <google/protobuf/any.h>
#include <google/protobuf/io/printer.h>
@@ -52,7 +52,6 @@
#include <google/protobuf/util/field_comparator.h>
#include <google/protobuf/stubs/strutil.h>
-
// Always include as last one, otherwise it can break compilation
#include <google/protobuf/port_def.inc>
@@ -1463,7 +1462,7 @@
// Find maximum bipartite matching using the argumenting path algorithm.
class MaximumMatcher {
public:
- typedef ResultCallback2<bool, int, int> NodeMatchCallback;
+ typedef std::function<bool(int, int)> NodeMatchCallback;
// MaximumMatcher takes ownership of the passed in callback and uses it to
// determine whether a node on the left side of the bipartial graph matches
// a node on the right side. count1 is the number of nodes on the left side
@@ -1474,7 +1473,7 @@
// matched to the j-th node on the right side and match_list2[x] == y means
// the x-th node on the right side is matched to y-th node on the left side.
// match_list1[i] == -1 means the node is not matched. Same with match_list2.
- MaximumMatcher(int count1, int count2, NodeMatchCallback* callback,
+ MaximumMatcher(int count1, int count2, NodeMatchCallback callback,
std::vector<int>* match_list1, std::vector<int>* match_list2);
// Find a maximum match and return the number of matched node pairs.
// If early_return is true, this method will return 0 immediately when it
@@ -1492,7 +1491,7 @@
int count1_;
int count2_;
- std::unique_ptr<NodeMatchCallback> match_callback_;
+ NodeMatchCallback match_callback_;
std::map<std::pair<int, int>, bool> cached_match_results_;
std::vector<int>* match_list1_;
std::vector<int>* match_list2_;
@@ -1500,11 +1499,14 @@
};
MaximumMatcher::MaximumMatcher(int count1, int count2,
- NodeMatchCallback* callback,
+ NodeMatchCallback callback,
std::vector<int>* match_list1,
std::vector<int>* match_list2)
- : count1_(count1), count2_(count2), match_callback_(callback),
- match_list1_(match_list1), match_list2_(match_list2) {
+ : count1_(count1),
+ count2_(count2),
+ match_callback_(std::move(callback)),
+ match_list1_(match_list1),
+ match_list2_(match_list2) {
match_list1_->assign(count1, -1);
match_list2_->assign(count2, -1);
}
@@ -1536,7 +1538,7 @@
if (it != cached_match_results_.end()) {
return it->second;
}
- cached_match_results_[p] = match_callback_->Run(left, right);
+ cached_match_results_[p] = match_callback_(left, right);
return cached_match_results_[p];
}
@@ -1605,10 +1607,12 @@
// doesn't necessarily imply Compare(b, c). Therefore a naive greedy
// algorithm will fail to find a maximum matching.
// Here we use the augmenting path algorithm.
- MaximumMatcher::NodeMatchCallback* callback = ::google::protobuf::NewPermanentCallback(
- this, &MessageDifferencer::IsMatch, repeated_field, key_comparator,
- &message1, &message2, parent_fields, nullptr);
- MaximumMatcher matcher(count1, count2, callback, match_list1, match_list2);
+ auto callback = [&](int i1, int i2) {
+ return IsMatch(repeated_field, key_comparator, &message1, &message2,
+ parent_fields, nullptr, i1, i2);
+ };
+ MaximumMatcher matcher(count1, count2, std::move(callback), match_list1,
+ match_list2);
// If diff info is not needed, we should end the matching process as
// soon as possible if not all items can be matched.
bool early_return = (reporter == nullptr);
diff --git a/src/google/protobuf/util/message_differencer.h b/src/google/protobuf/util/message_differencer.h
index e249b76..dd4267b 100644
--- a/src/google/protobuf/util/message_differencer.h
+++ b/src/google/protobuf/util/message_differencer.h
@@ -112,11 +112,11 @@
// unpacks Any::value into a Message and compares its individual fields.
// Messages encoded in a repeated Any cannot be compared using TreatAsMap.
//
-//
// Note on thread-safety: MessageDifferencer is *not* thread-safe. You need to
// guard it with a lock to use the same MessageDifferencer instance from
// multiple threads. Note that it's fine to call static comparison methods
-// (like MessageDifferencer::Equals) concurrently.
+// (like MessageDifferencer::Equals) concurrently, but it's not recommended for
+// performance critical code as it leads to extra allocations.
class PROTOBUF_EXPORT MessageDifferencer {
public:
// Determines whether the supplied messages are equal. Equality is defined as
diff --git a/src/google/protobuf/util/time_util.cc b/src/google/protobuf/util/time_util.cc
index 68a3e67..e615627 100644
--- a/src/google/protobuf/util/time_util.cc
+++ b/src/google/protobuf/util/time_util.cc
@@ -37,8 +37,6 @@
#include <google/protobuf/duration.pb.h>
#include <google/protobuf/timestamp.pb.h>
-
-
#include <google/protobuf/port_def.inc>
namespace google {
diff --git a/src/google/protobuf/util/type_resolver_util.cc b/src/google/protobuf/util/type_resolver_util.cc
index b652f9f..35736f1 100644
--- a/src/google/protobuf/util/type_resolver_util.cc
+++ b/src/google/protobuf/util/type_resolver_util.cc
@@ -37,7 +37,6 @@
#include <google/protobuf/util/internal/utility.h>
#include <google/protobuf/util/type_resolver.h>
#include <google/protobuf/stubs/strutil.h>
-
#include <google/protobuf/stubs/status.h>
// clang-format off
diff --git a/src/google/protobuf/wire_format_lite.cc b/src/google/protobuf/wire_format_lite.cc
index b48815e..f2017da 100644
--- a/src/google/protobuf/wire_format_lite.cc
+++ b/src/google/protobuf/wire_format_lite.cc
@@ -37,15 +37,17 @@
#include <stack>
#include <string>
#include <vector>
+
#include <google/protobuf/stubs/logging.h>
#include <google/protobuf/stubs/common.h>
#include <google/protobuf/stubs/stringprintf.h>
-#include <google/protobuf/io/coded_stream_inl.h>
+#include <google/protobuf/io/coded_stream.h>
#include <google/protobuf/io/zero_copy_stream.h>
#include <google/protobuf/io/zero_copy_stream_impl_lite.h>
-#include <google/protobuf/port_def.inc>
+#include <google/protobuf/port_def.inc>
+
namespace google {
namespace protobuf {
namespace internal {
@@ -551,8 +553,7 @@
inline static bool ReadBytesToString(io::CodedInputStream* input,
std::string* value) {
uint32 length;
- return input->ReadVarint32(&length) &&
- input->InternalReadStringInline(value, length);
+ return input->ReadVarint32(&length) && input->ReadString(value, length);
}
bool WireFormatLite::ReadBytes(io::CodedInputStream* input,
diff --git a/src/google/protobuf/wrappers.pb.cc b/src/google/protobuf/wrappers.pb.cc
index 8cb2094..8408732 100644
--- a/src/google/protobuf/wrappers.pb.cc
+++ b/src/google/protobuf/wrappers.pb.cc
@@ -64,7 +64,7 @@
}
PROTOBUF_EXPORT ::PROTOBUF_NAMESPACE_ID::internal::SCCInfo<0> scc_info_BoolValue_google_2fprotobuf_2fwrappers_2eproto =
- {{ATOMIC_VAR_INIT(::PROTOBUF_NAMESPACE_ID::internal::SCCInfoBase::kUninitialized), 0, InitDefaultsscc_info_BoolValue_google_2fprotobuf_2fwrappers_2eproto}, {}};
+ {{ATOMIC_VAR_INIT(::PROTOBUF_NAMESPACE_ID::internal::SCCInfoBase::kUninitialized), 0, 0, InitDefaultsscc_info_BoolValue_google_2fprotobuf_2fwrappers_2eproto}, {}};
static void InitDefaultsscc_info_BytesValue_google_2fprotobuf_2fwrappers_2eproto() {
GOOGLE_PROTOBUF_VERIFY_VERSION;
@@ -78,7 +78,7 @@
}
PROTOBUF_EXPORT ::PROTOBUF_NAMESPACE_ID::internal::SCCInfo<0> scc_info_BytesValue_google_2fprotobuf_2fwrappers_2eproto =
- {{ATOMIC_VAR_INIT(::PROTOBUF_NAMESPACE_ID::internal::SCCInfoBase::kUninitialized), 0, InitDefaultsscc_info_BytesValue_google_2fprotobuf_2fwrappers_2eproto}, {}};
+ {{ATOMIC_VAR_INIT(::PROTOBUF_NAMESPACE_ID::internal::SCCInfoBase::kUninitialized), 0, 0, InitDefaultsscc_info_BytesValue_google_2fprotobuf_2fwrappers_2eproto}, {}};
static void InitDefaultsscc_info_DoubleValue_google_2fprotobuf_2fwrappers_2eproto() {
GOOGLE_PROTOBUF_VERIFY_VERSION;
@@ -92,7 +92,7 @@
}
PROTOBUF_EXPORT ::PROTOBUF_NAMESPACE_ID::internal::SCCInfo<0> scc_info_DoubleValue_google_2fprotobuf_2fwrappers_2eproto =
- {{ATOMIC_VAR_INIT(::PROTOBUF_NAMESPACE_ID::internal::SCCInfoBase::kUninitialized), 0, InitDefaultsscc_info_DoubleValue_google_2fprotobuf_2fwrappers_2eproto}, {}};
+ {{ATOMIC_VAR_INIT(::PROTOBUF_NAMESPACE_ID::internal::SCCInfoBase::kUninitialized), 0, 0, InitDefaultsscc_info_DoubleValue_google_2fprotobuf_2fwrappers_2eproto}, {}};
static void InitDefaultsscc_info_FloatValue_google_2fprotobuf_2fwrappers_2eproto() {
GOOGLE_PROTOBUF_VERIFY_VERSION;
@@ -106,7 +106,7 @@
}
PROTOBUF_EXPORT ::PROTOBUF_NAMESPACE_ID::internal::SCCInfo<0> scc_info_FloatValue_google_2fprotobuf_2fwrappers_2eproto =
- {{ATOMIC_VAR_INIT(::PROTOBUF_NAMESPACE_ID::internal::SCCInfoBase::kUninitialized), 0, InitDefaultsscc_info_FloatValue_google_2fprotobuf_2fwrappers_2eproto}, {}};
+ {{ATOMIC_VAR_INIT(::PROTOBUF_NAMESPACE_ID::internal::SCCInfoBase::kUninitialized), 0, 0, InitDefaultsscc_info_FloatValue_google_2fprotobuf_2fwrappers_2eproto}, {}};
static void InitDefaultsscc_info_Int32Value_google_2fprotobuf_2fwrappers_2eproto() {
GOOGLE_PROTOBUF_VERIFY_VERSION;
@@ -120,7 +120,7 @@
}
PROTOBUF_EXPORT ::PROTOBUF_NAMESPACE_ID::internal::SCCInfo<0> scc_info_Int32Value_google_2fprotobuf_2fwrappers_2eproto =
- {{ATOMIC_VAR_INIT(::PROTOBUF_NAMESPACE_ID::internal::SCCInfoBase::kUninitialized), 0, InitDefaultsscc_info_Int32Value_google_2fprotobuf_2fwrappers_2eproto}, {}};
+ {{ATOMIC_VAR_INIT(::PROTOBUF_NAMESPACE_ID::internal::SCCInfoBase::kUninitialized), 0, 0, InitDefaultsscc_info_Int32Value_google_2fprotobuf_2fwrappers_2eproto}, {}};
static void InitDefaultsscc_info_Int64Value_google_2fprotobuf_2fwrappers_2eproto() {
GOOGLE_PROTOBUF_VERIFY_VERSION;
@@ -134,7 +134,7 @@
}
PROTOBUF_EXPORT ::PROTOBUF_NAMESPACE_ID::internal::SCCInfo<0> scc_info_Int64Value_google_2fprotobuf_2fwrappers_2eproto =
- {{ATOMIC_VAR_INIT(::PROTOBUF_NAMESPACE_ID::internal::SCCInfoBase::kUninitialized), 0, InitDefaultsscc_info_Int64Value_google_2fprotobuf_2fwrappers_2eproto}, {}};
+ {{ATOMIC_VAR_INIT(::PROTOBUF_NAMESPACE_ID::internal::SCCInfoBase::kUninitialized), 0, 0, InitDefaultsscc_info_Int64Value_google_2fprotobuf_2fwrappers_2eproto}, {}};
static void InitDefaultsscc_info_StringValue_google_2fprotobuf_2fwrappers_2eproto() {
GOOGLE_PROTOBUF_VERIFY_VERSION;
@@ -148,7 +148,7 @@
}
PROTOBUF_EXPORT ::PROTOBUF_NAMESPACE_ID::internal::SCCInfo<0> scc_info_StringValue_google_2fprotobuf_2fwrappers_2eproto =
- {{ATOMIC_VAR_INIT(::PROTOBUF_NAMESPACE_ID::internal::SCCInfoBase::kUninitialized), 0, InitDefaultsscc_info_StringValue_google_2fprotobuf_2fwrappers_2eproto}, {}};
+ {{ATOMIC_VAR_INIT(::PROTOBUF_NAMESPACE_ID::internal::SCCInfoBase::kUninitialized), 0, 0, InitDefaultsscc_info_StringValue_google_2fprotobuf_2fwrappers_2eproto}, {}};
static void InitDefaultsscc_info_UInt32Value_google_2fprotobuf_2fwrappers_2eproto() {
GOOGLE_PROTOBUF_VERIFY_VERSION;
@@ -162,7 +162,7 @@
}
PROTOBUF_EXPORT ::PROTOBUF_NAMESPACE_ID::internal::SCCInfo<0> scc_info_UInt32Value_google_2fprotobuf_2fwrappers_2eproto =
- {{ATOMIC_VAR_INIT(::PROTOBUF_NAMESPACE_ID::internal::SCCInfoBase::kUninitialized), 0, InitDefaultsscc_info_UInt32Value_google_2fprotobuf_2fwrappers_2eproto}, {}};
+ {{ATOMIC_VAR_INIT(::PROTOBUF_NAMESPACE_ID::internal::SCCInfoBase::kUninitialized), 0, 0, InitDefaultsscc_info_UInt32Value_google_2fprotobuf_2fwrappers_2eproto}, {}};
static void InitDefaultsscc_info_UInt64Value_google_2fprotobuf_2fwrappers_2eproto() {
GOOGLE_PROTOBUF_VERIFY_VERSION;
@@ -176,7 +176,7 @@
}
PROTOBUF_EXPORT ::PROTOBUF_NAMESPACE_ID::internal::SCCInfo<0> scc_info_UInt64Value_google_2fprotobuf_2fwrappers_2eproto =
- {{ATOMIC_VAR_INIT(::PROTOBUF_NAMESPACE_ID::internal::SCCInfoBase::kUninitialized), 0, InitDefaultsscc_info_UInt64Value_google_2fprotobuf_2fwrappers_2eproto}, {}};
+ {{ATOMIC_VAR_INIT(::PROTOBUF_NAMESPACE_ID::internal::SCCInfoBase::kUninitialized), 0, 0, InitDefaultsscc_info_UInt64Value_google_2fprotobuf_2fwrappers_2eproto}, {}};
static ::PROTOBUF_NAMESPACE_ID::Metadata file_level_metadata_google_2fprotobuf_2fwrappers_2eproto[9];
static constexpr ::PROTOBUF_NAMESPACE_ID::EnumDescriptor const** file_level_enum_descriptors_google_2fprotobuf_2fwrappers_2eproto = nullptr;
@@ -2043,8 +2043,8 @@
_internal_metadata_(nullptr) {
_internal_metadata_.MergeFrom(from._internal_metadata_);
value_.UnsafeSetDefault(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited());
- if (!from.value().empty()) {
- value_.Set(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(), from.value(),
+ if (!from._internal_value().empty()) {
+ value_.Set(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(), from._internal_value(),
GetArenaNoVirtual());
}
// @@protoc_insertion_point(copy_constructor:google.protobuf.StringValue)
@@ -2102,7 +2102,7 @@
// string value = 1;
case 1:
if (PROTOBUF_PREDICT_TRUE(static_cast<::PROTOBUF_NAMESPACE_ID::uint8>(tag) == 10)) {
- ptr = ::PROTOBUF_NAMESPACE_ID::internal::InlineGreedyStringParserUTF8(mutable_value(), ptr, ctx, "google.protobuf.StringValue.value");
+ ptr = ::PROTOBUF_NAMESPACE_ID::internal::InlineGreedyStringParserUTF8(_internal_mutable_value(), ptr, ctx, "google.protobuf.StringValue.value");
CHK_(ptr);
} else goto handle_unusual;
continue;
@@ -2140,9 +2140,9 @@
case 1: {
if (static_cast< ::PROTOBUF_NAMESPACE_ID::uint8>(tag) == (10 & 0xFF)) {
DO_(::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::ReadString(
- input, this->mutable_value()));
+ input, this->_internal_mutable_value()));
DO_(::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::VerifyUtf8String(
- this->value().data(), static_cast<int>(this->value().length()),
+ this->_internal_value().data(), static_cast<int>(this->_internal_value().length()),
::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::PARSE,
"google.protobuf.StringValue.value"));
} else {
@@ -2181,11 +2181,11 @@
// string value = 1;
if (this->value().size() > 0) {
::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::VerifyUtf8String(
- this->value().data(), static_cast<int>(this->value().length()),
+ this->_internal_value().data(), static_cast<int>(this->_internal_value().length()),
::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::SERIALIZE,
"google.protobuf.StringValue.value");
target = stream->WriteStringMaybeAliased(
- 1, this->value(), target);
+ 1, this->_internal_value(), target);
}
if (PROTOBUF_PREDICT_FALSE(_internal_metadata_.have_unknown_fields())) {
@@ -2208,7 +2208,7 @@
if (this->value().size() > 0) {
total_size += 1 +
::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::StringSize(
- this->value());
+ this->_internal_value());
}
if (PROTOBUF_PREDICT_FALSE(_internal_metadata_.have_unknown_fields())) {
@@ -2243,7 +2243,7 @@
(void) cached_has_bits;
if (from.value().size() > 0) {
- set_value(from.value());
+ _internal_set_value(from._internal_value());
}
}
@@ -2302,8 +2302,8 @@
_internal_metadata_(nullptr) {
_internal_metadata_.MergeFrom(from._internal_metadata_);
value_.UnsafeSetDefault(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited());
- if (!from.value().empty()) {
- value_.Set(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(), from.value(),
+ if (!from._internal_value().empty()) {
+ value_.Set(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(), from._internal_value(),
GetArenaNoVirtual());
}
// @@protoc_insertion_point(copy_constructor:google.protobuf.BytesValue)
@@ -2361,7 +2361,7 @@
// bytes value = 1;
case 1:
if (PROTOBUF_PREDICT_TRUE(static_cast<::PROTOBUF_NAMESPACE_ID::uint8>(tag) == 10)) {
- ptr = ::PROTOBUF_NAMESPACE_ID::internal::InlineGreedyStringParser(mutable_value(), ptr, ctx);
+ ptr = ::PROTOBUF_NAMESPACE_ID::internal::InlineGreedyStringParser(_internal_mutable_value(), ptr, ctx);
CHK_(ptr);
} else goto handle_unusual;
continue;
@@ -2399,7 +2399,7 @@
case 1: {
if (static_cast< ::PROTOBUF_NAMESPACE_ID::uint8>(tag) == (10 & 0xFF)) {
DO_(::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::ReadBytes(
- input, this->mutable_value()));
+ input, this->_internal_mutable_value()));
} else {
goto handle_unusual;
}
@@ -2436,7 +2436,7 @@
// bytes value = 1;
if (this->value().size() > 0) {
target = stream->WriteBytesMaybeAliased(
- 1, this->value(), target);
+ 1, this->_internal_value(), target);
}
if (PROTOBUF_PREDICT_FALSE(_internal_metadata_.have_unknown_fields())) {
@@ -2459,7 +2459,7 @@
if (this->value().size() > 0) {
total_size += 1 +
::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::BytesSize(
- this->value());
+ this->_internal_value());
}
if (PROTOBUF_PREDICT_FALSE(_internal_metadata_.have_unknown_fields())) {
@@ -2494,7 +2494,7 @@
(void) cached_has_bits;
if (from.value().size() > 0) {
- set_value(from.value());
+ _internal_set_value(from._internal_value());
}
}
diff --git a/src/google/protobuf/wrappers.pb.h b/src/google/protobuf/wrappers.pb.h
index f99c822..25b5b00 100644
--- a/src/google/protobuf/wrappers.pb.h
+++ b/src/google/protobuf/wrappers.pb.h
@@ -1314,6 +1314,11 @@
" future release.")
void unsafe_arena_set_allocated_value(
std::string* value);
+ private:
+ const std::string& _internal_value() const;
+ void _internal_set_value(const std::string& value);
+ std::string* _internal_mutable_value();
+ public:
// @@protoc_insertion_point(class_scope:google.protobuf.StringValue)
private:
@@ -1481,6 +1486,11 @@
" future release.")
void unsafe_arena_set_allocated_value(
std::string* value);
+ private:
+ const std::string& _internal_value() const;
+ void _internal_set_value(const std::string& value);
+ std::string* _internal_mutable_value();
+ public:
// @@protoc_insertion_point(class_scope:google.protobuf.BytesValue)
private:
@@ -1637,12 +1647,22 @@
}
inline const std::string& StringValue::value() const {
// @@protoc_insertion_point(field_get:google.protobuf.StringValue.value)
- return value_.Get();
+ return _internal_value();
}
inline void StringValue::set_value(const std::string& value) {
+ _internal_set_value(value);
+ // @@protoc_insertion_point(field_set:google.protobuf.StringValue.value)
+}
+inline std::string* StringValue::mutable_value() {
+ // @@protoc_insertion_point(field_mutable:google.protobuf.StringValue.value)
+ return _internal_mutable_value();
+}
+inline const std::string& StringValue::_internal_value() const {
+ return value_.Get();
+}
+inline void StringValue::_internal_set_value(const std::string& value) {
value_.Set(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(), value, GetArenaNoVirtual());
- // @@protoc_insertion_point(field_set:google.protobuf.StringValue.value)
}
inline void StringValue::set_value(std::string&& value) {
@@ -1664,9 +1684,8 @@
reinterpret_cast<const char*>(value), size), GetArenaNoVirtual());
// @@protoc_insertion_point(field_set_pointer:google.protobuf.StringValue.value)
}
-inline std::string* StringValue::mutable_value() {
+inline std::string* StringValue::_internal_mutable_value() {
- // @@protoc_insertion_point(field_mutable:google.protobuf.StringValue.value)
return value_.Mutable(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(), GetArenaNoVirtual());
}
inline std::string* StringValue::release_value() {
@@ -1714,12 +1733,22 @@
}
inline const std::string& BytesValue::value() const {
// @@protoc_insertion_point(field_get:google.protobuf.BytesValue.value)
- return value_.Get();
+ return _internal_value();
}
inline void BytesValue::set_value(const std::string& value) {
+ _internal_set_value(value);
+ // @@protoc_insertion_point(field_set:google.protobuf.BytesValue.value)
+}
+inline std::string* BytesValue::mutable_value() {
+ // @@protoc_insertion_point(field_mutable:google.protobuf.BytesValue.value)
+ return _internal_mutable_value();
+}
+inline const std::string& BytesValue::_internal_value() const {
+ return value_.Get();
+}
+inline void BytesValue::_internal_set_value(const std::string& value) {
value_.Set(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(), value, GetArenaNoVirtual());
- // @@protoc_insertion_point(field_set:google.protobuf.BytesValue.value)
}
inline void BytesValue::set_value(std::string&& value) {
@@ -1741,9 +1770,8 @@
reinterpret_cast<const char*>(value), size), GetArenaNoVirtual());
// @@protoc_insertion_point(field_set_pointer:google.protobuf.BytesValue.value)
}
-inline std::string* BytesValue::mutable_value() {
+inline std::string* BytesValue::_internal_mutable_value() {
- // @@protoc_insertion_point(field_mutable:google.protobuf.BytesValue.value)
return value_.Mutable(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(), GetArenaNoVirtual());
}
inline std::string* BytesValue::release_value() {