00001 /* 00002 * Licensed to the Apache Software Foundation (ASF) under one 00003 * or more contributor license agreements. See the NOTICE file 00004 * distributed with this work for additional information 00005 * regarding copyright ownership. The ASF licenses this file 00006 * to you under the Apache License, Version 2.0 (the "License"); 00007 * you may not use this file except in compliance with the License. 00008 * You may obtain a copy of the License at 00009 * 00010 * http://www.apache.org/licenses/LICENSE-2.0 00011 * 00012 * Unless required by applicable law or agreed to in writing, software 00013 * distributed under the License is distributed on an "AS IS" BASIS, 00014 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 00015 * See the License for the specific language governing permissions and 00016 * limitations under the License. 00017 */ 00018 #if !defined(XALANHTMLELEMENTSPROPERTIES_HEADER_GUARD_1357924680) 00019 #define XALANHTMLELEMENTSPROPERTIES_HEADER_GUARD_1357924680 00020 00021 00022 00023 // Base include file. Must be first. 00024 #include <xalanc/XMLSupport/XMLSupportDefinitions.hpp> 00025 00026 00027 00028 #include <xalanc/XalanDOM/XalanDOMString.hpp> 00029 00030 00031 00032 XALAN_CPP_NAMESPACE_BEGIN 00033 00034 00035 00036 class XALAN_XMLSUPPORT_EXPORT XalanHTMLElementsProperties 00037 { 00038 public: 00039 00040 enum { eMaxAttributes = 6, eMaxAttributeName = 8, eMaxElementName = 10 }; 00041 00042 enum eFlags 00043 { 00044 EMPTY = (1 << 1), 00045 FLOW = (1 << 2), 00046 BLOCK = (1 << 3), 00047 BLOCKFORM = (1 << 4), 00048 BLOCKFORMFIELDSET = (1 << 5), 00049 CDATA = (1 << 6), 00050 PCDATA = (1 << 7), 00051 RAW = (1 << 8), 00052 INLINE = (1 << 9), 00053 INLINEA = (1 << 10), 00054 INLINELABEL = (1 << 11), 00055 FONTSTYLE = (1 << 12), 00056 PHRASE = (1 << 13), 00057 FORMCTRL = (1 << 14), 00058 SPECIAL = (1 << 15), 00059 ASPECIAL = (1 << 16), 00060 HEADMISC = (1 << 17), 00061 HEAD = (1 << 18), 00062 LIST = (1 << 19), 00063 PREFORMATTED = (1 << 20), 00064 WHITESPACESENSITIVE = (1 << 21), 00065 HEADELEM = (1 << 22), 00066 STYLEELEM = (1 << 23), 00067 SCRIPTELEM = (1 << 24), 00068 00069 ATTRURL = (1 << 1), 00070 ATTREMPTY = (1 << 2) 00071 }; 00072 00073 struct XALAN_XMLSUPPORT_EXPORT InternalAttributeProperties 00074 { 00075 typedef unsigned char FlagsType; 00076 00077 XalanDOMChar m_name[eMaxAttributeName + 1]; 00078 00079 FlagsType m_flags; 00080 00081 /** 00082 * Check if particular properties are set for this 00083 * instance. See the eFlag enum for the valid 00084 * properties. 00085 * 00086 * @param theFlags The properties to check. 00087 * @return true if the property is set, false if not 00088 */ 00089 bool 00090 is(FlagsType theFlags) const 00091 { 00092 return m_flags & theFlags ? true : false; 00093 } 00094 }; 00095 00096 struct XALAN_XMLSUPPORT_EXPORT InternalElementProperties 00097 { 00098 typedef InternalAttributeProperties::FlagsType AttributeFlagsType; 00099 typedef unsigned int FlagsType; 00100 00101 /** 00102 * Check if particular attribute properties are set 00103 * for this instance. See the eFlag enum for the valid 00104 * properties. 00105 * 00106 * @param theAttributeName The attribute name. 00107 * @param theFlags The properties to check. 00108 * @return true if the property is set, false if not 00109 */ 00110 bool 00111 isAttribute( 00112 const XalanDOMChar* theAttributeName, 00113 AttributeFlagsType theFlags) const; 00114 00115 /** 00116 * Check if particular properties are set for this 00117 * instance. See the eFlag enum for the valid 00118 * properties. 00119 * 00120 * @param theFlags The properties to check. 00121 * @return true if the property is set, false if not 00122 */ 00123 bool 00124 is(FlagsType theFlags) const 00125 { 00126 return m_flags & theFlags ? true : false; 00127 } 00128 00129 // Data members... 00130 XalanDOMChar m_name[eMaxElementName + 1]; 00131 00132 FlagsType m_flags; 00133 00134 InternalAttributeProperties m_attributes[eMaxAttributes + 1]; 00135 00136 /** 00137 * Find an instance with the given attribute name. 00138 * 00139 * @param theAttributeName The attribute name. 00140 * @return A reference to an instance. 00141 */ 00142 const InternalAttributeProperties& 00143 findProperties(const XalanDOMChar* theAttributeName) const; 00144 00145 static const InternalAttributeProperties s_dummyProperties; 00146 }; 00147 00148 /** 00149 * This class acts as a proxy for an InternalElementProperties 00150 * instance. 00151 */ 00152 class XALAN_XMLSUPPORT_EXPORT ElementProperties 00153 { 00154 public: 00155 00156 typedef InternalElementProperties::AttributeFlagsType AttributeFlagsType; 00157 typedef InternalElementProperties::FlagsType FlagsType; 00158 00159 /** 00160 * Constructor 00161 * @param theProperties The instance for which this one is a proxy. 00162 */ 00163 ElementProperties(const InternalElementProperties* theProperties = 0) : 00164 m_properties(theProperties) 00165 { 00166 } 00167 00168 /** 00169 * Copy constructor 00170 * @param theSource The source instance for the copy. 00171 */ 00172 ElementProperties(const ElementProperties& theSource) : 00173 m_properties(theSource.m_properties) 00174 { 00175 } 00176 00177 /** 00178 * Determine if this is a non-null instance. You 00179 * must call this before calling any member functions, 00180 * if you think the instance may be null. 00181 * 00182 * @return true if the instance is null, false if not 00183 */ 00184 bool 00185 null() const 00186 { 00187 return m_properties == 0 ? true : false; 00188 } 00189 00190 /** 00191 * Check if particular properties are set for this 00192 * instance. See the eFlag enum for the valid 00193 * properties. 00194 * 00195 * @param theFlags The properties to check. 00196 * @return true if the property is set, false if not 00197 */ 00198 bool 00199 is(FlagsType theFlags) const 00200 { 00201 return m_properties->is(theFlags); 00202 } 00203 00204 /** 00205 * Check if particular attribute properties are set 00206 * for this instance. See the eFlag enum for the valid 00207 * properties. 00208 * 00209 * @param theAttributeName The attribute name. 00210 * @param theFlags The properties to check. 00211 * @return true if the property is set, false if not 00212 */ 00213 bool 00214 isAttribute( 00215 const XalanDOMChar* theAttributeName, 00216 AttributeFlagsType theFlags) const 00217 { 00218 return m_properties->isAttribute(theAttributeName, theFlags); 00219 } 00220 00221 /** 00222 * Get the name of the element. 00223 * 00224 * @return The name of the element. 00225 */ 00226 const XalanDOMChar* 00227 getName() const 00228 { 00229 return m_properties->m_name; 00230 } 00231 00232 private: 00233 00234 const InternalElementProperties* m_properties; 00235 }; 00236 00237 /** 00238 * Find an instance with the given name. 00239 * 00240 * @param theElementName The element name. 00241 * @return A reference to an instance. 00242 */ 00243 static ElementProperties 00244 find(const XalanDOMChar* theElementName); 00245 00246 private: 00247 00248 /** 00249 * Find an instance with the given name. 00250 * 00251 * @param theElementName The element name. 00252 * @return A reference to an instance. 00253 */ 00254 static const InternalElementProperties& 00255 findProperties(const XalanDOMChar* theElementName); 00256 00257 // The order of these is significant!!! 00258 00259 // The array of properties... 00260 static const InternalElementProperties s_elementProperties[]; 00261 00262 // This point to the last of the real propeties in the array. 00263 static const InternalElementProperties* const s_lastProperties; 00264 00265 // This point to the last of the properties in the array, which is 00266 // a dummy instance we return when an instance that matches the 00267 // element name cannot be found. 00268 static const InternalElementProperties* const s_dummyProperties; 00269 00270 00271 // These are undefined... 00272 XalanHTMLElementsProperties(); 00273 00274 ~XalanHTMLElementsProperties(); 00275 00276 XalanHTMLElementsProperties& 00277 operator=(const XalanHTMLElementsProperties&); 00278 00279 }; 00280 00281 00282 00283 XALAN_CPP_NAMESPACE_END 00284 00285 00286 00287 #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.11 |
|