00001 /* 00002 * Licensed to the Apache Software Foundation (ASF) under one or more 00003 * contributor license agreements. See the NOTICE file distributed with 00004 * this work for additional information regarding copyright ownership. 00005 * The ASF licenses this file to You under the Apache License, Version 2.0 00006 * (the "License"); you may not use this file except in compliance with 00007 * the License. You may obtain a copy of the License at 00008 * 00009 * http://www.apache.org/licenses/LICENSE-2.0 00010 * 00011 * Unless required by applicable law or agreed to in writing, software 00012 * distributed under the License is distributed on an "AS IS" BASIS, 00013 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 00014 * See the License for the specific language governing permissions and 00015 * limitations under the License. 00016 */ 00017 00018 /* 00019 * $Id$ 00020 */ 00021 00022 #if !defined(XERCESC_INCLUDE_GUARD_XSANNOTATION_HPP) 00023 #define XERCESC_INCLUDE_GUARD_XSANNOTATION_HPP 00024 00025 #include <xercesc/framework/psvi/XSObject.hpp> 00026 #include <xercesc/internal/XSerializable.hpp> 00027 00028 XERCES_CPP_NAMESPACE_BEGIN 00029 00037 // forward declarations 00038 class DOMNode; 00039 class ContentHandler; 00040 00041 class XMLPARSER_EXPORT XSAnnotation : public XSerializable, public XSObject 00042 { 00043 public: 00044 00045 // TargetType 00046 enum ANNOTATION_TARGET { 00050 W3C_DOM_ELEMENT = 1, 00054 W3C_DOM_DOCUMENT = 2 00055 }; 00056 00057 // Constructors and Destructor 00058 // ----------------------------------------------------------------------- 00061 00068 XSAnnotation 00069 ( 00070 const XMLCh* const contents 00071 , MemoryManager* const manager = XMLPlatformUtils::fgMemoryManager 00072 ); 00073 00075 00078 ~XSAnnotation(); 00080 00081 //--------------------- 00085 00096 void writeAnnotation(DOMNode* node, ANNOTATION_TARGET targetType); 00097 00105 void writeAnnotation(ContentHandler* handler); 00106 00110 const XMLCh *getAnnotationString() const; 00111 XMLCh *getAnnotationString(); 00112 00114 00115 //---------------------------------- 00118 void setNext(XSAnnotation* const nextAnnotation); 00119 XSAnnotation* getNext(); 00121 00122 //----------------------------- 00125 inline void getLineCol(XMLFileLoc& line, XMLFileLoc& col) const; 00126 inline const XMLCh* getSystemId() const; 00128 00129 //----------------------------- 00132 inline void setLineCol(XMLFileLoc line, XMLFileLoc col); 00133 void setSystemId(const XMLCh* const systemId); 00135 00136 /*** 00137 * Support for Serialization/De-serialization 00138 ***/ 00139 DECL_XSERIALIZABLE(XSAnnotation) 00140 XSAnnotation(MemoryManager* const manager); 00141 00142 private: 00143 00144 // ----------------------------------------------------------------------- 00145 // Unimplemented constructors and operators 00146 // ----------------------------------------------------------------------- 00147 XSAnnotation(const XSAnnotation&); 00148 XSAnnotation & operator=(const XSAnnotation &); 00149 00150 protected: 00151 00152 // ----------------------------------------------------------------------- 00153 // data members 00154 // ----------------------------------------------------------------------- 00155 XMLCh* fContents; 00156 XSAnnotation* fNext; 00157 00158 private: 00159 00160 XMLCh* fSystemId; 00161 XMLFileLoc fLine; 00162 XMLFileLoc fCol; 00163 00164 }; 00165 00166 inline const XMLCh *XSAnnotation::getAnnotationString() const 00167 { 00168 return fContents; 00169 } 00170 00171 inline XMLCh *XSAnnotation::getAnnotationString() 00172 { 00173 return fContents; 00174 } 00175 00176 inline void XSAnnotation::getLineCol(XMLFileLoc& line, XMLFileLoc& col) const 00177 { 00178 line = fLine; 00179 col = fCol; 00180 } 00181 00182 inline const XMLCh* XSAnnotation::getSystemId() const 00183 { 00184 return fSystemId; 00185 } 00186 00187 inline void XSAnnotation::setLineCol(XMLFileLoc line, XMLFileLoc col) 00188 { 00189 fLine = line; 00190 fCol = col; 00191 } 00192 00193 XERCES_CPP_NAMESPACE_END 00194 00195 #endif