| 1 | // |
| 2 | // LocatorImpl.h |
| 3 | // |
| 4 | // Library: XML |
| 5 | // Package: SAX |
| 6 | // Module: SAX |
| 7 | // |
| 8 | // An implementation of the SAX Locator interface. |
| 9 | // |
| 10 | // Copyright (c) 2004-2006, Applied Informatics Software Engineering GmbH. |
| 11 | // and Contributors. |
| 12 | // |
| 13 | // SPDX-License-Identifier: BSL-1.0 |
| 14 | // |
| 15 | |
| 16 | |
| 17 | #ifndef SAX_LocatorImpl_INCLUDED |
| 18 | #define SAX_LocatorImpl_INCLUDED |
| 19 | |
| 20 | |
| 21 | #include "Poco/XML/XML.h" |
| 22 | #include "Poco/SAX/Locator.h" |
| 23 | #include "Poco/XML/XMLString.h" |
| 24 | |
| 25 | |
| 26 | namespace Poco { |
| 27 | namespace XML { |
| 28 | |
| 29 | |
| 30 | class XML_API LocatorImpl: public Locator |
| 31 | /// Provide an optional convenience implementation of Locator. |
| 32 | { |
| 33 | public: |
| 34 | LocatorImpl(); |
| 35 | /// Zero-argument constructor. |
| 36 | /// |
| 37 | /// This will not normally be useful, since the main purpose of this class is |
| 38 | /// to make a snapshot of an existing Locator. |
| 39 | |
| 40 | LocatorImpl(const Locator& loc); |
| 41 | /// Copy constructor. |
| 42 | /// |
| 43 | /// Create a persistent copy of the current state of a locator. When the original |
| 44 | /// locator changes, this copy will still keep the original values (and it can be |
| 45 | /// used outside the scope of DocumentHandler methods). |
| 46 | |
| 47 | ~LocatorImpl(); |
| 48 | /// Destroys the Locator. |
| 49 | |
| 50 | LocatorImpl& operator = (const Locator& loc); |
| 51 | /// Assignment operator. |
| 52 | |
| 53 | XMLString getPublicId() const; |
| 54 | /// Return the saved public identifier. |
| 55 | |
| 56 | XMLString getSystemId() const; |
| 57 | /// Return the saved system identifier. |
| 58 | |
| 59 | int getLineNumber() const; |
| 60 | /// Return the saved line number (1-based). |
| 61 | |
| 62 | int getColumnNumber() const; |
| 63 | /// Return the saved column number (1-based). |
| 64 | |
| 65 | void setPublicId(const XMLString& publicId); |
| 66 | /// Set the public identifier for this locator. |
| 67 | |
| 68 | void setSystemId(const XMLString& systemId); |
| 69 | /// Set the system identifier for this locator. |
| 70 | |
| 71 | void setLineNumber(int lineNumber); |
| 72 | /// Set the line number for this locator (1-based). |
| 73 | |
| 74 | void setColumnNumber(int columnNumber); |
| 75 | /// Set the column number for this locator (1-based). |
| 76 | |
| 77 | private: |
| 78 | XMLString _publicId; |
| 79 | XMLString _systemId; |
| 80 | int _lineNumber; |
| 81 | int _columnNumber; |
| 82 | }; |
| 83 | |
| 84 | |
| 85 | } } // namespace Poco::XML |
| 86 | |
| 87 | |
| 88 | #endif // SAX_LocatorImpl_INCLUDED |
| 89 | |