[california/wip/725792-quick-add] Clean up terminology



commit ea25b5120913fdeddc6b4d2e26fb22b7bd4394e0
Author: Jim Nelson <jim yorba org>
Date:   Mon Apr 21 17:16:35 2014 -0700

    Clean up terminology

 src/calendar/calendar-wall-time.vala        |    9 +++++----
 src/component/component-details-parser.vala |   21 +++++++++++++--------
 2 files changed, 18 insertions(+), 12 deletions(-)
---
diff --git a/src/calendar/calendar-wall-time.vala b/src/calendar/calendar-wall-time.vala
index a4621c1..d013811 100644
--- a/src/calendar/calendar-wall-time.vala
+++ b/src/calendar/calendar-wall-time.vala
@@ -139,10 +139,11 @@ public class WallTime : BaseObject, Gee.Comparable<WallTime>, Gee.Hashable<WallT
      * Attempt to convert a string into { link WallTime}.
      *
      * 24-hour and 12-hour time is recognized, as are localized versions of AM and PM.  If the time
-     * was "liberally" parsed (in other words, "8" is converted to 8am), the returned flag is set.
+     * was "liberally" parsed (in other words, "8" is converted to 8am), the returned flag is
+     * cleared.
      */
-    public static WallTime? parse(string str, out bool liberally_parsed) {
-        liberally_parsed = false;
+    public static WallTime? parse(string str, out bool strictly_parsed) {
+        strictly_parsed = false;
         
         string token = str.strip().casefold();
         if (String.is_empty(token))
@@ -196,7 +197,7 @@ public class WallTime : BaseObject, Gee.Comparable<WallTime>, Gee.Hashable<WallT
         if (!meridiem_unknown && pm)
             h += 12;
         
-        liberally_parsed = meridiem_unknown;
+        strictly_parsed = !meridiem_unknown;
         
         return new WallTime(h, 0, 0);
     }
diff --git a/src/component/component-details-parser.vala b/src/component/component-details-parser.vala
index 6e6a722..2882a0e 100644
--- a/src/component/component-details-parser.vala
+++ b/src/component/component-details-parser.vala
@@ -57,7 +57,9 @@ public class DetailsParser : BaseObject {
     private StringBuilder summary = new StringBuilder();
     private StringBuilder location = new StringBuilder();
     private Calendar.WallTime? start_time = null;
+    private bool start_time_strict = true;
     private Calendar.WallTime? end_time = null;
+    private bool end_time_strict = true;
     private Calendar.Date? start_date = null;
     private Calendar.Date? end_date = null;
     private Calendar.Duration? duration = null;
@@ -258,13 +260,13 @@ public class DetailsParser : BaseObject {
         if (date != null && add_date(date))
             return true;
         
-        bool liberally_parsed;
+        bool strictly_parsed;
         Calendar.WallTime? wall_time = Calendar.WallTime.parse(specifier.casefolded,
-            out liberally_parsed);
-        if (wall_time != null && liberally_parsed && strict)
+            out strictly_parsed);
+        if (wall_time != null && !strictly_parsed && strict)
             return false;
         
-        return (wall_time != null) ? add_wall_time(wall_time) : false;
+        return (wall_time != null) ? add_wall_time(wall_time, strictly_parsed) : false;
     }
     
     // Add a duration to the event if not already specified and an end time has not already been
@@ -318,13 +320,16 @@ public class DetailsParser : BaseObject {
     }
     
     // Adds a time to the event, start time first, then end time, dropping thereafter
-    private bool add_wall_time(Calendar.WallTime wall_time) {
-        if (start_time == null)
+    private bool add_wall_time(Calendar.WallTime wall_time, bool strictly_parsed) {
+        if (start_time == null) {
             start_time = wall_time;
-        else if (end_time == null)
+            start_time_strict = strictly_parsed;
+        } else if (end_time == null) {
             end_time = wall_time;
-        else
+            end_time_strict = strictly_parsed;
+        } else {
             return false;
+        }
         
         return true;
     }


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