/[xmltv_parser]/trunk/libxmltv/Core/PropertyList.cs
ViewVC logotype

Annotation of /trunk/libxmltv/Core/PropertyList.cs

Parent Directory Parent Directory | Revision Log Revision Log


Revision 97 - (hide annotations) (download)
Sun Mar 10 09:43:49 2013 UTC (7 years, 5 months ago) by william
File size: 2768 byte(s)

1 william 92 using System;
2     using System.Collections.Generic;
3     using System.Linq;
4     using System.Text;
5     using libxmltv.Interfaces;
6    
7     namespace libxmltv.Core
8     {
9 william 97 public class PropertyList : PropertyList<string, object>, IPropertyList
10 william 92 {
11 william 97 public PropertyList() :base() { }
12     public PropertyList(IEnumerable<PropertyValuePair<string, object>> collection) : base(collection) { }
13     public PropertyList(int capacity) : base(capacity) { }
14     }
15     public class PropertyList<TKey, TValue> : IPropertyList<TKey, TValue>
16     {
17 william 95 private List<PropertyValuePair<TKey, TValue>> properties;
18     public PropertyList() { properties = new List<PropertyValuePair<TKey, TValue>>(); }
19     public PropertyList(IEnumerable<PropertyValuePair<TKey, TValue>> collection) { properties = new List<PropertyValuePair<TKey, TValue>>(collection); }
20     public PropertyList(int capacity) { properties = new List<PropertyValuePair<TKey, TValue>>(); }
21     public PropertyValuePair<TKey, TValue> this[int index] { get { return properties[index]; } set { properties[index] = value; } }
22     public int IndexOfProperty(PropertyValuePair<TKey, TValue> item) { return properties.IndexOf(item); }
23     public void InsertPropertyAtIndex(int index, PropertyValuePair<TKey, TValue> item) { properties.Insert(index, item); }
24     public void RemovePropertyAt(int index) { properties.RemoveAt(index); }
25     public int PropertyCount { get { return properties.Count; } }
26     public bool IsReadOnly { get { return (properties as IPropertyCollection<TKey>).IsReadOnly; } }
27     public void AddProperty(PropertyValuePair<TKey, TValue> item) { properties.Add(item); }
28     public void ClearProperties() { properties.Clear(); }
29     public bool ContainsProperty(PropertyValuePair<TKey, TValue> item) { return properties.Contains(item); }
30     public void CopyPropertiesTo(PropertyValuePair<TKey, TValue>[] array, int arrayIndex) { properties.CopyTo(array, arrayIndex); }
31     public bool RemoveProperty(PropertyValuePair<TKey, TValue> item) { return properties.Remove(item); }
32     public IEnumerator<PropertyValuePair<TKey, TValue>> GetEnumerator() { return properties.GetEnumerator(); }
33     System.Collections.IEnumerator System.Collections.IEnumerable.GetEnumerator() { return this.GetEnumerator(); }
34 william 97
35    
36     public bool ContainsProperty(TKey name, TValue value) { return ContainsProperty(new PropertyValuePair<TKey, TValue>(name, value)); }
37     public void AddProperty(TKey name, TValue value) { AddProperty(new PropertyValuePair<TKey, TValue>(name, value)); }
38     public void RemoveProperty(TKey name, TValue value) { RemoveProperty(new PropertyValuePair<TKey, TValue>(name, value)); }
39 william 92 }
40     }

  ViewVC Help
Powered by ViewVC 1.1.22