Eiffel Media API
Overview Cluster Class Classes Index      Previous Next      Top Features

em.goof.loader

Class EM_GOOF_LOADER_LEVEL_PARSER


Direct ancestors

EM_GOOF_LOADER_XML_INPUT_FILE_PARSER, EM_GOOF_LOADER_NODE_PROCESSOR_REGISTRY

Creation

Features

Invariants

indexing

description

XML parser for the goof level data.

date

$Date: 2005/10/23 10:25:26 $

revision

$Revision: 1.2 $

class

EM_GOOF_LOADER_LEVEL_PARSER

inherit

EM_GOOF_LOADER_XML_INPUT_FILE_PARSER
EM_GOOF_LOADER_NODE_PROCESSOR_REGISTRY

create

make_with_factory (a_goof_level_factory: EM_GOOF_LOADER_LEVEL_FACTORY)

-- Create parser with a_goof_level_factory.

require
a_goof_level_factory_exists: a_goof_level_factory /= Void

feature -- Initialization

make_with_factory (a_goof_level_factory: EM_GOOF_LOADER_LEVEL_FACTORY)

-- Create parser with a_goof_level_factory.

require
a_goof_level_factory_exists: a_goof_level_factory /= Void

feature -- Access

error_code: INTEGER

-- Code of error.

-- (From EM_GOOF_LOADER_ERROR_CONSTANTS)

error_description: STRING

-- Description of last parser error

-- (From EM_GOOF_LOADER_ERROR_CONSTANTS)

require
has_error: has_error
ensure
Result_exists: Result /= Void
Result_not_empty: not Result.is_empty
ensure then
Result_exists: Result /= Void
Result_not_empty: not Result.is_empty
file_name: STRING

-- Name of file where error occurred.

-- (From EM_GOOF_LOADER_ERROR_CONSTANTS)

root_element: XM_ELEMENT

-- Root element of document

-- (From EM_GOOF_LOADER_XML_INPUT_FILE_PARSER)

require
parsed: is_parsed
ensure
Result_exists: Result /= Void
xml_document: XM_DOCUMENT

-- Parsed XML document

-- (From EM_GOOF_LOADER_XML_INPUT_FILE_PARSER)

require
parsed: is_parsed
ensure
Result_exists: Result /= Void

feature -- Status report

can_process: BOOLEAN

-- Can document tree be processed?

-- (From EM_GOOF_LOADER_XML_INPUT_FILE_PARSER)

has_error: BOOLEAN

-- Did a parser error occur?

-- (From EM_GOOF_LOADER_ERROR_CONSTANTS)

has_file_name: BOOLEAN

-- Has a file name been set?

-- (From EM_GOOF_LOADER_XML_INPUT_FILE_PARSER)

is_parsed: BOOLEAN

-- Has a level been parsed?

-- (From EM_GOOF_LOADER_XML_INPUT_FILE_PARSER)

feature -- Status setting

level_factory: EM_GOOF_LOADER_LEVEL_FACTORY

-- Reference to the goof level factory.

-- (From EM_GOOF_LOADER_NODE_PROCESSOR_REGISTRY)

processor_registered (a_processor: EM_GOOF_LOADER_NODE_PROCESSOR): BOOLEAN

-- Is a_processor registered?

-- (From EM_GOOF_LOADER_NODE_PROCESSOR_REGISTRY)

set_file_name (a_name: STRING)

-- Set file name to a_name.

-- (From EM_GOOF_LOADER_XML_INPUT_FILE_PARSER)

require
file_name_valid: File_system.is_file_readable (a_name)
file_exists: File_system.file_exists (a_name)
ensure
file_name_set: has_file_name
not_parsed: not is_parsed
set_level_factory (a_factory: EM_GOOF_LOADER_LEVEL_FACTORY)

-- Set level reference.

-- (From EM_GOOF_LOADER_NODE_PROCESSOR_REGISTRY)

ensure
level_factory_set: level_factory = a_factory
set_working_directory

-- Set the current working directory to the place where the filename
-- comes from (needs to be done if dtd-files with relative paths should be accepted).

-- (From EM_GOOF_LOADER_XML_INPUT_FILE_PARSER)

require
file_name_set: has_file_name

feature -- Basic operations

parse

-- Parse level.

-- (From EM_GOOF_LOADER_XML_INPUT_FILE_PARSER)

require
file_name_set: has_file_name
ensure
parsed_if_no_error: not has_error implies is_parsed
process

-- Process document tree.

-- (From EM_GOOF_LOADER_XML_INPUT_FILE_PARSER)

require
processing_ready: can_process
register_allowed_subnode (a_parent_name: STRING; a_subnode_name: STRING)

-- Register processor with name a_subnode_name as allowed subnode of processor with name a_parent_name.
-- Use register_processor for new node types and
-- register_allowed_subnode for registering their subnode types.

-- (From EM_GOOF_LOADER_NODE_PROCESSOR_REGISTRY)

register_processor (a_processor: EM_GOOF_LOADER_NODE_PROCESSOR)

-- Register a_processor in registry.

-- (From EM_GOOF_LOADER_NODE_PROCESSOR_REGISTRY)

require
processor_exists: a_processor /= Void
not_registered: not processor_registered (a_processor)
ensure
registered: Processor_registry.has_item (a_processor)

feature -- File systems

file_system: KL_FILE_SYSTEM

-- Underlying file system

-- (From KL_SHARED_FILE_SYSTEM)

ensure
file_system_not_void: Result /= Void
current_file_system: Result.is_current_file_system
unix_file_system: KL_UNIX_FILE_SYSTEM

-- Unix-like file system

-- (From KL_SHARED_FILE_SYSTEM)

ensure
file_system_not_void: Result /= Void
windows_backslash_only_file_system: KL_WINDOWS_FILE_SYSTEM

-- Windows-like file system which accepts only \ as
-- directory separator

-- (From KL_SHARED_FILE_SYSTEM)

ensure
file_system_not_void: Result /= Void
windows_file_system: KL_WINDOWS_FILE_SYSTEM

-- Windows-like file system which accepts both
-- \ and / as directory separator

-- (From KL_SHARED_FILE_SYSTEM)

ensure
file_system_not_void: Result /= Void

feature {EM_GOOF_LOADER_ERROR_CONSTANTS} -- Implementation

slots: ARRAY [STRING]

-- Slots for additional information.

-- (From EM_GOOF_LOADER_ERROR_CONSTANTS)

invariant

can_process_definition: can_process = (is_parsed andhas_processor (root_element.name))

xml_parser_exists: xml_parser /= Void
tree_pipe_exists: tree_pipe /= Void
has_error_definition: has_error = ((error_code > 0) ornot xml_parser.is_correct)
has_file_name_definition: has_file_name = (file_name /= Void and thennot file_name.is_empty)
parsed_constraint: is_parsed implies has_file_name

error_constraint: error_code > 0 implies has_error
slot_constraint: error_code > 0 implies(slots /= Void and then is_complete (error_code, slots))
error_code_positive: error_code >= 0
non_empty_description: has_error implies (error_description /= Void andnot error_description.is_empty)

-- From ANY
reflexive_equality: standard_is_equal (Current)
reflexive_conformance: conforms_to (Current)

end