blob: b500e512c794b944fe8b727c597ca4cf35857c9d [file] [log] [blame]
// Copyright (c) 2011, the Dart project authors. Please see the AUTHORS file
// for details. All rights reserved. Use of this source code is governed by a
// BSD-style license that can be found in the LICENSE file.
/// Runtime library for Dart implementation of [protobufs][1].
///
/// [1]: https://developers.google.com/protocol-buffers
library;
import 'dart:collection' show ListBase, MapBase;
import 'dart:convert'
show
Utf8Decoder,
Utf8Encoder,
base64Decode,
base64Encode,
jsonDecode,
jsonEncode;
import 'dart:math' as math;
import 'dart:typed_data' show ByteData, Endian, Uint8List;
import 'package:fixnum/fixnum.dart' show Int64;
import 'package:meta/meta.dart' show UseResult;
import 'src/protobuf/json_parsing_context.dart';
import 'src/protobuf/permissive_compare.dart';
import 'src/protobuf/type_registry.dart';
export 'src/protobuf/type_registry.dart' show TypeRegistry;
part 'src/protobuf/annotations.dart';
part 'src/protobuf/builder_info.dart';
part 'src/protobuf/coded_buffer.dart';
part 'src/protobuf/coded_buffer_reader.dart';
part 'src/protobuf/coded_buffer_writer.dart';
part 'src/protobuf/consts.dart';
part 'src/protobuf/exceptions.dart';
part 'src/protobuf/extension.dart';
part 'src/protobuf/extension_field_set.dart';
part 'src/protobuf/extension_registry.dart';
part 'src/protobuf/field_error.dart';
part 'src/protobuf/field_info.dart';
part 'src/protobuf/field_set.dart';
part 'src/protobuf/field_type.dart';
part 'src/protobuf/generated_message.dart';
part 'src/protobuf/generated_service.dart';
part 'src/protobuf/json.dart';
part 'src/protobuf/message_set.dart';
part 'src/protobuf/pb_list.dart';
part 'src/protobuf/pb_map.dart';
part 'src/protobuf/proto3_json.dart';
part 'src/protobuf/protobuf_enum.dart';
part 'src/protobuf/rpc_client.dart';
part 'src/protobuf/unknown_field_set.dart';
part 'src/protobuf/unpack.dart';
part 'src/protobuf/utils.dart';
part 'src/protobuf/wire_format.dart';
// TODO(sra): Use `Int64.parse()` when available:
// https://github.com/dart-lang/fixnum/issues/18.
/// @nodoc
Int64 parseLongInt(String text) {
if (text.startsWith('0x')) return Int64.parseHex(text.substring(2));
if (text.startsWith('+0x')) return Int64.parseHex(text.substring(3));
if (text.startsWith('-0x')) return -Int64.parseHex(text.substring(3));
return Int64.parseInt(text);
}