| OLD | NEW |
| (Empty) | |
| 1 // Copyright (c) 2014, the Dart project authors. Please see the AUTHORS file |
| 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. |
| 4 |
| 5 library trydart.userOption; |
| 6 |
| 7 class UserOption { |
| 8 final String name; |
| 9 |
| 10 final bool isHidden; |
| 11 |
| 12 static var storage; |
| 13 |
| 14 const UserOption(this.name, {this.isHidden: false}); |
| 15 |
| 16 get value => storage[name]; |
| 17 |
| 18 void set value(newValue) { |
| 19 storage[name] = newValue; |
| 20 } |
| 21 } |
| 22 |
| 23 class BooleanUserOption extends UserOption { |
| 24 const BooleanUserOption(String name, {bool isHidden: false}) |
| 25 : super(name, isHidden: isHidden); |
| 26 |
| 27 bool get value => super.value == 'true'; |
| 28 |
| 29 void set value(bool newValue) { |
| 30 super.value = '$newValue'; |
| 31 } |
| 32 } |
| 33 |
| 34 class StringUserOption extends UserOption { |
| 35 const StringUserOption(String name, {bool isHidden: false}) |
| 36 : super(name, isHidden: isHidden); |
| 37 |
| 38 String get value => super.value == null ? '' : super.value; |
| 39 |
| 40 void set value(String newValue) { |
| 41 super.value = newValue; |
| 42 } |
| 43 } |
| OLD | NEW |