| OLD | NEW |
| 1 // Copyright (c) 2013, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2013, the Dart project authors. Please see the AUTHORS file |
| 2 // for details. All rights reserved. Use of this source code is governed by a | 2 // for details. All rights reserved. Use of this source code is governed by a |
| 3 // BSD-style license that can be found in the LICENSE file. | 3 // BSD-style license that can be found in the LICENSE file. |
| 4 | 4 |
| 5 part of protoc; | 5 part of protoc; |
| 6 | 6 |
| 7 class ProtobufField { | 7 class ProtobufField { |
| 8 static final RegExp HEX_LITERAL_REGEX = | 8 static final RegExp HEX_LITERAL_REGEX = |
| 9 new RegExp(r'^0x[0-9a-f]+$', multiLine: false, caseSensitive: false); | 9 new RegExp(r'^0x[0-9a-f]+$', multiLine: false, caseSensitive: false); |
| 10 static final RegExp INTEGER_LITERAL_REGEX = new RegExp(r'^[+-]?[0-9]+$'); | 10 static final RegExp INTEGER_LITERAL_REGEX = new RegExp(r'^[+-]?[0-9]+$'); |
| (...skipping 354 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 365 | 365 |
| 366 // For groups, use capitalization of 'typeName' rather than 'name'. | 366 // For groups, use capitalization of 'typeName' rather than 'name'. |
| 367 if (codedStreamType == 'Group') { | 367 if (codedStreamType == 'Group') { |
| 368 String name = _field.typeName; | 368 String name = _field.typeName; |
| 369 int index = name.lastIndexOf('.'); | 369 int index = name.lastIndexOf('.'); |
| 370 if (index != -1) { | 370 if (index != -1) { |
| 371 name = name.substring(index + 1); | 371 name = name.substring(index + 1); |
| 372 } | 372 } |
| 373 return underscoresToCamelCase(name); | 373 return underscoresToCamelCase(name); |
| 374 } | 374 } |
| 375 var name = context.options.fieldNameOption(fqname); | 375 var name = context.options.fieldNameOverrides[fqname]; |
| 376 return (name != null) ? name : underscoresToCamelCase(_field.name); | 376 return name != null ? name : underscoresToCamelCase(_field.name); |
| 377 } | 377 } |
| 378 | 378 |
| 379 int get wireType { | 379 int get wireType { |
| 380 switch (_field.type) { | 380 switch (_field.type) { |
| 381 case FieldDescriptorProto_Type.TYPE_INT32: | 381 case FieldDescriptorProto_Type.TYPE_INT32: |
| 382 case FieldDescriptorProto_Type.TYPE_INT64: | 382 case FieldDescriptorProto_Type.TYPE_INT64: |
| 383 case FieldDescriptorProto_Type.TYPE_UINT32: | 383 case FieldDescriptorProto_Type.TYPE_UINT32: |
| 384 case FieldDescriptorProto_Type.TYPE_UINT64: | 384 case FieldDescriptorProto_Type.TYPE_UINT64: |
| 385 case FieldDescriptorProto_Type.TYPE_SINT32: | 385 case FieldDescriptorProto_Type.TYPE_SINT32: |
| 386 case FieldDescriptorProto_Type.TYPE_SINT64: | 386 case FieldDescriptorProto_Type.TYPE_SINT64: |
| (...skipping 10 matching lines...) Expand all Loading... |
| 397 return 2; // Length-delimited | 397 return 2; // Length-delimited |
| 398 case FieldDescriptorProto_Type.TYPE_GROUP: | 398 case FieldDescriptorProto_Type.TYPE_GROUP: |
| 399 return 3; // Start group | 399 return 3; // Start group |
| 400 case FieldDescriptorProto_Type.TYPE_FLOAT: | 400 case FieldDescriptorProto_Type.TYPE_FLOAT: |
| 401 case FieldDescriptorProto_Type.TYPE_FIXED32: | 401 case FieldDescriptorProto_Type.TYPE_FIXED32: |
| 402 case FieldDescriptorProto_Type.TYPE_SFIXED32: | 402 case FieldDescriptorProto_Type.TYPE_SFIXED32: |
| 403 return 5; // 32-bit | 403 return 5; // 32-bit |
| 404 } | 404 } |
| 405 } | 405 } |
| 406 } | 406 } |
| OLD | NEW |