/[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 254 - (hide annotations) (download)
Wed Apr 17 21:55:30 2013 UTC (7 years, 6 months ago) by william
File size: 10761 byte(s)
+ update binding source so that we can get an instance of the raw data

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

  ViewVC Help
Powered by ViewVC 1.1.22