Link with C++ linker
[oweals/cde.git] / cde / programs / nsgmls / Undo.h
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 librararies 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
27 #ifndef Undo_INCLUDED
28 #define Undo_INCLUDED 1
29 #ifdef __GNUG__
30 #pragma interface
31 #endif
32
33 #include "Link.h"
34 #include "ContentToken.h"
35 #include "OpenElement.h"
36 #include "Allocator.h"
37
38 #ifdef SP_NAMESPACE
39 namespace SP_NAMESPACE {
40 #endif
41
42 class ParserState;
43 class Event;
44
45 class Undo : public Link {
46 public:
47   void *operator new(size_t sz, Allocator &alloc) { return alloc.alloc(sz); }
48   void *operator new(size_t sz) { return Allocator::allocSimple(sz); }
49   void operator delete(void *p) { Allocator::free(p); }
50   Undo();
51   virtual ~Undo();
52   virtual void undo(ParserState *) = 0;
53 private:
54   Undo(const Undo &);           // undefined
55   void operator=(const Undo &); // undefined
56 };
57
58 class UndoTransition : public Undo {
59 public:
60   UndoTransition(const MatchState &);
61   void undo(ParserState *);
62 private:
63   UndoTransition(const UndoTransition &); // undefined
64   void operator=(const UndoTransition &); // undefined
65   MatchState state_;
66 };
67
68 class UndoStartTag : public Undo {
69 public:
70   UndoStartTag();
71   void undo(ParserState *);
72 private:
73   UndoStartTag(const UndoStartTag &); // undefined
74   void operator=(const UndoStartTag &); // undefined
75 };
76
77 class UndoEndTag : public Undo {
78 public:
79   UndoEndTag(OpenElement *);
80   void undo(ParserState *);
81 private:
82   UndoEndTag(const UndoEndTag &); // undefined
83   void operator=(const UndoEndTag &); // undefined
84   Owner<OpenElement> element_;
85 };
86
87 #ifdef SP_NAMESPACE
88 }
89 #endif
90
91 #endif /* not Undo_INCLUDED */