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

  ViewVC Help
Powered by ViewVC 1.1.22