📄 readermgr.hpp
字号:
, XMLEntityDecl* const entity ); void reset(); // ----------------------------------------------------------------------- // Getter methods // ----------------------------------------------------------------------- const XMLCh* getCurrentEncodingStr() const; const XMLEntityDecl* getCurrentEntity() const; XMLEntityDecl* getCurrentEntity(); const XMLReader* getCurrentReader() const; XMLReader* getCurrentReader(); unsigned int getCurrentReaderNum() const; unsigned int getReaderDepth() const; void getLastExtEntityInfo(LastExtEntityInfo& lastInfo) const; unsigned int getSrcOffset() const; bool getThrowEOE() const; // ----------------------------------------------------------------------- // Setter methods // ----------------------------------------------------------------------- void setEntityHandler(XMLEntityHandler* const newHandler); void setThrowEOE(const bool newValue); void setXMLVersion(const XMLReader::XMLVersion version); void setStandardUriConformant(const bool newValue); // ----------------------------------------------------------------------- // Implement the SAX Locator interface // ----------------------------------------------------------------------- virtual const XMLCh* getPublicId() const; virtual const XMLCh* getSystemId() const; virtual XMLSSize_t getLineNumber() const; virtual XMLSSize_t getColumnNumber() const;private : // ----------------------------------------------------------------------- // Private helper methods // ----------------------------------------------------------------------- const XMLReader* getLastExtEntity(const XMLEntityDecl*& itsEntity) const; bool popReader(); // ----------------------------------------------------------------------- // Unimplemented constructors and operators // ----------------------------------------------------------------------- ReaderMgr(const ReaderMgr&); ReaderMgr& operator=(const ReaderMgr&); // ----------------------------------------------------------------------- // Private data members // // fCurEntity // This is the current top of stack entity. We pull it off the stack // and store it here for efficiency. // // fCurReader // This is the current top of stack reader. We pull it off the // stack and store it here for efficiency. // // fEntityHandler // This is the installed entity handler. Its installed via the // scanner but he passes it on to us since we need it the most, in // process of creating external entity readers. // // fEntityStack // We need to keep up with which of the pushed readers are pushed // entity values that are being spooled. This is done to avoid the // problem of recursive definitions. This stack consists of refs to // EntityDecl objects for the pushed entities. // // fNextReaderNum // This is the reader serial number value. Each new reader that is // created from this reader is given a successive number. This lets // us catch things like partial markup errors and such. // // fReaderStack // This is the stack of reader references. We own all the readers // and destroy them when they are used up. // // fThrowEOE // This flag controls whether we throw an exception when we hit an // end of entity. The scanner doesn't really need to know about ends // of entities in the int/ext subsets, so it will turn this flag off // until it gets into the content usually. // // fXMLVersion // Enum to indicate if each Reader should be created as XML 1.1 or // XML 1.0 conformant // // fStandardUriConformant // This flag controls whether we force conformant URI // ----------------------------------------------------------------------- XMLEntityDecl* fCurEntity; XMLReader* fCurReader; XMLEntityHandler* fEntityHandler; RefStackOf<XMLEntityDecl>* fEntityStack; unsigned int fNextReaderNum; RefStackOf<XMLReader>* fReaderStack; bool fThrowEOE; XMLReader::XMLVersion fXMLVersion; bool fStandardUriConformant; MemoryManager* fMemoryManager;};// ---------------------------------------------------------------------------// ReaderMgr: Inlined methods//// NOTE: We cannot put these in alphabetical and type order as we usually// do because some of the compilers we have to support are too stupid to// understand out of order inlines!// ---------------------------------------------------------------------------inline unsigned int ReaderMgr::getCurrentReaderNum() const{ return fCurReader->getReaderNum();}inline const XMLReader* ReaderMgr::getCurrentReader() const{ return fCurReader;}inline XMLReader* ReaderMgr::getCurrentReader(){ return fCurReader;}inline bool ReaderMgr::getName(XMLBuffer& toFill){ toFill.reset(); return fCurReader->getName(toFill, false);}inline bool ReaderMgr::getNameToken(XMLBuffer& toFill){ toFill.reset(); return fCurReader->getName(toFill, true);}inline bool ReaderMgr::getNextCharIfNot(const XMLCh chNotToGet, XMLCh& chGotten){ return fCurReader->getNextCharIfNot(chNotToGet, chGotten);}inline void ReaderMgr::movePlainContentChars(XMLBuffer &dest){ fCurReader->movePlainContentChars(dest);}inline bool ReaderMgr::getThrowEOE() const{ return fThrowEOE;}inline unsigned int ReaderMgr::getSrcOffset() const{ return fCurReader->getSrcOffset();}inline bool ReaderMgr::lookingAtChar(const XMLCh chToCheck){ return (chToCheck == peekNextChar());}inline bool ReaderMgr::lookingAtSpace(){ XMLCh c = peekNextChar(); return fCurReader->isWhitespace(c);}inline void ReaderMgr::setThrowEOE(const bool newValue){ fThrowEOE = newValue;}inline void ReaderMgr::setStandardUriConformant(const bool newValue){ fStandardUriConformant = newValue;}inline bool ReaderMgr::skippedString(const XMLCh* const toSkip){ return fCurReader->skippedString(toSkip);}inline void ReaderMgr::skipToChar(const XMLCh toSkipTo){ while (true) { // Get chars until we find the one to skip const XMLCh nextCh = getNextChar(); // Break out at end of input or the char to skip if ((nextCh == toSkipTo) || !nextCh) break; }}inline void ReaderMgr::skipPastChar(const XMLCh toSkipPast){ while (true) { // Get chars until we find the one to skip const XMLCh nextCh = getNextChar(); if ((nextCh == toSkipPast) || !nextCh) break; }}inline bool ReaderMgr::peekString(const XMLCh* const toPeek){ return fCurReader->peekString(toPeek);}inline void ReaderMgr::setEntityHandler(XMLEntityHandler* const newHandler){ fEntityHandler = newHandler;}inline void ReaderMgr::setXMLVersion(const XMLReader::XMLVersion version){ fXMLVersion = version; fCurReader->setXMLVersion(version);}//// This is a simple class to temporarily change the 'throw at end of entity'// flag of the reader manager. There are some places where we need to// turn this on and off on a scoped basis.//class XMLPARSER_EXPORT ThrowEOEJanitor{public : // ----------------------------------------------------------------------- // Constructors and destructor // ----------------------------------------------------------------------- ThrowEOEJanitor(ReaderMgr* mgrTarget, const bool newValue) : fOld(mgrTarget->getThrowEOE()) , fMgr(mgrTarget) { mgrTarget->setThrowEOE(newValue); } ~ThrowEOEJanitor() { fMgr->setThrowEOE(fOld); };private : // ----------------------------------------------------------------------- // Unimplemented constructors and operators // ----------------------------------------------------------------------- ThrowEOEJanitor(const ThrowEOEJanitor&); ThrowEOEJanitor& operator=(const ThrowEOEJanitor&); // ----------------------------------------------------------------------- // Private data members // // fOld // The previous value of the flag, which we replaced during ctor, // and will replace during dtor. // // fMgr // A pointer to the reader manager we are going to set/reset the // flag on. // ----------------------------------------------------------------------- bool fOld; ReaderMgr* fMgr;};XERCES_CPP_NAMESPACE_END#endif
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -