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

Contents of /trunk/libxmltv/Interfaces/Interfaces.cs

Parent Directory Parent Directory | Revision Log Revision Log


Revision 256 - (show 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 using System;
2 using System.Collections.Generic;
3 using System.Linq;
4 using System.Text;
5 using System.IO;
6 using System.Xml.Linq;
7 using libxmltv.Core;
8 using System.ComponentModel;
9 using System.Collections;
10 using System.Runtime.InteropServices;
11
12 namespace libxmltv.Interfaces
13 {
14 //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
26 public interface IXMLTVSource : IDataSourceBindable
27 {
28 string SourceName { get; }
29 string GeneratorName { get; }
30 string GeneratorUrl { get; }
31 string ToString();
32 }
33
34 public interface IRawDataSource : IRawDataSource<object> { }
35 public interface IRawDataSource<T> {
36 [Browsable(false)]
37 T RawDataSource { get; } }
38 public interface IProgramDefinitionList : IList<IProgramDefinition>, IDataSourceSortable, IDataSourceFilterable { } //, IRawDataSource<IProgramDefinitionList> { }
39 public interface IChannelDefintionList : IList<IChannelDefintion>, IDataSourceSortable, IDataSourceFilterable { }//, IRawDataSource<IChannelDefintionList> { }
40
41
42 public interface IChannelDefintion : IEquatable<IChannelDefintion>, IRawDataSource<IXMLTVChannel>
43 {
44 string ChannelId { get; }
45 string ChannelName { get; }
46 string ToString();
47 }
48 public interface IProgramDefinition : IEquatable<IProgramDefinition>, IRawDataSource<IXMLTVProgram>
49 {
50 //string ChannelId { get; }
51 int ChannelNumber { get; } // column index: 0
52 string ChannelName { get; }// column index: 1
53 string Start { get; }// column index: 2
54 string Stop { get; }// column index: 3
55 string Title { get; }// column index: 4
56 string SubTitle { get; }// column index: 5
57 string Description { get; }// column index: 6
58 string Rating { get; }// column index: 7
59 string ToString();
60 }
61 public interface IXMLTVChannel
62 {
63 string Id { get; }
64 //int Number { get; }
65 //string CallSign { get; }
66 //string Name { get; }
67 IPropertyList MetaData { get; }
68 string ToString();
69 }
70 public interface IXMLTVProgram
71 {
72 IPropertyDictionary MetaData { get; }
73 List<IExtraMetaData> GetExtraMetaData();
74 }
75
76 public interface IExtraMetaData : IExtraMetaData<string, string> { }
77 public interface IExtraMetaData<TKey, TValue> : IPropertyValuePair<TKey, TValue>
78 {
79 XElement AsXElement();
80 }
81
82 //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 {
89 object CreateBindableDataSource(out Type type);
90 }
91
92 public interface IDataSourceFilterable
93 {
94 void Filter(ref object source, params string[] args);
95 }
96 public interface IDataSourceSortable
97 {
98 void Sort(ref object source, bool descending, params string[] args);
99 }
100
101 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
106 internal interface IXMLTVHandler : IXMLTVHandler<object> { }
107 internal interface IXMLTVHandler<T> { T Handler { get; } }
108
109 //public interface IXMLTVBase : IXMLTVBase<object> { }
110 internal interface IXMLTVBase<T> : IGetInstance<T>, IXMLTVHandler { }
111 internal interface IXMLTVRuntimeInstance : IOnInstanceCreated
112 {
113 bool IsAborting { get; }
114 //FileInfo XmlFile { get; }
115 string XmlFile_Name { get; }
116 string XmlFile_FullName { get; }
117 string XmlDoc { get; }
118 IXMLTVSource Source { get; }
119 ChannelList Channels { get; }
120 ProgramList Programs { get; }
121 ExtraList ExtraEntries { get; }
122 }
123 internal interface IXMLTVSerializer : IXMLTVSerializer<object> { }
124 internal interface IXMLTVSerializer<T>
125 {
126 bool Serialize(string file);
127 bool Serialize(Stream stream);
128 T DeSerialize(string file, out bool status);
129 T DeSerialize(Stream stream, out bool status);
130 }
131 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 where CLASS : class,INTERFACE
134 where INSTANCECREATED_EVENTAGS : EventArgs { }
135
136 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
141 //public interface IGetInstanceT : IGetInstanceT<object> { }
142 //public interface IGetInstanceT<T> { T GetInstance<T>(); }
143 internal interface IGetInstance : IGetInstance<object> { }
144 internal interface IGetInstance<T> { T GetInstance(); }
145
146 internal interface ISetInstance : ISetInstance<object> { }
147 internal interface ISetInstance<T> { void SetInstance(T instance); }
148
149 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
160
161 #region Property Dictionary support
162 public interface IPropertyDictionary : IPropertyDictionary<string, object> { }
163 public interface IPropertyDictionary<TKey, TValue> : IPropertyCollection<IPropertyValuePair<TKey, TValue>>, IEnumerable<IPropertyValuePair<TKey, TValue>>, IEnumerable
164 {
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 string ToString();
183 }
184 #endregion
185 #region Property List support
186 public interface IPropertyList : IPropertyList<string, object> { }
187 public interface IPropertyList<TKey, TValue> : IPropertyCollection<IPropertyValuePair<TKey, TValue>>, IEnumerable<IPropertyValuePair<TKey, TValue>>, IEnumerable
188 {
189 IPropertyValuePair<TKey, TValue> this[int index] { get; set; }
190 IEnumerable<IPropertyValuePair<TKey, TValue>> this[TKey name] { get; }//set; }
191
192 int IndexOfProperty(IPropertyValuePair<TKey, TValue> item);
193 void InsertPropertyAtIndex(int index, IPropertyValuePair<TKey, TValue> item);
194 void RemovePropertyAt(int index);
195
196 bool ContainsProperty(TKey name, TValue value);
197 void AddProperty(TKey name, TValue value);
198 void RemoveProperty(TKey TKey, TValue value);
199 }
200 #endregion
201
202 #region PropertyValuePair support
203
204 public interface IPropertyValuePair : IPropertyValuePair<string, object> { }
205 public interface IPropertyValuePair<TKey, TValue>
206 {
207 TKey Name { get; }
208 TValue Value { get; }
209 string ToString();
210 }
211 [Serializable]
212 internal class PropertyValuePair : PropertyValuePair<string, object>, IPropertyValuePair
213 {
214 public PropertyValuePair() :base() { }
215 public PropertyValuePair(string name, object value) : base(name,value) { }
216 }
217 [Serializable]
218 internal class PropertyValuePair<TKey, TValue> : IPropertyValuePair<TKey,TValue>
219 {
220 #region KeyValuePair support
221 public static implicit operator PropertyValuePair<TKey, TValue>(KeyValuePair<TKey, TValue> i) { return new PropertyValuePair<TKey, TValue>(i.Key, i.Value); }
222 public static implicit operator KeyValuePair<TKey, TValue>(PropertyValuePair<TKey, TValue> i) { return new KeyValuePair<TKey, TValue>(i.Name, i.Value); }
223 #endregion
224 public PropertyValuePair() : this(default(TKey),default(TValue)) { }
225 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 }

  ViewVC Help
Powered by ViewVC 1.1.22