Cross-Platform C++

ot::sax
class LocatorImpl

#include "ot/sax/LocatorImpl.h"

ot::sax::Locator ot::ManagedObject Provides a convenience implementation of Locator.

This class is available mainly for application writers, who can use it to make a persistent snapshot of a locator at any point during a document parse:

    void MyContentHandler::setLocator(Locator* pLocator)
    {
        // Store the locator for future ContentHandler events
        m_rpLocator = pLocator;
    }
    
    void MyContentHandler::startDocument()
    {
        // save the location of the start of the document
        // in a LocatorImpl member for future use.
        m_startLoc = *m_rpLocator;
    }

Normally, parser writers will not use this class, since it is more efficient to provide location information only when requested, rather than constantly updating a Locator object.




Constructor/Destructor Summary
LocatorImpl()
         Default constructor.
LocatorImpl(const Locator& rhs)
         Copy constructor.

Method Summary
 virtual long getColumnNumber() const
         Returns the stored column number, or -1 if none is available.
 virtual long getLineNumber() const
         Returns the stored line number, or -1 if none is available.
 virtual String getPublicId() const
         Returns the stored public identifier, which may be an empty string.
 virtual String getSystemId() const
         Returns the stored system identifier, which may be an empty string.
 void setColumnNumber(long columnNumber)
         Set the column number for this locator (1-based).
 void setLineNumber(long lineNumber)
         Set the line number for this locator (1-based).
 void setPublicId(const String& publicId)
         Set the public identifier for this locator.
 void setSystemId(const String& systemId)
         Set the system identifier for this locator.

Methods inherited from class ot::ManagedObject
addRef, getRefCount, onFinalRelease, operator=, release

Constructor/Destructor Detail

LocatorImpl

 LocatorImpl()
Default constructor.

This will not normally be useful, since the main purpose of this class is to make a snapshot of an existing Locator.


LocatorImpl

 LocatorImpl(const Locator& rhs)
Copy constructor.

Create a persistent copy of the current state of a locator. When the original locator changes, this copy will still keep the original values.

Parameters:
rhs - The locator to copy.

Method Detail

getColumnNumber

virtual long getColumnNumber() const
Returns the stored column number, or -1 if none is available.

Note that column number is 1-based, therefore zero should never be returned.

See also:
setColumnNumber()

getLineNumber

virtual long getLineNumber() const
Returns the stored line number, or -1 if none is available.

Note that line number is 1-based, therefore zero should never be returned.

See also:
setLineNumber()

getPublicId

virtual String getPublicId() const
Returns the stored public identifier, which may be an empty string.

See also:
setPublicId()

getSystemId

virtual String getSystemId() const
Returns the stored system identifier, which may be an empty string.

See also:
setSystemId()

setColumnNumber

void setColumnNumber(long columnNumber)
Set the column number for this locator (1-based).

Parameters:
columnNumber - The column number, or -1 if none is available.
See also:
getColumnNumber()

setLineNumber

void setLineNumber(long lineNumber)
Set the line number for this locator (1-based).

Parameters:
lineNumber - The line number, or -1 if none is available.
See also:
getLineNumber()

setPublicId

void setPublicId(const String& publicId)
Set the public identifier for this locator.

Parameters:
publicId - The new public identifier, or the empty string if none is available.
See also:
getPublicId()

setSystemId

void setSystemId(const String& systemId)
Set the system identifier for this locator.

Parameters:
systemId - The new system identifier, or the empty string if none is available.
See also:
getSystemId()


Cross-Platform C++

Found a bug or missing feature? Please email us at support@elcel.com

Copyright © 2000-2003 ElCel Technology   Trademark Acknowledgements