/[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 125 - (hide annotations) (download)
Sun Mar 10 19:44:49 2013 UTC (7 years, 7 months ago) by william
File size: 9384 byte(s)

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

  ViewVC Help
Powered by ViewVC 1.1.22