ActionEventArgs.cs 2.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103
  1. /// Spart License (zlib/png)
  2. ///
  3. ///
  4. /// Copyright (c) 2003 Jonathan de Halleux
  5. ///
  6. /// This software is provided 'as-is', without any express or implied warranty.
  7. /// In no event will the authors be held liable for any damages arising from
  8. /// the use of this software.
  9. ///
  10. /// Permission is granted to anyone to use this software for any purpose,
  11. /// including commercial applications, and to alter it and redistribute it
  12. /// freely, subject to the following restrictions:
  13. ///
  14. /// 1. The origin of this software must not be misrepresented; you must not
  15. /// claim that you wrote the original software. If you use this software in a
  16. /// product, an acknowledgment in the product documentation would be
  17. /// appreciated but is not required.
  18. ///
  19. /// 2. Altered source versions must be plainly marked as such, and must not be
  20. /// misrepresented as being the original software.
  21. ///
  22. /// 3. This notice may not be removed or altered from any source distribution.
  23. ///
  24. /// Author: Jonathan de Halleuxnamespace Spart.Actions
  25. namespace Spart.Actions
  26. {
  27. using System;
  28. using Spart.Parsers;
  29. /// <summary>
  30. /// Action event argument class
  31. /// </summary>
  32. public class ActionEventArgs : EventArgs
  33. {
  34. private ParserMatch m_Match;
  35. private Object m_TypeValue;
  36. /// <summary>
  37. /// Construct a new event argument instance
  38. /// </summary>
  39. /// <param name="match"></param>
  40. public ActionEventArgs(ParserMatch match)
  41. {
  42. if (match == null)
  43. throw new ArgumentNullException("match is null");
  44. if (!match.Success)
  45. throw new ArgumentException("Match is not successfull");
  46. m_Match = match;
  47. m_TypeValue = null;
  48. }
  49. /// <summary>
  50. /// Construct a new event argument instance
  51. /// </summary>
  52. /// <param name="match"></param>
  53. /// <param name="typedValue"></param>
  54. public ActionEventArgs(ParserMatch match, Object typedValue)
  55. {
  56. if (match == null)
  57. throw new ArgumentNullException("match is null");
  58. if (!match.Success)
  59. throw new ArgumentException("Match is not successfull");
  60. if (typedValue==null)
  61. throw new ArgumentNullException("typed value");
  62. m_Match = match;
  63. m_TypeValue = typedValue;
  64. }
  65. /// <summary>
  66. /// The parser match
  67. /// </summary>
  68. public ParserMatch Match
  69. {
  70. get
  71. {
  72. return m_Match;
  73. }
  74. }
  75. /// <summary>
  76. /// The parser match value
  77. /// </summary>
  78. public String Value
  79. {
  80. get
  81. {
  82. return Match.Value;
  83. }
  84. }
  85. /// <summary>
  86. /// The typed parse result
  87. /// </summary>
  88. public Object TypeValue
  89. {
  90. get
  91. {
  92. return m_TypeValue;
  93. }
  94. }
  95. }
  96. }