/[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 256 - (hide annotations) (download)
Sat May 18 02:45:35 2013 UTC (6 years, 6 months ago) by william
File size: 10799 byte(s)
hide member: IRawDataSource<T>.RawDataSource using: [Browsable(false)]

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

  ViewVC Help
Powered by ViewVC 1.1.22