/[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/07 05:48:51	11
+++ trunk/libxmltv/Interfaces/Interfaces.cs	2013/05/18 02:45:35	256
@@ -3,11 +3,252 @@
 using System.Linq;
 using System.Text;
 using System.IO;
+using System.Xml.Linq;
+using libxmltv.Core;
+using System.ComponentModel;
+using System.Collections;
+using System.Runtime.InteropServices;
 
 namespace libxmltv.Interfaces
 {
-    public interface IXMLTV_LOADER
+    //public interface IXMLTVLoader
+    //{
+    //    FileInfo XmlFile { get; }
+    //    string XmlDoc { get; }
+    //}
+    //public interface IXMLTVParser
+    //{
+    //    IXMLTVSource Source { get; }
+    //    Dictionary<string, IXMLTVChannel> Channels { get; }
+    //    Dictionary<int, IXMLTVProgram> Programs { get; }
+    //}
+
+    public interface IXMLTVSource : IDataSourceBindable
+    {
+        string SourceName { get; }
+        string GeneratorName { get; }
+        string GeneratorUrl { get; }
+        string ToString();
+    }
+
+    public interface IRawDataSource : IRawDataSource<object> { }
+    public interface IRawDataSource<T> {
+         [Browsable(false)]
+        T RawDataSource { get; } }
+    public interface IProgramDefinitionList : IList<IProgramDefinition>, IDataSourceSortable, IDataSourceFilterable { } //, IRawDataSource<IProgramDefinitionList> { }
+    public interface IChannelDefintionList : IList<IChannelDefintion>, IDataSourceSortable, IDataSourceFilterable { }//, IRawDataSource<IChannelDefintionList> { }
+
+
+    public interface IChannelDefintion : IEquatable<IChannelDefintion>, IRawDataSource<IXMLTVChannel>
+    {
+        string ChannelId { get; }
+        string ChannelName { get; }
+        string ToString();
+    }
+    public interface IProgramDefinition : IEquatable<IProgramDefinition>, IRawDataSource<IXMLTVProgram>
+    {
+        //string ChannelId { get;  }
+        int ChannelNumber { get; } // column index: 0
+        string ChannelName { get; }// column index: 1
+        string Start { get; }// column index: 2
+        string Stop { get; }// column index: 3
+        string Title { get; }// column index: 4
+        string SubTitle { get; }// column index: 5
+        string Description { get; }// column index: 6
+        string Rating { get; }// column index: 7
+        string ToString();
+    }
+    public interface IXMLTVChannel
+    {
+        string Id { get; }
+        //int Number { get; }
+        //string CallSign { get; }
+        //string Name { get; }    
+        IPropertyList MetaData { get; }
+        string ToString();
+    }
+    public interface IXMLTVProgram 
+    {
+        IPropertyDictionary MetaData { get; }
+        List<IExtraMetaData> GetExtraMetaData();
+    }
+
+    public interface IExtraMetaData : IExtraMetaData<string, string> { }
+    public interface IExtraMetaData<TKey, TValue> : IPropertyValuePair<TKey, TValue> 
+    {
+        XElement AsXElement();
+    }
+
+    //public interface IDataConverter { object ConvertObjectData(object source); }
+    //public interface IDataConverter<T>
+    //{
+    //    T ConvertData(object source);
+    //}
+    public interface IDataSourceBindable //: IDataConverter
+    {
+        object CreateBindableDataSource(out Type type);
+    }
+
+    public interface IDataSourceFilterable
+    {
+        void Filter(ref object source, params string[] args);
+    }
+    public interface IDataSourceSortable
+    {
+        void Sort(ref object source, bool descending, params string[] args);
+    }
+
+    internal interface IXMLTVProgramCollection : IXMLTVDictionaryCollection<string, IXMLTVProgram> { }
+    internal interface IXMLTVChannelCollection : IXMLTVDictionaryCollection<string, IXMLTVChannel> { }
+    internal interface IXMLTVDictionaryCollection<TKey, TValue> { Dictionary<TKey, TValue> Collection { get; } }
+    internal interface IXMLTVListCollection<TValue> { List<TValue> Collection { get; } }
+
+    internal interface IXMLTVHandler : IXMLTVHandler<object> { }
+    internal interface IXMLTVHandler<T> { T Handler { get; } }
+
+    //public interface IXMLTVBase : IXMLTVBase<object> { }
+    internal interface IXMLTVBase<T> : IGetInstance<T>, IXMLTVHandler { }
+    internal interface IXMLTVRuntimeInstance : IOnInstanceCreated
+    {
+        bool IsAborting { get; } 
+        //FileInfo XmlFile { get; }
+        string XmlFile_Name { get; }
+        string XmlFile_FullName { get; }
+        string XmlDoc { get; }
+        IXMLTVSource Source { get; }
+        ChannelList Channels { get; }
+        ProgramList Programs { get; }
+       ExtraList ExtraEntries { get; }
+    }
+    internal interface IXMLTVSerializer : IXMLTVSerializer<object> { }
+    internal interface IXMLTVSerializer<T>
+    {
+        bool Serialize(string file);
+        bool Serialize(Stream stream);
+        T DeSerialize(string file, out bool status);
+        T DeSerialize(Stream stream, out bool status);
+    }
+    internal interface IXMLTV<INTERFACE, CLASS> : IXMLTV<INTERFACE, CLASS, EventArgs> where CLASS : class,INTERFACE { }
+    internal interface IXMLTV<INTERFACE, CLASS, INSTANCECREATED_EVENTAGS> : IXMLTVSerializer<INTERFACE>, IDestroyInstance, IOnInstanceCreated, IGetInstance<INTERFACE>, ISetInstance<INTERFACE>
+        where CLASS : class,INTERFACE
+        where INSTANCECREATED_EVENTAGS : EventArgs { }
+
+    internal interface IInstance : IInstance<object> { }
+    internal interface IInstance<T> { T Instance { get; set; } }
+    internal interface ICreateSerializer : ICreateSerializer<object> { }
+    internal interface ICreateSerializer<CLASS> { IXMLTVSerializer<CLASS> CreateSerializer(); }
+
+    //public interface IGetInstanceT : IGetInstanceT<object> { }
+    //public interface IGetInstanceT<T> { T GetInstance<T>();  }
+    internal interface IGetInstance : IGetInstance<object> { }
+    internal interface IGetInstance<T> { T GetInstance();    }
+
+    internal interface ISetInstance : ISetInstance<object> { }
+    internal interface ISetInstance<T> { void SetInstance(T instance);    }
+
+    internal interface IOnInstanceCreated : IOnInstanceCreated<EventArgs> { }
+    internal interface IOnInstanceCreated<T> where T : EventArgs { EventHandler<T> OnInstanceCreated { get; set; } }
+    internal interface ISerializer<T> { IXMLTVSerializer<T> Serializer { get; } }
+    internal interface IDestroyInstance { void DestroyInstance();    }
+    internal interface IGetCreatedInstanceEvent : IGetCreatedInstanceEvent<EventArgs> { }
+    internal interface IGetCreatedInstanceEvent<T> where T : EventArgs { EventHandler<T> GetOnInstanceCreated();    }
+    internal interface ISetCreatedInstanceEvent : ISetCreatedInstanceEvent<EventArgs> { }
+    internal interface ISetCreatedInstanceEvent<T> where T : EventArgs { void SetOnInstanceCreated(EventHandler<T> event_instance);    }
+    internal interface IRuntimeInstanceLoader : IRuntimeInstanceLoader<object> { }
+    internal interface IRuntimeInstanceLoader<T> { T LoadFromInstance(T instance);    }
+
+
+#region Property Dictionary support
+    public interface IPropertyDictionary : IPropertyDictionary<string, object> { }
+    public interface IPropertyDictionary<TKey, TValue> : IPropertyCollection<IPropertyValuePair<TKey, TValue>>, IEnumerable<IPropertyValuePair<TKey, TValue>>, IEnumerable
     {
-        FileInfo XmlFile { get; }
+        IPropertyCollection<TKey> PropertyKeys { get; }
+        IPropertyCollection<TValue> PropertyValues { get; }        
+        TValue this[TKey key] { get; set; }                
+        void AddProperty(TKey key, TValue value);        
+        bool ContainsProperty(TKey key);        
+        bool RemoveProperty(TKey key);        
+        bool TryGetPropertyValue(TKey key, out TValue value);
     }
-}
+    public interface IPropertyCollection<T> : IEnumerable<T>, IEnumerable
+    {
+        int PropertyCount { get; }
+        bool IsReadOnly { get; }
+        void AddProperty(T item);
+        void ClearProperties();
+        bool ContainsProperty(T item);
+        void CopyPropertiesTo(T[] array, int arrayIndex);
+        bool RemoveProperty(T item);
+        string ToString();
+    }
+#endregion
+#region Property List support
+    public interface IPropertyList : IPropertyList<string, object> { }
+    public interface IPropertyList<TKey, TValue> : IPropertyCollection<IPropertyValuePair<TKey, TValue>>, IEnumerable<IPropertyValuePair<TKey, TValue>>, IEnumerable
+    {
+        IPropertyValuePair<TKey, TValue> this[int index] { get; set; }
+        IEnumerable<IPropertyValuePair<TKey, TValue>> this[TKey name] { get; }//set; }
+
+        int IndexOfProperty(IPropertyValuePair<TKey, TValue> item);
+        void InsertPropertyAtIndex(int index, IPropertyValuePair<TKey, TValue> item);
+        void RemovePropertyAt(int index);
+
+        bool ContainsProperty(TKey name, TValue value);
+        void AddProperty(TKey name, TValue value);
+        void RemoveProperty(TKey TKey, TValue value);        
+    }
+#endregion
+
+    #region PropertyValuePair support
+
+    public interface IPropertyValuePair : IPropertyValuePair<string, object>    {    }
+    public interface IPropertyValuePair<TKey, TValue>
+    {
+        TKey Name { get; }
+        TValue Value { get; }
+        string ToString();
+    }
+    [Serializable]
+    internal class PropertyValuePair : PropertyValuePair<string, object>, IPropertyValuePair
+    {
+        public PropertyValuePair() :base() { }
+        public PropertyValuePair(string name, object value) : base(name,value) { }
+    }
+    [Serializable]
+    internal class PropertyValuePair<TKey, TValue> : IPropertyValuePair<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() : this(default(TKey),default(TValue)) { }
+        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