| 1 | /* |
|---|
| 2 | * Licensed to the Apache Software Foundation (ASF) under one or more |
|---|
| 3 | * contributor license agreements. See the NOTICE file distributed with |
|---|
| 4 | * this work for additional information regarding copyright ownership. |
|---|
| 5 | * The ASF licenses this file to You under the Apache License, Version 2.0 |
|---|
| 6 | * (the "License"); you may not use this file except in compliance with |
|---|
| 7 | * the License. You may obtain a copy of the License at |
|---|
| 8 | * |
|---|
| 9 | * http://www.apache.org/licenses/LICENSE-2.0 |
|---|
| 10 | * |
|---|
| 11 | * Unless required by applicable law or agreed to in writing, software |
|---|
| 12 | * distributed under the License is distributed on an "AS IS" BASIS, |
|---|
| 13 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
|---|
| 14 | * See the License for the specific language governing permissions and |
|---|
| 15 | * limitations under the License. |
|---|
| 16 | */ |
|---|
| 17 | |
|---|
| 18 | /* |
|---|
| 19 | * $Id: EndOfEntityException.hpp 568078 2007-08-21 11:43:25Z amassari $ |
|---|
| 20 | */ |
|---|
| 21 | |
|---|
| 22 | |
|---|
| 23 | #if !defined(ENDOFENTITYEXCEPTION_HPP) |
|---|
| 24 | #define ENDOFENTITYEXCEPTION_HPP |
|---|
| 25 | |
|---|
| 26 | #include <xercesc/util/XercesDefs.hpp> |
|---|
| 27 | |
|---|
| 28 | XERCES_CPP_NAMESPACE_BEGIN |
|---|
| 29 | |
|---|
| 30 | class XMLEntityDecl; |
|---|
| 31 | |
|---|
| 32 | // |
|---|
| 33 | // This class is only used internally. Its thrown by the ReaderMgr class, |
|---|
| 34 | // when an entity ends, and is caught in the scanner. This tells the scanner |
|---|
| 35 | // that an entity has ended, and allows it to do the right thing according |
|---|
| 36 | // to what was going on when the entity ended. |
|---|
| 37 | // |
|---|
| 38 | // Since its internal, it does not bother implementing XMLException. |
|---|
| 39 | // |
|---|
| 40 | class XMLPARSER_EXPORT EndOfEntityException |
|---|
| 41 | { |
|---|
| 42 | public: |
|---|
| 43 | // ----------------------------------------------------------------------- |
|---|
| 44 | // Constructors and Destructor |
|---|
| 45 | // ----------------------------------------------------------------------- |
|---|
| 46 | EndOfEntityException( XMLEntityDecl* entityThatEnded |
|---|
| 47 | , const unsigned int readerNum) : |
|---|
| 48 | |
|---|
| 49 | fEntity(entityThatEnded) |
|---|
| 50 | , fReaderNum(readerNum) |
|---|
| 51 | { |
|---|
| 52 | } |
|---|
| 53 | |
|---|
| 54 | EndOfEntityException(const EndOfEntityException& toCopy) : |
|---|
| 55 | |
|---|
| 56 | fEntity(toCopy.fEntity) |
|---|
| 57 | , fReaderNum(toCopy.fReaderNum) |
|---|
| 58 | { |
|---|
| 59 | } |
|---|
| 60 | |
|---|
| 61 | ~EndOfEntityException() |
|---|
| 62 | { |
|---|
| 63 | } |
|---|
| 64 | |
|---|
| 65 | |
|---|
| 66 | // ----------------------------------------------------------------------- |
|---|
| 67 | // Getter methods |
|---|
| 68 | // ----------------------------------------------------------------------- |
|---|
| 69 | XMLEntityDecl& getEntity(); |
|---|
| 70 | const XMLEntityDecl& getEntity() const; |
|---|
| 71 | unsigned int getReaderNum() const; |
|---|
| 72 | |
|---|
| 73 | |
|---|
| 74 | private : |
|---|
| 75 | // ----------------------------------------------------------------------- |
|---|
| 76 | // Unimplemented constructors and operators |
|---|
| 77 | // ----------------------------------------------------------------------- |
|---|
| 78 | EndOfEntityException& operator = (const EndOfEntityException&); |
|---|
| 79 | |
|---|
| 80 | // ----------------------------------------------------------------------- |
|---|
| 81 | // Private data members |
|---|
| 82 | // |
|---|
| 83 | // fEntity |
|---|
| 84 | // This is a reference to the entity that ended, causing this |
|---|
| 85 | // exception. |
|---|
| 86 | // |
|---|
| 87 | // fReaderNum |
|---|
| 88 | // The unique reader number of the reader that was handling this |
|---|
| 89 | // entity. This is used to know whether a particular entity has |
|---|
| 90 | // ended. |
|---|
| 91 | // ----------------------------------------------------------------------- |
|---|
| 92 | XMLEntityDecl* fEntity; |
|---|
| 93 | unsigned int fReaderNum; |
|---|
| 94 | }; |
|---|
| 95 | |
|---|
| 96 | |
|---|
| 97 | // --------------------------------------------------------------------------- |
|---|
| 98 | // EndOfEntityException: Getter methods |
|---|
| 99 | // --------------------------------------------------------------------------- |
|---|
| 100 | inline XMLEntityDecl& EndOfEntityException::getEntity() |
|---|
| 101 | { |
|---|
| 102 | return *fEntity; |
|---|
| 103 | } |
|---|
| 104 | |
|---|
| 105 | inline const XMLEntityDecl& EndOfEntityException::getEntity() const |
|---|
| 106 | { |
|---|
| 107 | return *fEntity; |
|---|
| 108 | } |
|---|
| 109 | |
|---|
| 110 | inline unsigned int EndOfEntityException::getReaderNum() const |
|---|
| 111 | { |
|---|
| 112 | return fReaderNum; |
|---|
| 113 | } |
|---|
| 114 | |
|---|
| 115 | XERCES_CPP_NAMESPACE_END |
|---|
| 116 | |
|---|
| 117 | #endif |
|---|