/[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 141 - (hide annotations) (download)
Thu Mar 14 13:08:20 2013 UTC (7 years, 7 months ago) by william
File size: 10348 byte(s)
+ fix datetime start/stop strings sometimes only showing the date and not the time

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

  ViewVC Help
Powered by ViewVC 1.1.22