nsgmls: remove register keyword
[oweals/cde.git] / cde / programs / nsgmls / SgmlParser.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 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: SgmlParser.h /main/1 1996/07/29 17:04:16 cde-hp $ */
24 // Copyright (c) 1994 James Clark
25 // See the file COPYING for copying permission.
26
27 #ifndef SgmlParser_INCLUDED
28 #define SgmlParser_INCLUDED 1
29
30 #ifdef __GNUG__
31 #pragma interface
32 #endif
33
34 #include "StringC.h"
35 #include "Ptr.h"
36 #include "Location.h"
37 #include "EntityManager.h"
38
39 #include <signal.h>
40
41 #ifdef SP_NAMESPACE
42 namespace SP_NAMESPACE {
43 #endif
44
45 class Event;
46 class Parser;
47 class UnivCharsetDesc;
48 class EventHandler;
49 struct ParserOptions;
50 template<class T> class Ptr;
51 template<class T> class ConstPtr;
52 class InputSourceOrigin;
53 class Sd;
54 class Syntax;
55 class Dtd;
56
57 class SP_API SgmlParser {
58 public:
59   struct SP_API Params {
60     enum EntityType {
61       document,
62       subdoc,
63       dtd
64     };
65     Params();
66     EntityType entityType;      // defaults to document
67     StringC sysid;              // must be specified
68     Ptr<InputSourceOrigin> origin;
69     Ptr<EntityManager> entityManager;
70     const UnivCharsetDesc *initialCharset;
71     const SgmlParser *parent;
72     ConstPtr<Sd> sd;
73     ConstPtr<Syntax> prologSyntax;
74     ConstPtr<Syntax> instanceSyntax;
75     unsigned subdocLevel;
76     const ParserOptions *options;
77     PackedBoolean subdocInheritActiveLinkTypes;
78     // referenced subdocs count against SUBDOC limit in SGML declaration
79     PackedBoolean subdocReferenced;
80     StringC doctypeName;
81   };
82   SgmlParser();                 // must call init
83   SgmlParser(const Params &params);
84   void init(const Params &params);
85   ~SgmlParser();
86   Event *nextEvent();
87   void parseAll(EventHandler &,
88                 SP_CONST SP_VOLATILE sig_atomic_t *cancelPtr = 0);
89   ConstPtr<Sd> sd() const;
90   ConstPtr<Syntax> instanceSyntax() const;
91   ConstPtr<Syntax> prologSyntax() const;
92   const EntityManager &entityManager() const;
93   const EntityCatalog &entityCatalog() const;
94   const ParserOptions &options() const;
95   // Only to be called after the parse has ended.
96   Ptr<Dtd> baseDtd();
97   void activateLinkType(const StringC &);
98   void allLinkTypesActivated();
99   void swap(SgmlParser &);
100   friend class Parser;
101 private:
102   SgmlParser(const SgmlParser &);
103   void operator=(const SgmlParser &);
104   Parser *parser_;
105 };
106
107 #ifdef SP_NAMESPACE
108 }
109 #endif
110
111 #endif /* not SgmlParser_INCLUDED */