CubeSourceCollection.cs 1.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263
  1. using System;
  2. using System.Collections.Generic;
  3. using System.Text;
  4. using System.Collections;
  5. using FastReport.Utils;
  6. namespace FastReport.Data
  7. {
  8. /// <summary>
  9. /// Represents the collection of <see cref="CubeSourceBase"/> objects.
  10. /// </summary>
  11. public class CubeSourceCollection : FRCollectionBase
  12. {
  13. /// <summary>
  14. /// Gets or sets a data source.
  15. /// </summary>
  16. /// <param name="index">The index of a data source in this collection.</param>
  17. /// <returns>The data source with specified index.</returns>
  18. public CubeSourceBase this[int index]
  19. {
  20. get { return List[index] as CubeSourceBase; }
  21. set { List[index] = value; }
  22. }
  23. /// <summary>
  24. /// Finds a CubeSource by its name.
  25. /// </summary>
  26. /// <param name="name">The name of a CubeSource.</param>
  27. /// <returns>The <see cref="CubeSourceBase"/> object if found; otherwise <b>null</b>.</returns>
  28. public CubeSourceBase FindByName(string name)
  29. {
  30. foreach (CubeSourceBase c in this)
  31. {
  32. if (c.Name == name)
  33. return c;
  34. }
  35. return null;
  36. }
  37. /// <summary>
  38. /// Finds a CubeSource by its alias.
  39. /// </summary>
  40. /// <param name="alias">The alias of a CubeSource.</param>
  41. /// <returns>The <see cref="CubeSourceBase"/> object if found; otherwise <b>null</b>.</returns>
  42. public CubeSourceBase FindByAlias(string alias)
  43. {
  44. foreach (CubeSourceBase c in this)
  45. {
  46. if (c.Alias == alias)
  47. return c;
  48. }
  49. return null;
  50. }
  51. /// <summary>
  52. /// Initializes a new instance of the <see cref="CubeSourceCollection"/> class with default settings.
  53. /// </summary>
  54. /// <param name="owner">The owner of this collection.</param>
  55. public CubeSourceCollection(Base owner) : base(owner)
  56. {
  57. }
  58. }
  59. }