ICustomLispSerializer.cs 2.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869
  1. // $Id$
  2. using Lisp;
  3. namespace Lisp
  4. {
  5. /// <summary>
  6. /// Implement this interface to handle the seralizing
  7. /// on your own when seralizing the class.
  8. /// </summary>
  9. /// <seealso cref="ILispSerializer"/>
  10. public interface ICustomLispSerializer {
  11. /// <summary>
  12. /// Should populate the object from <paramref name="Props"/>
  13. /// </summary>
  14. /// <param name="Props">The serialized data.</param>
  15. /// <seealso cref="CustomLispWrite"/>
  16. void CustomLispRead(Properties Props);
  17. /// <summary>
  18. /// Should serialize the object to <paramref name="Writer"/>
  19. /// </summary>
  20. /// <param name="Writer">a <see cref="Lisp.Writer"/> to serialize to.</param>
  21. /// <seealso cref="CustomLispRead"/>
  22. void CustomLispWrite(Writer Writer);
  23. /// <summary>
  24. /// Called after <see cref="CustomLispRead"/>.
  25. /// </summary>
  26. /// <remarks>
  27. /// There are no examples what this should be used for (all are empty
  28. /// in the classes that implement this interface) but it is always
  29. /// called after <see cref="CustomLispRead"/> by the
  30. /// <see cref="LispReader.LispRootSerializer"/>.
  31. /// </remarks>
  32. /// <seealso cref="CustomLispRead"/>
  33. void FinishRead();
  34. }
  35. /// <summary>
  36. /// Implement this interface to handle the serializing of some other
  37. /// class or struct in a special way.
  38. /// </summary>
  39. /// <seealso cref="ICustomLispSerializer"/>
  40. /// <seealso cref="LispReader.LispCustomSerializerAttribute"/>
  41. public interface ILispSerializer {
  42. /// <summary>
  43. /// Creates an instance from the serialized object in
  44. /// <paramref name="list"/>
  45. /// </summary>
  46. /// <param name="list">The serialized object</param>
  47. /// <returns>The unserialized object</returns>
  48. /// <seealso cref="Write"/>
  49. object Read(List list);
  50. /// <summary>
  51. /// Seralizes <paramref name="Object"/> using <paramref name="writer"/>
  52. /// </summary>
  53. /// <param name="writer">
  54. /// A <see cref="Writer"/> that <paramref name="Object"/> should be
  55. /// seralized to.</param>
  56. /// <param name="name">
  57. /// Name that should be used for the serialized lisp tree.
  58. /// </param>
  59. /// <param name="Object">
  60. /// The object to write.
  61. /// </param>
  62. /// <seealso cref="Read"/>
  63. void Write(Writer writer, string name, object Object);
  64. }
  65. }