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

Annotation of /trunk/libxmltv/Interfaces/Interfaces.cs

Parent Directory Parent Directory | Revision Log Revision Log


Revision 137 - (hide annotations) (download)
Wed Mar 13 16:59:40 2013 UTC (7 years, 7 months ago) by william
File size: 10294 byte(s)

1 william 10 using System;
2     using System.Collections.Generic;
3     using System.Linq;
4     using System.Text;
5 william 11 using System.IO;
6 william 22 using System.Xml.Linq;
7 william 26 using libxmltv.Core;
8 william 54 using System.ComponentModel;
9 william 90 using System.Collections;
10 william 92 using System.Runtime.InteropServices;
11 william 10
12     namespace libxmltv.Interfaces
13     {
14 william 72 //public interface IXMLTVLoader
15     //{
16     // FileInfo XmlFile { get; }
17     // string XmlDoc { get; }
18     //}
19     //public interface IXMLTVParser
20     //{
21     // IXMLTVSource Source { get; }
22     // Dictionary<string, IXMLTVChannel> Channels { get; }
23     // Dictionary<int, IXMLTVProgram> Programs { get; }
24     //}
25 william 25
26 william 120 public interface IXMLTVSource : IDataSourceBindable
27 william 25 {
28     string SourceName { get; }
29     string GeneratorName { get; }
30     string GeneratorUrl { get; }
31     string ToString();
32     }
33 william 120
34 william 128 public interface IProgramDefinitionList : IList<IProgramDefinition>, IDataSourceSortable, IDataSourceFilterable { }
35     public interface IChannelDefintionList : IList<IChannelDefintion>, IDataSourceSortable, IDataSourceFilterable { }
36    
37    
38     public interface IChannelDefintion
39     {
40     string ChannelId { get; }
41     string ChannelName { get; }
42     }
43     public interface IProgramDefinition
44     {
45     //string ChannelId { get; }
46 william 137 int ChannelNumber { get; } // column index: 0
47     string ChannelName { get; }// column index: 1
48     DateTime Start { get; }// column index: 2
49     DateTime Stop { get; }// column index: 3
50     string Title { get; }// column index: 4
51     string SubTitle { get; }// column index: 5
52     string Description { get; }// column index: 6
53 william 128 }
54 william 118 public interface IXMLTVChannel
55 william 26 {
56 william 28 string Id { get; }
57 william 97 //int Number { get; }
58     //string CallSign { get; }
59     //string Name { get; }
60 william 118 IPropertyList MetaData { get; }
61 william 28 string ToString();
62 william 64 }
63 william 120 public interface IXMLTVProgram
64 william 86 {
65 william 118 IPropertyDictionary MetaData { get; }
66 william 120 ExtraList GetExtraMetaData();
67 william 86 }
68 william 117
69 william 118 public interface IExtraMetaData : IExtraMetaData<string, string> { }
70     public interface IExtraMetaData<TKey, TValue> : IPropertyValuePair<TKey, TValue>
71 william 110 {
72     XElement AsXElement();
73     }
74 william 120
75 william 128 //public interface IDataConverter { object ConvertObjectData(object source); }
76     //public interface IDataConverter<T>
77     //{
78     // T ConvertData(object source);
79     //}
80     public interface IDataSourceBindable //: IDataConverter
81 william 120 {
82 william 128 object CreateBindableDataSource(out Type type);
83 william 120 }
84    
85 william 125 public interface IDataSourceFilterable
86     {
87 william 126 void Filter(ref object source, params string[] args);
88 william 125 }
89     public interface IDataSourceSortable
90     {
91 william 131 void Sort(ref object source, bool descending, params string[] args);
92 william 125 }
93    
94 william 117 internal interface IXMLTVProgramCollection : IXMLTVDictionaryCollection<string, IXMLTVProgram> { }
95     internal interface IXMLTVChannelCollection : IXMLTVDictionaryCollection<string, IXMLTVChannel> { }
96     internal interface IXMLTVDictionaryCollection<TKey, TValue> { Dictionary<TKey, TValue> Collection { get; } }
97     internal interface IXMLTVListCollection<TValue> { List<TValue> Collection { get; } }
98 william 72
99 william 117 internal interface IXMLTVHandler : IXMLTVHandler<object> { }
100     internal interface IXMLTVHandler<T> { T Handler { get; } }
101 william 73
102 william 72 //public interface IXMLTVBase : IXMLTVBase<object> { }
103 william 117 internal interface IXMLTVBase<T> : IGetInstance<T>, IXMLTVHandler { }
104     internal interface IXMLTVRuntimeInstance : IOnInstanceCreated
105 william 72 {
106     bool IsAborting { get; }
107     //FileInfo XmlFile { get; }
108     string XmlFile_Name { get; }
109     string XmlFile_FullName { get; }
110     string XmlDoc { get; }
111 william 77 IXMLTVSource Source { get; }
112 william 120 ChannelList Channels { get; }
113     ProgramList Programs { get; }
114     ExtraList ExtraEntries { get; }
115 william 72 }
116 william 117 internal interface IXMLTVSerializer : IXMLTVSerializer<object> { }
117     internal interface IXMLTVSerializer<T>
118 william 49 {
119     bool Serialize(string file);
120     bool Serialize(Stream stream);
121 william 50 T DeSerialize(string file, out bool status);
122     T DeSerialize(Stream stream, out bool status);
123 william 49 }
124 william 117 internal interface IXMLTV<INTERFACE, CLASS> : IXMLTV<INTERFACE, CLASS, EventArgs> where CLASS : class,INTERFACE { }
125     internal interface IXMLTV<INTERFACE, CLASS, INSTANCECREATED_EVENTAGS> : IXMLTVSerializer<INTERFACE>, IDestroyInstance, IOnInstanceCreated, IGetInstance<INTERFACE>, ISetInstance<INTERFACE>
126 william 50 where CLASS : class,INTERFACE
127 william 64 where INSTANCECREATED_EVENTAGS : EventArgs { }
128 william 72
129 william 117 internal interface IInstance : IInstance<object> { }
130     internal interface IInstance<T> { T Instance { get; set; } }
131     internal interface ICreateSerializer : ICreateSerializer<object> { }
132     internal interface ICreateSerializer<CLASS> { IXMLTVSerializer<CLASS> CreateSerializer(); }
133 william 72
134     //public interface IGetInstanceT : IGetInstanceT<object> { }
135     //public interface IGetInstanceT<T> { T GetInstance<T>(); }
136 william 117 internal interface IGetInstance : IGetInstance<object> { }
137     internal interface IGetInstance<T> { T GetInstance(); }
138 william 72
139 william 117 internal interface ISetInstance : ISetInstance<object> { }
140     internal interface ISetInstance<T> { void SetInstance(T instance); }
141 william 90
142 william 117 internal interface IOnInstanceCreated : IOnInstanceCreated<EventArgs> { }
143     internal interface IOnInstanceCreated<T> where T : EventArgs { EventHandler<T> OnInstanceCreated { get; set; } }
144     internal interface ISerializer<T> { IXMLTVSerializer<T> Serializer { get; } }
145     internal interface IDestroyInstance { void DestroyInstance(); }
146     internal interface IGetCreatedInstanceEvent : IGetCreatedInstanceEvent<EventArgs> { }
147     internal interface IGetCreatedInstanceEvent<T> where T : EventArgs { EventHandler<T> GetOnInstanceCreated(); }
148     internal interface ISetCreatedInstanceEvent : ISetCreatedInstanceEvent<EventArgs> { }
149     internal interface ISetCreatedInstanceEvent<T> where T : EventArgs { void SetOnInstanceCreated(EventHandler<T> event_instance); }
150     internal interface IRuntimeInstanceLoader : IRuntimeInstanceLoader<object> { }
151     internal interface IRuntimeInstanceLoader<T> { T LoadFromInstance(T instance); }
152 william 90
153 william 117
154 william 91 #region Property Dictionary support
155 william 118 public interface IPropertyDictionary : IPropertyDictionary<string, object> { }
156 william 105 public interface IPropertyDictionary<TKey, TValue> : IPropertyCollection<IPropertyValuePair<TKey, TValue>>, IEnumerable<IPropertyValuePair<TKey, TValue>>, IEnumerable
157 william 90 {
158     IPropertyCollection<TKey> PropertyKeys { get; }
159     IPropertyCollection<TValue> PropertyValues { get; }
160     TValue this[TKey key] { get; set; }
161     void AddProperty(TKey key, TValue value);
162     bool ContainsProperty(TKey key);
163     bool RemoveProperty(TKey key);
164     bool TryGetPropertyValue(TKey key, out TValue value);
165     }
166     public interface IPropertyCollection<T> : IEnumerable<T>, IEnumerable
167     {
168     int PropertyCount { get; }
169     bool IsReadOnly { get; }
170     void AddProperty(T item);
171     void ClearProperties();
172     bool ContainsProperty(T item);
173     void CopyPropertiesTo(T[] array, int arrayIndex);
174     bool RemoveProperty(T item);
175 william 106 string ToString();
176 william 90 }
177     #endregion
178 william 92 #region Property List support
179 william 97 public interface IPropertyList : IPropertyList<string, object> { }
180 william 105 public interface IPropertyList<TKey, TValue> : IPropertyCollection<IPropertyValuePair<TKey, TValue>>, IEnumerable<IPropertyValuePair<TKey, TValue>>, IEnumerable
181 william 92 {
182 william 105 IPropertyValuePair<TKey, TValue> this[int index] { get; set; }
183     IEnumerable<IPropertyValuePair<TKey, TValue>> this[TKey name] { get; }//set; }
184 william 100
185 william 105 int IndexOfProperty(IPropertyValuePair<TKey, TValue> item);
186     void InsertPropertyAtIndex(int index, IPropertyValuePair<TKey, TValue> item);
187 william 92 void RemovePropertyAt(int index);
188 william 97
189     bool ContainsProperty(TKey name, TValue value);
190     void AddProperty(TKey name, TValue value);
191 william 106 void RemoveProperty(TKey TKey, TValue value);
192 william 92 }
193     #endregion
194    
195     #region PropertyValuePair support
196 william 105
197 william 118 public interface IPropertyValuePair : IPropertyValuePair<string, object> { }
198 william 105 public interface IPropertyValuePair<TKey, TValue>
199 william 92 {
200 william 105 TKey Name { get; }
201     TValue Value { get; }
202 william 106 string ToString();
203 william 105 }
204 william 110 [Serializable]
205 william 105 internal class PropertyValuePair : PropertyValuePair<string, object>, IPropertyValuePair
206     {
207 william 97 public PropertyValuePair() :base() { }
208     public PropertyValuePair(string name, object value) : base(name,value) { }
209     }
210 william 110 [Serializable]
211 william 105 internal class PropertyValuePair<TKey, TValue> : IPropertyValuePair<TKey,TValue>
212 william 97 {
213 william 92 #region KeyValuePair support
214 william 105 public static implicit operator PropertyValuePair<TKey, TValue>(KeyValuePair<TKey, TValue> i) { return new PropertyValuePair<TKey, TValue>(i.Key, i.Value); }
215 william 92 public static implicit operator KeyValuePair<TKey, TValue>(PropertyValuePair<TKey, TValue> i) { return new KeyValuePair<TKey, TValue>(i.Name, i.Value); }
216     #endregion
217 william 97 public PropertyValuePair() : this(default(TKey),default(TValue)) { }
218 william 92 public PropertyValuePair(TKey name, TValue value)
219     {
220     this.name = name;
221     this.value = value;
222     }
223     private TKey name;
224     public TKey Name { get { return this.name; } }
225     private TValue value;
226     public TValue Value { get { return this.value; } }
227     public override string ToString()
228     {
229     StringBuilder builder = new StringBuilder();
230     builder.Append('[');
231     if (this.Name != null)
232     {
233     builder.Append(this.Name.ToString());
234     }
235     builder.Append(", ");
236     if (this.Value != null)
237     {
238     builder.Append(this.Value.ToString());
239     }
240     builder.Append(']');
241     return builder.ToString();
242    
243     }
244     }
245     #endregion
246    
247 william 28 }

  ViewVC Help
Powered by ViewVC 1.1.22