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

  ViewVC Help
Powered by ViewVC 1.1.22