2 * CDE - Common Desktop Environment
4 * Copyright (c) 1993-2012, The Open Group. All rights reserved.
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)
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
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
23 /* $XConsortium: Sd.h /main/1 1996/07/29 17:03:44 cde-hp $ */
24 // Copyright (c) 1994 James Clark
25 // See the file COPYING for copying permission.
36 #include "CharsetInfo.h"
37 #include "ExternalId.h"
40 #include "CharsetDecl.h"
41 #include "HashTable.h"
43 // Information about the SGML declaration that is not syntax specific.
46 namespace SP_NAMESPACE {
49 class SP_API Sd : public Resource {
51 // These must be in the same order as in the SGML declaration.
60 enum { nBooleanFeature = fFORMAL + 1 };
61 // These must be in the same order as in the SGML declaration.
68 enum { nNumberFeature = fSUBDOC + 1 };
69 // These are names used only in the SGML declaration.
145 enum { nCapacity = LKNMCAP + 1 };
147 void setDocCharsetDesc(const UnivCharsetDesc &);
148 void setSgmlChar(const ISet<Char> &);
149 Boolean matchesReservedName(const StringC &, ReservedName) const;
150 int digitWeight(Char) const;
151 Boolean link() const;
152 Number simpleLink() const;
153 Boolean implicitLink() const;
154 Number explicitLink() const;
155 Boolean shorttag() const;
156 Number concur() const;
157 Boolean omittag() const;
158 Boolean rank() const;
159 Boolean datatag() const;
160 Boolean formal() const;
161 Number subdoc() const;
162 StringC reservedName(int) const;
163 Boolean lookupQuantityName(const StringC &, Syntax::Quantity &) const;
164 Boolean lookupGeneralDelimiterName(const StringC &, Syntax::DelimGeneral &)
166 Boolean lookupCapacityName(const StringC &, Sd::Capacity &) const;
167 StringC quantityName(Syntax::Quantity) const;
168 const CharsetInfo &docCharset() const;
169 Char execToDoc(char) const;
170 StringC execToDoc(const char *) const;
171 Number capacity(int) const;
172 void setCapacity(int, Number);
173 StringC capacityName(int) const;
174 Boolean scopeInstance() const;
175 void setScopeInstance();
176 void setDocCharsetDecl(CharsetDecl &);
177 const CharsetDecl &docCharsetDecl() const;
178 void setBooleanFeature(BooleanFeature, Boolean);
179 void setNumberFeature(NumberFeature, Number);
180 StringC generalDelimiterName(Syntax::DelimGeneral) const;
181 UnivChar nameToUniv(const StringC &);
183 enum { nFeature = fFORMAL + 1 };
184 PackedBoolean booleanFeature_[nBooleanFeature];
185 Number numberFeature_[nNumberFeature];
186 Number capacity_[nCapacity];
187 CharsetInfo docCharset_;
188 CharsetDecl docCharsetDecl_;
189 Boolean scopeInstance_;
190 HashTable<StringC,int> namedCharTable_;
191 static const char *const reservedName_[];
192 static const char *const generalDelimiterName_[];
193 static const char *const capacityName_[];
194 static const char *const quantityName_[];
198 Boolean Sd::link() const
200 return (numberFeature_[fSIMPLE]
201 || booleanFeature_[fIMPLICIT]
202 || numberFeature_[fEXPLICIT]);
206 Number Sd::explicitLink() const
208 return numberFeature_[fEXPLICIT];
212 Boolean Sd::implicitLink() const
214 return booleanFeature_[fIMPLICIT];
218 Number Sd::simpleLink() const
220 return numberFeature_[fSIMPLE];
224 Boolean Sd::shorttag() const
226 return booleanFeature_[fSHORTTAG];
230 Number Sd::concur() const
232 return numberFeature_[fCONCUR];
236 Number Sd::subdoc() const
238 return numberFeature_[fSUBDOC];
243 Boolean Sd::omittag() const
245 return booleanFeature_[fOMITTAG];
249 Boolean Sd::rank() const
251 return booleanFeature_[fRANK];
255 Boolean Sd::datatag() const
257 return booleanFeature_[fDATATAG];
261 Boolean Sd::formal() const
263 return booleanFeature_[fFORMAL];
267 Char Sd::execToDoc(char c) const
269 return docCharset_.execToDesc(c);
273 StringC Sd::execToDoc(const char *s) const
275 return docCharset_.execToDesc(s);
279 StringC Sd::reservedName(int i) const
281 return execToDoc(reservedName_[i]);
285 const CharsetInfo &Sd::docCharset() const
291 int Sd::digitWeight(Char c) const
293 return docCharset_.digitWeight(c);
297 Number Sd::capacity(int i) const
303 void Sd::setCapacity(int i, Number n)
309 StringC Sd::capacityName(int i) const
311 return execToDoc(capacityName_[i]);
315 Boolean Sd::scopeInstance() const
317 return scopeInstance_;
321 void Sd::setScopeInstance()
327 void Sd::setDocCharsetDecl(CharsetDecl &decl)
329 decl.swap(docCharsetDecl_);
333 const CharsetDecl &Sd::docCharsetDecl() const
335 return docCharsetDecl_;
339 void Sd::setBooleanFeature(BooleanFeature i, Boolean b)
341 booleanFeature_[i] = b;
345 void Sd::setNumberFeature(NumberFeature i, Number n)
347 numberFeature_[i] = n;
354 #endif /* Sd_INCLUDED */