Provides an optional 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:

import sax::helpers::sax_locator_impl
import sax::content_handler

class Example super ContentHandler
    private var locator: SAXLocator
    private var start_loc: nullable SAXLocator = null

    redef fun start_document do
        # save the location of the start of the document
        # for future use.
        start_loc = new SAXLocatorImpl.from(locator)
    end
end

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.

Note: The original source code and documentation of this class comes, in part, from SAX 2.0.

Introduced properties

fun column_number=(column_number: Int)

sax :: SAXLocatorImpl :: column_number=

init from(locator: SAXLocator)

sax :: SAXLocatorImpl :: from

Copy constructor.
fun line_number=(line_number: Int)

sax :: SAXLocatorImpl :: line_number=

fun public_id=(public_id: nullable String)

sax :: SAXLocatorImpl :: public_id=

fun system_id=(system_id: nullable String)

sax :: SAXLocatorImpl :: system_id=

Redefined properties

redef type SELF: SAXLocatorImpl

sax $ SAXLocatorImpl :: SELF

Type of this instance, automatically specialized in every class
redef fun column_number: Int

sax $ SAXLocatorImpl :: column_number

Return the column number where the current document event ends.
redef init init

sax $ SAXLocatorImpl :: init

Zero-argument constructor.
redef fun line_number: Int

sax $ SAXLocatorImpl :: line_number

Return the line number where the current document event ends.
redef fun public_id: nullable String

sax $ SAXLocatorImpl :: public_id

Return the public identifier for the current document event.
redef fun system_id: nullable String

sax $ SAXLocatorImpl :: system_id

Return the system identifier for the current document event.

All properties

fun !=(other: nullable Object): Bool

core :: Object :: !=

Have self and other different values?
fun ==(other: nullable Object): Bool

core :: Object :: ==

Have self and other the same value?
type CLASS: Class[SELF]

core :: Object :: CLASS

The type of the class of self.
type SELF: Object

core :: Object :: SELF

Type of this instance, automatically specialized in every class
protected fun class_factory(name: String): CLASS

core :: Object :: class_factory

Implementation used by get_class to create the specific class.
fun class_name: String

core :: Object :: class_name

The class name of the object.
abstract fun column_number: Int

sax :: SAXLocator :: column_number

Return the column number where the current document event ends.
fun column_number=(column_number: Int)

sax :: SAXLocatorImpl :: column_number=

init from(locator: SAXLocator)

sax :: SAXLocatorImpl :: from

Copy constructor.
fun get_class: CLASS

core :: Object :: get_class

The meta-object representing the dynamic type of self.
fun hash: Int

core :: Object :: hash

The hash code of the object.
init init

core :: Object :: init

fun inspect: String

core :: Object :: inspect

Developer readable representation of self.
protected fun inspect_head: String

core :: Object :: inspect_head

Return "CLASSNAME:#OBJECTID".
intern fun is_same_instance(other: nullable Object): Bool

core :: Object :: is_same_instance

Return true if self and other are the same instance (i.e. same identity).
fun is_same_serialized(other: nullable Object): Bool

core :: Object :: is_same_serialized

Is self the same as other in a serialization context?
intern fun is_same_type(other: Object): Bool

core :: Object :: is_same_type

Return true if self and other have the same dynamic type.
abstract fun line_number: Int

sax :: SAXLocator :: line_number

Return the line number where the current document event ends.
fun line_number=(line_number: Int)

sax :: SAXLocatorImpl :: line_number=

intern fun object_id: Int

core :: Object :: object_id

An internal hash code for the object based on its identity.
fun output

core :: Object :: output

Display self on stdout (debug only).
intern fun output_class_name

core :: Object :: output_class_name

Display class name on stdout (debug only).
abstract fun public_id: nullable String

sax :: SAXLocator :: public_id

Return the public identifier for the current document event.
fun public_id=(public_id: nullable String)

sax :: SAXLocatorImpl :: public_id=

fun serialization_hash: Int

core :: Object :: serialization_hash

Hash value use for serialization
intern fun sys: Sys

core :: Object :: sys

Return the global sys object, the only instance of the Sys class.
abstract fun system_id: nullable String

sax :: SAXLocator :: system_id

Return the system identifier for the current document event.
fun system_id=(system_id: nullable String)

sax :: SAXLocatorImpl :: system_id=

abstract fun to_jvalue(env: JniEnv): JValue

core :: Object :: to_jvalue

fun to_s: String

core :: Object :: to_s

User readable representation of self.
package_diagram sax::SAXLocatorImpl SAXLocatorImpl sax::SAXLocator SAXLocator sax::SAXLocatorImpl->sax::SAXLocator core::Object Object sax::SAXLocator->core::Object ...core::Object ... ...core::Object->core::Object

Ancestors

interface Object

core :: Object

The root of the class hierarchy.

Parents

interface SAXLocator

sax :: SAXLocator

Interface for associating a SAX event with a document location.

Class definitions

sax $ SAXLocatorImpl
# Provides an optional 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:
#
# ~~~nitish
# import sax::helpers::sax_locator_impl
# import sax::content_handler
#
# class Example super ContentHandler
#     private var locator: SAXLocator
#     private var start_loc: nullable SAXLocator = null
#
#     redef fun start_document do
#         # save the location of the start of the document
#         # for future use.
#         start_loc = new SAXLocatorImpl.from(locator)
#     end
# end
# ~~~
#
# 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.
#
# Note: The original source code and documentation of this class comes, in part,
# from [SAX 2.0](http://www.saxproject.org).
class SAXLocatorImpl super SAXLocator
	redef var public_id = null is writable
	redef var system_id = null is writable
	redef var line_number = -1 is writable
	redef var column_number = -1 is writable

	# Zero-argument constructor.
	#
	# This will not normally be useful, since the main purpose
	# of this class is to make a snapshot of an existing Locator.
	init do
	end

	# 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 (and it can be used outside the scope of
	# `ContentHandler` methods).
	#
	# Parameters:
	#
	# * `locator`: locator to copy.
	init from(locator: SAXLocator) do
		public_id = locator.public_id
		system_id = locator.system_id
		line_number = locator.line_number
		column_number = locator.column_number
	end
end
lib/sax/helpers/sax_locator_impl.nit:16,1--73,3