xref: /onnv-gate/usr/src/cmd/man/src/util/nsgmls.src/lib/Undo.h (revision 0:68f95e015346)
1 // Copyright (c) 1994 James Clark
2 // See the file COPYING for copying permission.
3 #pragma ident	"%Z%%M%	%I%	%E% SMI"
4 
5 #ifndef Undo_INCLUDED
6 #define Undo_INCLUDED 1
7 #ifdef __GNUG__
8 #pragma interface
9 #endif
10 
11 #include "Link.h"
12 #include "ContentToken.h"
13 #include "OpenElement.h"
14 #include "Allocator.h"
15 
16 #ifdef SP_NAMESPACE
17 namespace SP_NAMESPACE {
18 #endif
19 
20 class ParserState;
21 class Event;
22 
23 class Undo : public Link {
24 public:
new(size_t sz,Allocator & alloc)25   void *operator new(size_t sz, Allocator &alloc) { return alloc.alloc(sz); }
new(size_t sz)26   void *operator new(size_t sz) { return Allocator::allocSimple(sz); }
delete(void * p)27   void operator delete(void *p) { Allocator::free(p); }
28   Undo();
29   virtual ~Undo();
30   virtual void undo(ParserState *) = 0;
31 private:
32   Undo(const Undo &);		// undefined
33   void operator=(const Undo &);	// undefined
34 };
35 
36 class UndoTransition : public Undo {
37 public:
38   UndoTransition(const MatchState &);
39   void undo(ParserState *);
40 private:
41   UndoTransition(const UndoTransition &); // undefined
42   void operator=(const UndoTransition &); // undefined
43   MatchState state_;
44 };
45 
46 class UndoStartTag : public Undo {
47 public:
48   UndoStartTag();
49   void undo(ParserState *);
50 private:
51   UndoStartTag(const UndoStartTag &); // undefined
52   void operator=(const UndoStartTag &);	// undefined
53 };
54 
55 class UndoEndTag : public Undo {
56 public:
57   UndoEndTag(OpenElement *);
58   void undo(ParserState *);
59 private:
60   UndoEndTag(const UndoEndTag &); // undefined
61   void operator=(const UndoEndTag &); // undefined
62   Owner<OpenElement> element_;
63 };
64 
65 #ifdef SP_NAMESPACE
66 }
67 #endif
68 
69 #endif /* not Undo_INCLUDED */
70