00001 /* 00002 * Copyright 1999-2004 The Apache Software Foundation. 00003 * 00004 * Licensed under the Apache License, Version 2.0 (the "License"); 00005 * you may not use this file except in compliance with the License. 00006 * You may obtain a copy of the License at 00007 * 00008 * http://www.apache.org/licenses/LICENSE-2.0 00009 * 00010 * Unless required by applicable law or agreed to in writing, software 00011 * distributed under the License is distributed on an "AS IS" BASIS, 00012 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 00013 * See the License for the specific language governing permissions and 00014 * limitations under the License. 00015 */ 00016 #if !defined(XALANHTMLELEMENTSPROPERTIES_HEADER_GUARD_1357924680) 00017 #define XALANHTMLELEMENTSPROPERTIES_HEADER_GUARD_1357924680 00018 00019 00020 00021 // Base include file. Must be first. 00022 #include <xalanc/XMLSupport/XMLSupportDefinitions.hpp> 00023 00024 00025 00026 #include <xalanc/XalanDOM/XalanDOMString.hpp> 00027 00028 00029 00030 XALAN_CPP_NAMESPACE_BEGIN 00031 00032 00033 00034 class XALAN_XMLSUPPORT_EXPORT XalanHTMLElementsProperties 00035 { 00036 public: 00037 00038 enum { eMaxAttributes = 6, eMaxAttributeName = 8, eMaxElementName = 10 }; 00039 00040 enum eFlags 00041 { 00042 EMPTY = (1 << 1), 00043 FLOW = (1 << 2), 00044 BLOCK = (1 << 3), 00045 BLOCKFORM = (1 << 4), 00046 BLOCKFORMFIELDSET = (1 << 5), 00047 CDATA = (1 << 6), 00048 PCDATA = (1 << 7), 00049 RAW = (1 << 8), 00050 INLINE = (1 << 9), 00051 INLINEA = (1 << 10), 00052 INLINELABEL = (1 << 11), 00053 FONTSTYLE = (1 << 12), 00054 PHRASE = (1 << 13), 00055 FORMCTRL = (1 << 14), 00056 SPECIAL = (1 << 15), 00057 ASPECIAL = (1 << 16), 00058 HEADMISC = (1 << 17), 00059 HEAD = (1 << 18), 00060 LIST = (1 << 19), 00061 PREFORMATTED = (1 << 20), 00062 WHITESPACESENSITIVE = (1 << 21), 00063 HEADELEM = (1 << 22), 00064 STYLEELEM = (1 << 23), 00065 SCRIPTELEM = (1 << 24), 00066 00067 ATTRURL = (1 << 1), 00068 ATTREMPTY = (1 << 2) 00069 }; 00070 00071 struct XALAN_XMLSUPPORT_EXPORT InternalAttributeProperties 00072 { 00073 typedef unsigned char FlagsType; 00074 00075 XalanDOMChar m_name[eMaxAttributeName + 1]; 00076 00077 FlagsType m_flags; 00078 00087 bool 00088 is(FlagsType theFlags) const 00089 { 00090 return m_flags & theFlags ? true : false; 00091 } 00092 }; 00093 00094 struct XALAN_XMLSUPPORT_EXPORT InternalElementProperties 00095 { 00096 typedef InternalAttributeProperties::FlagsType AttributeFlagsType; 00097 typedef unsigned int FlagsType; 00098 00108 bool 00109 isAttribute( 00110 const XalanDOMChar* theAttributeName, 00111 AttributeFlagsType theFlags) const; 00112 00121 bool 00122 is(FlagsType theFlags) const 00123 { 00124 return m_flags & theFlags ? true : false; 00125 } 00126 00127 // Data members... 00128 XalanDOMChar m_name[eMaxElementName + 1]; 00129 00130 FlagsType m_flags; 00131 00132 InternalAttributeProperties m_attributes[eMaxAttributes + 1]; 00133 00140 const InternalAttributeProperties& 00141 findProperties(const XalanDOMChar* theAttributeName) const; 00142 00143 static const InternalAttributeProperties s_dummyProperties; 00144 }; 00145 00150 class XALAN_XMLSUPPORT_EXPORT ElementProperties 00151 { 00152 public: 00153 00154 typedef InternalElementProperties::AttributeFlagsType AttributeFlagsType; 00155 typedef InternalElementProperties::FlagsType FlagsType; 00156 00161 ElementProperties(const InternalElementProperties* theProperties = 0) : 00162 m_properties(theProperties) 00163 { 00164 } 00165 00170 ElementProperties(const ElementProperties& theSource) : 00171 m_properties(theSource.m_properties) 00172 { 00173 } 00174 00182 bool 00183 null() const 00184 { 00185 return m_properties == 0 ? true : false; 00186 } 00187 00196 bool 00197 is(FlagsType theFlags) const 00198 { 00199 return m_properties->is(theFlags); 00200 } 00201 00211 bool 00212 isAttribute( 00213 const XalanDOMChar* theAttributeName, 00214 AttributeFlagsType theFlags) const 00215 { 00216 return m_properties->isAttribute(theAttributeName, theFlags); 00217 } 00218 00219 private: 00220 00221 const InternalElementProperties* m_properties; 00222 }; 00223 00230 static ElementProperties 00231 find(const XalanDOMChar* theElementName); 00232 00233 private: 00234 00241 static const InternalElementProperties& 00242 findProperties(const XalanDOMChar* theElementName); 00243 00244 // The order of these is significant!!! 00245 00246 // The array of properties... 00247 static const InternalElementProperties s_elementProperties[]; 00248 00249 // This point to the last of the real propeties in the array. 00250 static const InternalElementProperties* const s_lastProperties; 00251 00252 // This point to the last of the properties in the array, which is 00253 // a dummy instance we return when an instance that matches the 00254 // element name cannot be found. 00255 static const InternalElementProperties* const s_dummyProperties; 00256 00257 00258 // These are undefined... 00259 XalanHTMLElementsProperties(); 00260 00261 ~XalanHTMLElementsProperties(); 00262 00263 XalanHTMLElementsProperties& 00264 operator=(const XalanHTMLElementsProperties&); 00265 00266 }; 00267 00268 00269 00270 XALAN_CPP_NAMESPACE_END 00271 00272 00273 00274 #endif // XALANHTMLELEMENTSPROPERTIES_HEADER_GUARD_1357924680
Doxygen and GraphViz are used to generate this API documentation from the Xalan-C header files.
Xalan-C++ XSLT Processor Version 1.10 |
|