/[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 92 - (show annotations) (download)
Sun Mar 10 08:21:30 2013 UTC (7 years, 5 months ago) by william
File size: 7242 byte(s)

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

  ViewVC Help
Powered by ViewVC 1.1.22