00001 /* 00002 * The Apache Software License, Version 1.1 00003 * 00004 * Copyright (c) 1999-2000 The Apache Software Foundation. All rights 00005 * reserved. 00006 * 00007 * Redistribution and use in source and binary forms, with or without 00008 * modification, are permitted provided that the following conditions 00009 * are met: 00010 * 00011 * 1. Redistributions of source code must retain the above copyright 00012 * notice, this list of conditions and the following disclaimer. 00013 * 00014 * 2. Redistributions in binary form must reproduce the above copyright 00015 * notice, this list of conditions and the following disclaimer in 00016 * the documentation and/or other materials provided with the 00017 * distribution. 00018 * 00019 * 3. The end-user documentation included with the redistribution, 00020 * if any, must include the following acknowledgment: 00021 * "This product includes software developed by the 00022 * Apache Software Foundation (http://www.apache.org/)." 00023 * Alternately, this acknowledgment may appear in the software itself, 00024 * if and wherever such third-party acknowledgments normally appear. 00025 * 00026 * 4. The names "Xerces" and "Apache Software Foundation" must 00027 * not be used to endorse or promote products derived from this 00028 * software without prior written permission. For written 00029 * permission, please contact apache\@apache.org. 00030 * 00031 * 5. Products derived from this software may not be called "Apache", 00032 * nor may "Apache" appear in their name, without prior written 00033 * permission of the Apache Software Foundation. 00034 * 00035 * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED 00036 * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES 00037 * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE 00038 * DISCLAIMED. IN NO EVENT SHALL THE APACHE SOFTWARE FOUNDATION OR 00039 * ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, 00040 * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT 00041 * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF 00042 * USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND 00043 * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, 00044 * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT 00045 * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 00046 * SUCH DAMAGE. 00047 * ==================================================================== 00048 * 00049 * This software consists of voluntary contributions made by many 00050 * individuals on behalf of the Apache Software Foundation, and was 00051 * originally based on software copyright (c) 1999, International 00052 * Business Machines, Inc., http://www.ibm.com . For more information 00053 * on the Apache Software Foundation, please see 00054 * <http://www.apache.org/>. 00055 */ 00056 00057 /* 00058 * $Log: XMLEntityDecl.hpp,v $ 00059 * Revision 1.1 2002/05/11 20:02:37 bhavani 00060 * CR#CR062582# adding xercesc 1.7 file 00061 * 00062 * Revision 1.1.1.1 2002/02/01 22:21:51 peiyongz 00063 * sane_include 00064 * 00065 * Revision 1.6 2000/02/24 20:00:23 abagchi 00066 * Swat for removing Log from API docs 00067 * 00068 * Revision 1.5 2000/02/16 23:03:48 roddey 00069 * More documentation updates 00070 * 00071 * Revision 1.4 2000/02/16 21:42:58 aruna1 00072 * API Doc++ summary changes in 00073 * 00074 * Revision 1.3 2000/02/15 01:21:30 roddey 00075 * Some initial documentation improvements. More to come... 00076 * 00077 * Revision 1.2 2000/02/06 07:47:48 rahulj 00078 * Year 2K copyright swat. 00079 * 00080 * Revision 1.1.1.1 1999/11/09 01:08:32 twl 00081 * Initial checkin 00082 * 00083 * Revision 1.2 1999/11/08 20:44:38 rahul 00084 * Swat for adding in Product name and CVS comment log variable. 00085 * 00086 */ 00087 00088 #if !defined(XMLENTITYDECL_HPP) 00089 #define XMLENTITYDECL_HPP 00090 00091 #include <xercesc/util/XMLString.hpp> 00092 00111 class XMLPARSER_EXPORT XMLEntityDecl 00112 { 00113 public: 00114 // ----------------------------------------------------------------------- 00115 // Constructors and Destructor 00116 // ----------------------------------------------------------------------- 00117 00120 00124 XMLEntityDecl(); 00125 00130 XMLEntityDecl 00131 ( 00132 const XMLCh* const entName 00133 ); 00134 00141 XMLEntityDecl 00142 ( 00143 const XMLCh* const entName 00144 , const XMLCh* const value 00145 ); 00146 00153 XMLEntityDecl 00154 ( 00155 const XMLCh* const entName 00156 , const XMLCh value 00157 ); 00159 00162 00166 virtual ~XMLEntityDecl(); 00167 00169 00170 00171 // ----------------------------------------------------------------------- 00172 // Virtual entity decl interface 00173 // ----------------------------------------------------------------------- 00174 00177 00185 virtual bool getDeclaredInIntSubset() const = 0; 00186 00192 virtual bool getIsParameter() const = 0; 00193 00199 virtual bool getIsSpecialChar() const = 0; 00200 00202 00203 00204 // ----------------------------------------------------------------------- 00205 // Getter methods 00206 // ----------------------------------------------------------------------- 00207 00210 00215 unsigned int getId() const; 00216 00222 const XMLCh* getName() const; 00223 00228 const XMLCh* getNotationName() const; 00229 00234 const XMLCh* getPublicId() const; 00235 00240 const XMLCh* getSystemId() const; 00241 00247 const XMLCh* getValue() const; 00248 00254 unsigned int getValueLen() const; 00255 00260 bool isExternal() const; 00261 00267 bool isUnparsed() const; 00268 00270 00271 00272 // ----------------------------------------------------------------------- 00273 // Setter methods 00274 // ----------------------------------------------------------------------- 00275 00278 00287 void setName 00288 ( 00289 const XMLCh* const entName 00290 ); 00291 00298 void setNotationName(const XMLCh* const newName); 00299 00306 void setPublicId(const XMLCh* const newId); 00307 00317 void setSystemId(const XMLCh* const newId); 00318 00326 void setValue(const XMLCh* const newValue); 00327 00329 00330 /* For internal use only */ 00331 void setId(const unsigned int newId); 00332 00333 00334 // ----------------------------------------------------------------------- 00335 // Support named pool syntax 00336 // ----------------------------------------------------------------------- 00337 00340 00347 const XMLCh* getKey() const; 00348 00350 00351 00352 private : 00353 // ----------------------------------------------------------------------- 00354 // Unimplemented constructors and operators 00355 // ----------------------------------------------------------------------- 00356 XMLEntityDecl(const XMLEntityDecl&); 00357 void operator=(XMLEntityDecl&); 00358 00359 00360 // ----------------------------------------------------------------------- 00361 // XMLEntityDecl: Private helper methods 00362 // ----------------------------------------------------------------------- 00363 void cleanUp(); 00364 00365 00366 // ----------------------------------------------------------------------- 00367 // Private data members 00368 // 00369 // fId 00370 // This is the unique id given to this entity decl. 00371 // 00372 // fName 00373 // The name of the enitity. Entity names are never namespace based. 00374 // 00375 // fNotationName 00376 // The optional notation of the entity. If there was none, then its 00377 // empty. 00378 // 00379 // fPublicId 00380 // The public id of the entity, which can be empty. 00381 // 00382 // fSystemId 00383 // The system id of the entity. 00384 // 00385 // fValue 00386 // fValueLen 00387 // The entity's value and length, which is only valid if its an 00388 // internal style entity. 00389 // ----------------------------------------------------------------------- 00390 unsigned int fId; 00391 XMLCh* fName; 00392 XMLCh* fNotationName; 00393 XMLCh* fPublicId; 00394 XMLCh* fSystemId; 00395 XMLCh* fValue; 00396 unsigned int fValueLen; 00397 }; 00398 00399 00400 // --------------------------------------------------------------------------- 00401 // XMLEntityDecl: Getter methods 00402 // --------------------------------------------------------------------------- 00403 inline unsigned int XMLEntityDecl::getId() const 00404 { 00405 return fId; 00406 } 00407 00408 inline const XMLCh* XMLEntityDecl::getName() const 00409 { 00410 return fName; 00411 } 00412 00413 inline const XMLCh* XMLEntityDecl::getNotationName() const 00414 { 00415 return fNotationName; 00416 } 00417 00418 inline const XMLCh* XMLEntityDecl::getPublicId() const 00419 { 00420 return fPublicId; 00421 } 00422 00423 inline const XMLCh* XMLEntityDecl::getSystemId() const 00424 { 00425 return fSystemId; 00426 } 00427 00428 inline const XMLCh* XMLEntityDecl::getValue() const 00429 { 00430 return fValue; 00431 } 00432 00433 inline unsigned int XMLEntityDecl::getValueLen() const 00434 { 00435 return fValueLen; 00436 } 00437 00438 inline bool XMLEntityDecl::isExternal() const 00439 { 00440 // If it has a system or public id, its external 00441 return ((fPublicId != 0) || (fSystemId != 0)); 00442 } 00443 00444 inline bool XMLEntityDecl::isUnparsed() const 00445 { 00446 // If it has a notation, its unparsed 00447 return (fNotationName != 0); 00448 } 00449 00450 00451 // --------------------------------------------------------------------------- 00452 // XMLEntityDecl: Setter methods 00453 // --------------------------------------------------------------------------- 00454 inline void XMLEntityDecl::setId(const unsigned int newId) 00455 { 00456 fId = newId; 00457 } 00458 00459 inline void XMLEntityDecl::setNotationName(const XMLCh* const newName) 00460 { 00461 delete [] fNotationName; 00462 fNotationName = XMLString::replicate(newName); 00463 } 00464 00465 inline void XMLEntityDecl::setPublicId(const XMLCh* const newId) 00466 { 00467 delete [] fPublicId; 00468 fPublicId = XMLString::replicate(newId); 00469 } 00470 00471 inline void XMLEntityDecl::setSystemId(const XMLCh* const newId) 00472 { 00473 delete [] fSystemId; 00474 fSystemId = XMLString::replicate(newId); 00475 } 00476 00477 inline void XMLEntityDecl::setValue(const XMLCh* const newValue) 00478 { 00479 delete [] fValue; 00480 fValue = XMLString::replicate(newValue); 00481 fValueLen = XMLString::stringLen(newValue); 00482 } 00483 00484 00485 // --------------------------------------------------------------------------- 00486 // XMLEntityDecl: Support named pool syntax 00487 // --------------------------------------------------------------------------- 00488 inline const XMLCh* XMLEntityDecl::getKey() const 00489 { 00490 return fName; 00491 } 00492 00493 #endif