00001 /* 00002 * Copyright 2003,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 00017 /* 00018 * $Log: XSAnnotation.hpp,v $ 00019 * Revision 1.11 2004/09/08 13:56:07 peiyongz 00020 * Apache License Version 2.0 00021 * 00022 * Revision 1.10 2004/09/02 19:08:09 cargilld 00023 * Fix API Doc warning message 00024 * 00025 * Revision 1.9 2004/04/02 16:51:05 peiyongz 00026 * Better error report support 00027 * 00028 * Revision 1.8 2003/12/01 23:23:26 neilg 00029 * fix for bug 25118; thanks to Jeroen Witmond 00030 * 00031 * Revision 1.7 2003/11/28 14:55:11 neilg 00032 * fix for compilation error on HPUX 00033 * 00034 * Revision 1.6 2003/11/27 21:29:05 neilg 00035 * implement writeAnnotation; thanks to Dave Cargill 00036 * 00037 * Revision 1.5 2003/11/14 22:47:53 neilg 00038 * fix bogus log message from previous commit... 00039 * 00040 * Revision 1.4 2003/11/14 22:33:30 neilg 00041 * Second phase of schema component model implementation. 00042 * Implement XSModel, XSNamespaceItem, and the plumbing necessary 00043 * to connect them to the other components. 00044 * Thanks to David Cargill. 00045 * 00046 * Revision 1.3 2003/11/11 22:48:13 knoaman 00047 * Serialization of XSAnnotation. 00048 * 00049 * Revision 1.2 2003/11/06 19:28:11 knoaman 00050 * PSVI support for annotations. 00051 * 00052 * Revision 1.1 2003/09/16 14:33:36 neilg 00053 * PSVI/schema component model classes, with Makefile/configuration changes necessary to build them 00054 * 00055 */ 00056 00057 #if !defined(XSANNOTATION_HPP) 00058 #define XSANNOTATION_HPP 00059 00060 #include <xercesc/framework/psvi/XSObject.hpp> 00061 #include <xercesc/internal/XSerializable.hpp> 00062 00063 XERCES_CPP_NAMESPACE_BEGIN 00064 00072 // forward declarations 00073 class DOMNode; 00074 class ContentHandler; 00075 00076 class XSAnnotation : public XSerializable, public XSObject 00077 { 00078 public: 00079 00080 // TargetType 00081 enum ANNOTATION_TARGET { 00085 W3C_DOM_ELEMENT = 1, 00089 W3C_DOM_DOCUMENT = 2 00090 }; 00091 00092 // Constructors and Destructor 00093 // ----------------------------------------------------------------------- 00096 00103 XSAnnotation 00104 ( 00105 const XMLCh* const contents 00106 , MemoryManager* const manager = XMLPlatformUtils::fgMemoryManager 00107 ); 00108 00110 00113 ~XSAnnotation(); 00115 00116 //--------------------- 00120 00131 void writeAnnotation(DOMNode* node, ANNOTATION_TARGET targetType); 00132 00140 void writeAnnotation(ContentHandler* handler); 00141 00145 const XMLCh *getAnnotationString() const; 00146 XMLCh *getAnnotationString(); 00147 00149 00150 //---------------------------------- 00153 void setNext(XSAnnotation* const nextAnnotation); 00154 XSAnnotation* getNext(); 00156 00157 //----------------------------- 00160 inline void getLineCol(int& line, int& col) const; 00161 inline const XMLCh* getSystemId() const; 00163 00164 //----------------------------- 00167 inline void setLineCol(int line, int col); 00168 void setSystemId(const XMLCh* const systemId); 00170 00171 /*** 00172 * Support for Serialization/De-serialization 00173 ***/ 00174 DECL_XSERIALIZABLE(XSAnnotation) 00175 XSAnnotation(MemoryManager* const manager); 00176 00177 private: 00178 00179 // ----------------------------------------------------------------------- 00180 // Unimplemented constructors and operators 00181 // ----------------------------------------------------------------------- 00182 XSAnnotation(const XSAnnotation&); 00183 XSAnnotation & operator=(const XSAnnotation &); 00184 00185 protected: 00186 00187 // ----------------------------------------------------------------------- 00188 // data members 00189 // ----------------------------------------------------------------------- 00190 XMLCh* fContents; 00191 XSAnnotation* fNext; 00192 00193 private: 00194 00195 XMLCh* fSystemId; 00196 int fLine; 00197 int fCol; 00198 00199 }; 00200 00201 inline const XMLCh *XSAnnotation::getAnnotationString() const 00202 { 00203 return fContents; 00204 } 00205 00206 inline XMLCh *XSAnnotation::getAnnotationString() 00207 { 00208 return fContents; 00209 } 00210 00211 inline void XSAnnotation::getLineCol(int& line, int& col) const 00212 { 00213 line = fLine; 00214 col = fCol; 00215 } 00216 00217 inline const XMLCh* XSAnnotation::getSystemId() const 00218 { 00219 return fSystemId; 00220 } 00221 00222 inline void XSAnnotation::setLineCol(int line, int col) 00223 { 00224 fLine = line; 00225 fCol = col; 00226 } 00227 00228 XERCES_CPP_NAMESPACE_END 00229 00230 #endif