[f-spot/cleanup-backend: 1/8] cleanup IBrowsableItem and IBrowsableItemVersion



commit d145c0f5ce2db952d96ab22383cc37907e6d742b
Author: Mike Gemünde <mike gemuende de>
Date:   Fri Jul 9 10:41:33 2010 +0200

    cleanup IBrowsableItem and IBrowsableItemVersion
    
    The both interfaces are cleaned up a bit to go ahead and make more use
    of this interfaces. In particular, the property Versions is added to IBrowsableItem,
    because it seems not to make sense to have this in IBrowsableItemVersionable for the
    following reasons:
    (1) DefaultVersion is still contained in IBrowsableItem
    (2) IBrowsableItemVersionable lets expect that it provides access to add or remove
        versions and not to just access them. (This must still be added)

 src/Core/FileBrowsableItem.cs     |    6 ++-
 src/Core/IBrowsableItem.cs        |   84 +++++++++++++++++++++++++-----------
 src/Core/IBrowsableItemVersion.cs |   61 ++++++++++++++++++++++++---
 src/Import/FileImportSource.cs    |    1 +
 4 files changed, 119 insertions(+), 33 deletions(-)
---
diff --git a/src/Core/FileBrowsableItem.cs b/src/Core/FileBrowsableItem.cs
index 4f619bb..c016745 100644
--- a/src/Core/FileBrowsableItem.cs
+++ b/src/Core/FileBrowsableItem.cs
@@ -11,7 +11,7 @@
 
 using System;
 using System.IO;
-using System.Collections;
+using System.Collections.Generic;
 using System.Xml;
 
 using Hyena;
@@ -68,6 +68,10 @@ namespace FSpot {
 
         public IBrowsableItemVersion DefaultVersion { get; private set; }
 
+		public IEnumerable<IBrowsableItemVersion> Versions {
+			get { yield return DefaultVersion; }
+		}
+
         private string description;
         public string Description {
             get {
diff --git a/src/Core/IBrowsableItem.cs b/src/Core/IBrowsableItem.cs
index ab9ecfc..47b09c1 100644
--- a/src/Core/IBrowsableItem.cs
+++ b/src/Core/IBrowsableItem.cs
@@ -1,37 +1,69 @@
 /*
- * FSpot.IBrowsableItem.cs
+ * IBrowsableItem.cs
  * 
  * Author(s):
- *	Larry Ewing <lewing novell com>
+ *  Larry Ewing <lewing novell com>
+ *  Mike Gemuende <mike gemuende de>
  *
  * This is free software. See COPYING for details.
  */
 
+using System.Collections.Generic;
+
+using Hyena;
+
+
 namespace FSpot
 {
-	public interface IBrowsableItem {
-		System.DateTime Time {
-			get;
-		}
-		
-		Tag [] Tags {
-			get;
-		}
-
-		IBrowsableItemVersion DefaultVersion {
-			get;
-		}
-
-		string Description {
-			get;
-		}
-
-		string Name {
-			get; 
-		}
-
-		uint Rating {
-			get; 
-		}
+
+	public interface IBrowsableItem
+	{
+
+#region Metadata
+
+		/// <summary>
+		///    The time the item was created.
+		/// </summary>
+		System.DateTime Time { get; }
+
+		/// <summary>
+		///    The tags which are dedicated to this item.
+		/// </summary>
+		Tag [] Tags { get; }
+
+		/// <summary>
+		///    The description of the item.
+		/// </summary>
+		string Description { get; }
+
+		/// <summary>
+		///    The name of the item.
+		/// </summary>
+		string Name { get; }
+
+		/// <summary>
+		///    The rating which is dedicted to this item. It should only range from 0 to 5.
+		/// </summary>
+		uint Rating { get; }
+
+#endregion
+
+
+#region Versioning
+
+		/// <summary>
+		///    The default version of this item. Every item must have at least one version and this must not be
+		///    <see langref="null"/>
+		/// </summary>
+		IBrowsableItemVersion DefaultVersion { get; }
+
+		/// <summary>
+		///    All versions of this item. Since every item must have at least the default version, this enumeration
+		///    must not be empty.
+		/// </summary>
+		IEnumerable<IBrowsableItemVersion> Versions { get; }
+
+#endregion
+
 	}
 }
diff --git a/src/Core/IBrowsableItemVersion.cs b/src/Core/IBrowsableItemVersion.cs
index eec8682..f0e5e00 100644
--- a/src/Core/IBrowsableItemVersion.cs
+++ b/src/Core/IBrowsableItemVersion.cs
@@ -1,13 +1,62 @@
+/*
+ * IBrowsableItemVersion.cs
+ * 
+ * Author(s):
+ *  Ruben Vermeersch <ruben savanne be>
+ *  Mike Gemuende <mike gemuende de>
+ *
+ * This is free software. See COPYING for details.
+ */
+
 using Hyena;
 
+
 namespace FSpot
 {
-    public interface IBrowsableItemVersion : ILoadable {
-        string Name { get; }
-        bool IsProtected { get; }
-        SafeUri BaseUri { get; }
-        string Filename { get; }
 
+	public interface IBrowsableItemVersion : ILoadable
+	{
+
+#region Metadata
+
+		/// <summary>
+		///   The name of the version. e.g. "Convert to Black and White"
+		/// </summary>
+		/// <remarks>
+		///   This is not the name of the file.
+		/// </remarks>
+		string Name { get; }
+
+		// TODO: add Comment
+		bool IsProtected { get; }
+
+		// TODO: add more metadata
+		
+#endregion
+
+
+#region File Information
+
+		// TODO: BaseUri and Filename are just in the database scheme. Does it make sense to provide them
+		//       to the outside?
+		
+		/// <summary>
+		///   The base uri of the directory of this version. That is the whole uri without the
+		///   filename.
+		/// </summary>
+		SafeUri BaseUri { get; }
+
+		/// <summary>
+		///    The filename of this version.
+		/// </summary>
+		string Filename { get; }
+
+		// TODO: add Comment
+		// TODO: not every item is also imported. So does it make sense to have that checksum here?
+		//       (If a comment is added, include the easons for having this here!)
 		string ImportMD5 { get; }
-    }
+
+#endregion
+
+	}
 }
diff --git a/src/Import/FileImportSource.cs b/src/Import/FileImportSource.cs
index 724ad63..2be73b7 100644
--- a/src/Import/FileImportSource.cs
+++ b/src/Import/FileImportSource.cs
@@ -145,6 +145,7 @@ namespace FSpot.Import
         {
         }
 
+
         public SafeUri DestinationUri { get; set; }
 
         internal uint PhotoId { get; set; }



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