[rygel] tracker: Query.serialize_triplets -> QueryTriplets



commit e82f225871146aa62a944eeeabc29bd25a2dc696
Author: Zeeshan Ali (Khattak) <zeeshanak gnome org>
Date:   Tue Jul 6 20:24:39 2010 +0300

    tracker: Query.serialize_triplets -> QueryTriplets
    
    Move Query.serialize_triplets to QueryTriplets as 'serialize'.

 .../tracker/rygel-tracker-query-triplets.vala      |   21 +++++++++++++++++
 src/plugins/tracker/rygel-tracker-query.vala       |   24 +-------------------
 2 files changed, 22 insertions(+), 23 deletions(-)
---
diff --git a/src/plugins/tracker/rygel-tracker-query-triplets.vala b/src/plugins/tracker/rygel-tracker-query-triplets.vala
index fbda3d7..2d3e095 100644
--- a/src/plugins/tracker/rygel-tracker-query-triplets.vala
+++ b/src/plugins/tracker/rygel-tracker-query-triplets.vala
@@ -38,6 +38,27 @@ public class Rygel.TrackerQueryTriplets : ArrayList<TrackerQueryTriplet> {
         }
     }
 
+    public string serialize () {
+        string str = "";
+        var include_subject = true;
+
+        for (int i = 0; i < this.size; i++) {
+            str += this[i].to_string (include_subject);
+
+            if (i < this.size - 1) {
+                include_subject = this[i].subject != this[i + 1].subject;
+
+                if (include_subject) {
+                    str += " . ";
+                } else {
+                    str += " ; ";
+                }
+            }
+        }
+
+        return str;
+    }
+
     // FIXME: Remove this method and override 'add' method from the base class
     //        instead once bug#623685 is fixed.
     public void add_triplet (TrackerQueryTriplet triplet) {
diff --git a/src/plugins/tracker/rygel-tracker-query.vala b/src/plugins/tracker/rygel-tracker-query.vala
index 7d0a155..b9db4ed 100644
--- a/src/plugins/tracker/rygel-tracker-query.vala
+++ b/src/plugins/tracker/rygel-tracker-query.vala
@@ -38,28 +38,6 @@ public abstract class Rygel.TrackerQuery {
     // Deriving classes should override this method and complete it by
     // adding the first part of the query
     public virtual string to_string () {
-        return this.serialize_triplets (this.triplets);
-    }
-
-    private string serialize_triplets (TrackerQueryTriplets triplets) {
-        string str = "";
-        var include_subject = true;
-
-        for (int i = 0; i < triplets.size; i++) {
-            str += triplets[i].to_string (include_subject);
-
-            if (i < triplets.size - 1) {
-                include_subject = triplets[i].subject !=
-                                  triplets[i + 1].subject;
-
-                if (include_subject) {
-                    str += " . ";
-                } else {
-                    str += " ; ";
-                }
-            }
-        }
-
-        return str;
+        return this.triplets.serialize ();
     }
 }



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]