Assignment for RMIT Mixed Reality in 2020
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

54 lines
2.0 KiB

  1. namespace Oculus.Platform.Models
  2. {
  3. using UnityEngine;
  4. using System.Collections;
  5. using System.Collections.Generic;
  6. using Oculus.Platform.Models;
  7. public class DeserializableList<T> : IList<T>
  8. {
  9. //IList
  10. public int Count { get {return _Data.Count;} }
  11. bool ICollection<T>.IsReadOnly { get {return ((IList<T>)_Data).IsReadOnly;} } //if you insist in getting it...
  12. public int IndexOf(T obj) {return _Data.IndexOf(obj);}
  13. public T this[int index] { get{return _Data[index];} set{_Data[index] = value;} }
  14. public void Add(T item) {_Data.Add(item);}
  15. public void Clear() {_Data.Clear();}
  16. public bool Contains(T item) {return _Data.Contains(item);}
  17. public void CopyTo(T[] array, int arrayIndex) {_Data.CopyTo(array, arrayIndex);}
  18. public IEnumerator<T> GetEnumerator() {return _Data.GetEnumerator();}
  19. public void Insert(int index, T item) {_Data.Insert(index, item);}
  20. public bool Remove(T item) {return _Data.Remove(item);}
  21. public void RemoveAt(int index) {_Data.RemoveAt(index);}
  22. // taken from examples here: https://msdn.microsoft.com/en-us/library/s793z9y2(v=vs.110).aspx
  23. private IEnumerator GetEnumerator1()
  24. {
  25. return this.GetEnumerator();
  26. }
  27. IEnumerator IEnumerable.GetEnumerator()
  28. {
  29. return GetEnumerator1();
  30. }
  31. // Internals and getters
  32. // Seems like Obsolete properties are broken in this version of Mono.
  33. // Anyway, don't use this.
  34. [System.Obsolete("Use IList interface on the DeserializableList object instead.", false)]
  35. public List<T> Data {
  36. get {return _Data;}
  37. }
  38. protected List<T> _Data;
  39. protected string _NextUrl;
  40. protected string _PreviousUrl;
  41. public bool HasNextPage { get { return !System.String.IsNullOrEmpty(NextUrl); } }
  42. public bool HasPreviousPage { get { return !System.String.IsNullOrEmpty(PreviousUrl); } }
  43. public string NextUrl { get { return _NextUrl; } }
  44. public string PreviousUrl { get { return _PreviousUrl; } }
  45. }
  46. }