/[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 131 - (hide annotations) (download)
Wed Mar 13 15:16:59 2013 UTC (7 years, 7 months ago) by william
File size: 10131 byte(s)
XMLTV Program(s):
* single column asending/descending support

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

  ViewVC Help
Powered by ViewVC 1.1.22