Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(194)

Side by Side Diff: lib/protobuf.dart

Issue 814213003: Allow constants as field initial values as well as creation thunks (Closed) Base URL: https://github.com/dart-lang/dart-protobuf@master
Patch Set: Created 6 years ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « no previous file | lib/src/protobuf/builder_info.dart » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2011, the Dart project authors. Please see the AUTHORS file 1 // Copyright (c) 2011, 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 library protobuf; 5 library protobuf;
6 6
7 import 'dart:collection' show ListMixin; 7 import 'dart:collection' show ListMixin;
8 import 'dart:convert' show JSON, Utf8Codec; 8 import 'dart:convert' show JSON, Utf8Codec;
9 import 'dart:math' as math; 9 import 'dart:math' as math;
10 import 'dart:typed_data' show TypedData, Uint8List, ByteData, Endianness; 10 import 'dart:typed_data' show TypedData, Uint8List, ByteData, Endianness;
11 11
12 import 'package:crypto/crypto.dart' show CryptoUtils; 12 import 'package:crypto/crypto.dart' show CryptoUtils;
13 import 'package:fixnum/fixnum.dart' show Int64; 13 import 'package:fixnum/fixnum.dart' show Int64;
14 14
15 part 'src/protobuf/coded_buffer_reader.dart'; 15 part 'src/protobuf/coded_buffer_reader.dart';
16 part 'src/protobuf/coded_buffer_writer.dart'; 16 part 'src/protobuf/coded_buffer_writer.dart';
17 part 'src/protobuf/builder_info.dart'; 17 part 'src/protobuf/builder_info.dart';
18 part 'src/protobuf/exceptions.dart'; 18 part 'src/protobuf/exceptions.dart';
19 part 'src/protobuf/extension.dart'; 19 part 'src/protobuf/extension.dart';
20 part 'src/protobuf/extension_registry.dart'; 20 part 'src/protobuf/extension_registry.dart';
21 part 'src/protobuf/field_info.dart'; 21 part 'src/protobuf/field_info.dart';
22 part 'src/protobuf/generated_message.dart'; 22 part 'src/protobuf/generated_message.dart';
23 part 'src/protobuf/pb_list.dart'; 23 part 'src/protobuf/pb_list.dart';
24 part 'src/protobuf/protobuf_enum.dart'; 24 part 'src/protobuf/protobuf_enum.dart';
25 part 'src/protobuf/unknown_field_set.dart'; 25 part 'src/protobuf/unknown_field_set.dart';
26 part 'src/protobuf/utils.dart'; 26 part 'src/protobuf/utils.dart';
27 part 'src/protobuf/wire_format.dart'; 27 part 'src/protobuf/wire_format.dart';
28 28
29 // TODO(sra): Remove this method when clients upgrade to protoc 0.3.5
29 Int64 makeLongInt(int n) => new Int64(n); 30 Int64 makeLongInt(int n) => new Int64(n);
30 31
32 // TODO(sra): Use Int64.parse() when available - see http://dartbug.com/21915.
33 Int64 parseLongInt(String text) {
34 if (text.startsWith('0x')) return Int64.parseHex(text.substring(2));
35 if (text.startsWith('+0x')) return Int64.parseHex(text.substring(3));
36 if (text.startsWith('-0x')) return -Int64.parseHex(text.substring(3));
37 return Int64.parseInt(text);
38 }
39
31 const _UTF8 = const Utf8Codec(allowMalformed: true); 40 const _UTF8 = const Utf8Codec(allowMalformed: true);
OLDNEW
« no previous file with comments | « no previous file | lib/src/protobuf/builder_info.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698