/[xmltv_parser]/trunk/libxmltv/Interfaces/Interfaces.cs
ViewVC logotype

Diff of /trunk/libxmltv/Interfaces/Interfaces.cs

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

--- trunk/libxmltv/Interfaces/Interfaces.cs	2013/03/09 17:48:02	91
+++ trunk/libxmltv/Interfaces/Interfaces.cs	2013/03/10 08:21:30	92
@@ -7,6 +7,7 @@
 using libxmltv.Core;
 using System.ComponentModel;
 using System.Collections;
+using System.Runtime.InteropServices;
 
 namespace libxmltv.Interfaces
 {
@@ -101,7 +102,7 @@
 
 #region Property Dictionary support
     public interface IPropertyDictionary : IPropertyDictionary<string,object> { }
-    public interface IPropertyDictionary<TKey, TValue> : IPropertyCollection<KeyValuePair<TKey, TValue>>, IEnumerable<KeyValuePair<TKey, TValue>>, IEnumerable
+    public interface IPropertyDictionary<TKey, TValue> : IPropertyCollection<PropertyValuePair<TKey, TValue>>, IEnumerable<PropertyValuePair<TKey, TValue>>, IEnumerable
     {
         IPropertyCollection<TKey> PropertyKeys { get; }
         IPropertyCollection<TValue> PropertyValues { get; }        
@@ -122,4 +123,51 @@
         bool RemoveProperty(T item);
     }
 #endregion
+#region Property List support
+    public interface IPropertyList : IPropertyList<PropertyValuePair<string, object>> { }
+    public interface IPropertyList<T> : IPropertyCollection<T>, IEnumerable<List<T>>, IEnumerable
+    {
+        T this[int index] { get; set; }
+        int IndexOfProperty(T item);
+        void InsertPropertyAtIndex(int index, T item);
+        void RemovePropertyAt(int index);
+    }
+#endregion
+
+    #region PropertyValuePair support
+    public struct PropertyValuePair<TKey, TValue>
+    {
+        #region KeyValuePair support
+        public static implicit operator PropertyValuePair<TKey, TValue>(KeyValuePair<TKey, TValue> i) { return new PropertyValuePair<TKey, TValue>(i.Key, i.Value); }
+        public static implicit operator KeyValuePair<TKey, TValue>(PropertyValuePair<TKey, TValue> i) { return new KeyValuePair<TKey, TValue>(i.Name, i.Value); }
+        #endregion
+        public PropertyValuePair(TKey name, TValue value)
+        {
+            this.name = name;
+            this.value = value;
+        }
+        private TKey name;
+        public TKey Name { get { return this.name; } }
+        private TValue value;
+        public TValue Value { get { return this.value; } }
+        public override string ToString()
+        {
+            StringBuilder builder = new StringBuilder();
+            builder.Append('[');
+            if (this.Name != null)
+            {
+                builder.Append(this.Name.ToString());
+            }
+            builder.Append(", ");
+            if (this.Value != null)
+            {
+                builder.Append(this.Value.ToString());
+            }
+            builder.Append(']');
+            return builder.ToString();
+
+        }
+    }
+    #endregion
+
 }
\ No newline at end of file

 

  ViewVC Help
Powered by ViewVC 1.1.22