1 /*
2  * This file is part of the DOM implementation for KDE.
3  *
4  * Copyright (C) 1999 Lars Knoll (knoll@kde.org)
5  *
6  * This library is free software; you can redistribute it and/or
7  * modify it under the terms of the GNU Library General Public
8  * License as published by the Free Software Foundation; either
9  * version 2 of the License, or (at your option) any later version.
10  *
11  * This library is distributed in the hope that it will be useful,
12  * but WITHOUT ANY WARRANTY; without even the implied warranty of
13  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
14  * Library General Public License for more details.
15  *
16  * You should have received a copy of the GNU Library General Public License
17  * along with this library; see the file COPYING.LIB.  If not, write to
18  * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
19  * Boston, MA 02110-1301, USA.
20  *
21  */
22 #ifndef _DOM_dtd_h_
23 #define _DOM_dtd_h_
24 
25 #include "dom/dom_string.h"
26 #include "misc/htmlnames.h"
27 
28 #undef OPTIONAL
29 
30 namespace DOM
31 {
32 
33 void addForbidden(int tagId, ushort *forbiddenTags);
34 void removeForbidden(int tagId, ushort *forbiddenTags);
35 
36 enum tagStatus { OPTIONAL, REQUIRED, FORBIDDEN };
37 
38 bool checkIsScopeBoundary(ushort tagID);
39 bool checkChild(ushort tagID, ushort childID, bool strict = false);
40 
41 extern const unsigned short KHTML_NO_EXPORT tagPriorityArray[];
42 extern const tagStatus endTagArray[];
43 
tagPriority(quint32 tagId)44 inline unsigned short tagPriority(quint32 tagId)
45 {
46     // Treat custom elements the same as <span>; also don't read past the end of the array.
47     if (tagId > ID_LAST_TAG) {
48         return tagPriorityArray[ID_SPAN];
49     }
50     return tagPriorityArray[tagId];
51 }
52 
endTagRequirement(quint32 tagId)53 inline tagStatus endTagRequirement(quint32 tagId)
54 {
55     // Treat custom elements the same as <span>; also don't read past the end of the array.
56     if (tagId > ID_LAST_TAG) {
57         return endTagArray[ID_SPAN];
58     }
59     return endTagArray[tagId];
60 }
61 
62 } //namespace DOM
63 #endif
64