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

  ViewVC Help
Powered by ViewVC 1.1.22