Make LED pattern an abstract class, abstract parse and dump methods
authorPhilipp Zabel <philipp.zabel@gmail.com>
Thu, 27 May 2010 17:12:55 +0000 (19:12 +0200)
committerPhilipp Zabel <philipp.zabel@gmail.com>
Thu, 27 May 2010 18:55:20 +0000 (20:55 +0200)
src/led-pattern-rx44.vala
src/led-pattern-rx51.vala
src/led-pattern.vala

index 93244ee..5b9554c 100644 (file)
@@ -21,7 +21,7 @@ class LedPatternRX44 : LedPattern {
        public List<LedCommandRX44> engine_g;
        public List<LedCommandRX44> engine_b;
 
-       public bool parse (string line) {
+       public override bool parse (string line) {
                string[] key_value = line.split ("=");
 
                if (key_value.length != 2) {
@@ -71,7 +71,7 @@ class LedPatternRX44 : LedPattern {
                return list;
        }
 
-       public string dump () {
+       public override string dump () {
                return "%s=%d;%d;%d;%s;%s;%s".printf (name, priority, screen_on, timeout,
                                                      dump_pattern (engine_r), dump_pattern (engine_g), dump_pattern (engine_b));
        }
index 2c62e92..1518c4b 100644 (file)
@@ -22,7 +22,7 @@ class LedPatternRX51 : LedPattern {
        public List<LedCommandRX51> engine1;
        public List<LedCommandRX51> engine2;
 
-       public bool parse (string line) {
+       public override bool parse (string line) {
                string[] key_value = line.split ("=");
 
                if (key_value.length != 2) {
@@ -96,7 +96,7 @@ class LedPatternRX51 : LedPattern {
                return list;
        }
 
-       public string dump () {
+       public override string dump () {
                return "%s=%d;%d;%d;%s;%s;%s".printf (name, priority, screen_on, timeout, dump_led_map (),
                                                      dump_pattern (engine1), dump_pattern (engine2));
        }
index de4e393..4f9b196 100644 (file)
@@ -16,7 +16,7 @@
  * along with LED Pattern Editor. If not, see <http://www.gnu.org/licenses/>.
  */
 
-class LedPattern : Object {
+abstract class LedPattern : Object {
        enum ScreenOn {
                DISPLAY_OFF = 0,
                DISPLAY_ON = 1,
@@ -33,6 +33,9 @@ class LedPattern : Object {
 
        public double duration;
 
+       public abstract string dump ();
+       public abstract bool parse (string line);
+
        public signal void changed ();
 }