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

Unified Diff: lib/protobuf/runtime/ProtobufEnum.dart

Issue 10595002: Protocol Buffer runtime library and 'protoc' plugin (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Work around http://code.google.com/p/dart/issues/detail?id=3806 Created 8 years, 6 months 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « lib/protobuf/runtime/Protobuf.dart ('k') | lib/protobuf/runtime/Protobuf_client.dart » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: lib/protobuf/runtime/ProtobufEnum.dart
diff --git a/lib/protobuf/runtime/ProtobufEnum.dart b/lib/protobuf/runtime/ProtobufEnum.dart
new file mode 100644
index 0000000000000000000000000000000000000000..5edf066d914f37d24685dcef36d3e8c149b5962b
--- /dev/null
+++ b/lib/protobuf/runtime/ProtobufEnum.dart
@@ -0,0 +1,23 @@
+// 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.
+class ProtobufEnum {
+ final int _index;
+ final int _value;
+ final String _name;
+
+ const ProtobufEnum(this._index, this._value, this._name);
+
+ static Map<int, ProtobufEnum> initByValue(List<ProtobufEnum> byIndex) {
+ Map<int, ProtobufEnum> byValue = new Map<int, Dynamic>();
+ for (ProtobufEnum v in byIndex) {
+ byValue[v.value] = v;
+ }
+ return byValue;
+ }
+
+ int hashCode() => _value;
+ String get name() => _name;
+ int get value() => _value;
+ int get index() => _index;
+}
« no previous file with comments | « lib/protobuf/runtime/Protobuf.dart ('k') | lib/protobuf/runtime/Protobuf_client.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698