Undo.h 2.4 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091
  1. /*
  2. * CDE - Common Desktop Environment
  3. *
  4. * Copyright (c) 1993-2012, The Open Group. All rights reserved.
  5. *
  6. * These libraries and programs are free software; you can
  7. * redistribute them and/or modify them under the terms of the GNU
  8. * Lesser General Public License as published by the Free Software
  9. * Foundation; either version 2 of the License, or (at your option)
  10. * any later version.
  11. *
  12. * These libraries and programs are distributed in the hope that
  13. * they will be useful, but WITHOUT ANY WARRANTY; without even the
  14. * implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
  15. * PURPOSE. See the GNU Lesser General Public License for more
  16. * details.
  17. *
  18. * You should have received a copy of the GNU Lesser General Public
  19. * License along with these libraries and programs; if not, write
  20. * to the Free Software Foundation, Inc., 51 Franklin Street, Fifth
  21. * Floor, Boston, MA 02110-1301 USA
  22. */
  23. /* $XConsortium: Undo.h /main/1 1996/07/29 17:07:28 cde-hp $ */
  24. // Copyright (c) 1994 James Clark
  25. // See the file COPYING for copying permission.
  26. #ifndef Undo_INCLUDED
  27. #define Undo_INCLUDED 1
  28. #ifdef __GNUG__
  29. #pragma interface
  30. #endif
  31. #include "Link.h"
  32. #include "ContentToken.h"
  33. #include "OpenElement.h"
  34. #include "Allocator.h"
  35. #ifdef SP_NAMESPACE
  36. namespace SP_NAMESPACE {
  37. #endif
  38. class ParserState;
  39. class Event;
  40. class Undo : public Link {
  41. public:
  42. void *operator new(size_t sz, Allocator &alloc) { return alloc.alloc(sz); }
  43. void *operator new(size_t sz) { return Allocator::allocSimple(sz); }
  44. void operator delete(void *p) { Allocator::free(p); }
  45. Undo();
  46. virtual ~Undo();
  47. virtual void undo(ParserState *) = 0;
  48. private:
  49. Undo(const Undo &); // undefined
  50. void operator=(const Undo &); // undefined
  51. };
  52. class UndoTransition : public Undo {
  53. public:
  54. UndoTransition(const MatchState &);
  55. void undo(ParserState *);
  56. private:
  57. UndoTransition(const UndoTransition &); // undefined
  58. void operator=(const UndoTransition &); // undefined
  59. MatchState state_;
  60. };
  61. class UndoStartTag : public Undo {
  62. public:
  63. UndoStartTag();
  64. void undo(ParserState *);
  65. private:
  66. UndoStartTag(const UndoStartTag &); // undefined
  67. void operator=(const UndoStartTag &); // undefined
  68. };
  69. class UndoEndTag : public Undo {
  70. public:
  71. UndoEndTag(OpenElement *);
  72. void undo(ParserState *);
  73. private:
  74. UndoEndTag(const UndoEndTag &); // undefined
  75. void operator=(const UndoEndTag &); // undefined
  76. Owner<OpenElement> element_;
  77. };
  78. #ifdef SP_NAMESPACE
  79. }
  80. #endif
  81. #endif /* not Undo_INCLUDED */