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.

79 lines
2.6 KiB

  1. using System;
  2. using System.Collections.Generic;
  3. using System.Linq;
  4. using System.Text;
  5. using System.Threading.Tasks;
  6. namespace IPA.Config.Data
  7. {
  8. /// <summary>
  9. /// A <see cref="Value"/> representing a piece of text. The only reason this is not named
  10. /// String is so that it doesn't conflict with <see cref="string"/>.
  11. /// </summary>
  12. public sealed class Text : Value
  13. {
  14. /// <summary>
  15. /// The actual value of this <see cref="Text"/> object.
  16. /// </summary>
  17. public string Value { get; set; }
  18. /// <summary>
  19. /// Converts this <see cref="Data.Value"/> into a human-readable format.
  20. /// </summary>
  21. /// <returns>a quoted, unescaped string form of <see cref="Value"/></returns>
  22. public override string ToString() => $"\"{Value}\"";
  23. }
  24. /// <summary>
  25. /// A <see cref="Value"/> representing an integer. This may hold a <see cref="long"/>'s
  26. /// worth of data.
  27. /// </summary>
  28. public sealed class Integer : Value
  29. {
  30. /// <summary>
  31. /// The actual value of the <see cref="Integer"/> object.
  32. /// </summary>
  33. public long Value { get; set; }
  34. /// <summary>
  35. /// Converts this <see cref="Data.Value"/> into a human-readable format.
  36. /// </summary>
  37. /// <returns>the result of <c>Value.ToString()</c></returns>
  38. public override string ToString() => Value.ToString();
  39. }
  40. /// <summary>
  41. /// A <see cref="Value"/> representing a floating point value. This may hold a
  42. /// <see cref="double"/>'s worth of data.
  43. /// </summary>
  44. public sealed class FloatingPoint : Value
  45. {
  46. /// <summary>
  47. /// The actual value fo this <see cref="FloatingPoint"/> object.
  48. /// </summary>
  49. public double Value { get; set; }
  50. /// <summary>
  51. /// Converts this <see cref="Data.Value"/> into a human-readable format.
  52. /// </summary>
  53. /// <returns>the result of <c>Value.ToString()</c></returns>
  54. public override string ToString() => Value.ToString();
  55. }
  56. /// <summary>
  57. /// A <see cref="Value"/> representing a boolean value.
  58. /// </summary>
  59. public sealed class Boolean : Value
  60. {
  61. /// <summary>
  62. /// The actual value fo this <see cref="Boolean"/> object.
  63. /// </summary>
  64. public bool Value { get; set; }
  65. /// <summary>
  66. /// Converts this <see cref="Data.Value"/> into a human-readable format.
  67. /// </summary>
  68. /// <returns>the result of <c>Value.ToString().ToLower()</c></returns>
  69. public override string ToString() => Value.ToString().ToLower();
  70. }
  71. }