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; |
+} |