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

em.goof.loader

Class EM_GOOF_LOADER_OBJECT_NODE_PROCESSOR


Direct ancestors

EM_GOOF_LOADER_NODE_PROCESSOR

Creation

Features

Invariants

indexing

description

An EM_GOOF_LOADER_NODE_PROCESSOR to load the EM_GOOF_OBJECT section from xml file.

date

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

revision

$Revision: 1.3 $

class

EM_GOOF_LOADER_OBJECT_NODE_PROCESSOR

inherit

EM_GOOF_LOADER_NODE_PROCESSOR

create

make

-- Make 'Current'

-- (From EM_GOOF_LOADER_NODE_PROCESSOR)

ensure
subnodes_exist: subnodes /= Void
reset: is_reset

feature -- Initialization

make

-- Make 'Current'

-- (From EM_GOOF_LOADER_NODE_PROCESSOR)

ensure
subnodes_exist: subnodes /= Void
reset: is_reset

feature -- Access

mandatory_attributes: ARRAY [STRING]

-- Table of mandatory attributes

-- (From EM_GOOF_LOADER_NODE_PROCESSOR)

ensure
Result_exists: Result /= Void
object_comparison: Result.object_comparison
name: STRING

-- Name of element to process

-- (From EM_GOOF_LOADER_NODE_PROCESSOR)

ensure
name_exists: Result /= Void
name_not_empty: not Result.is_empty
allowed_subnode_types: ARRAY [STRING]

-- Table of allowed subnode types.

-- (From EM_GOOF_LOADER_NODE_PROCESSOR)

ensure
Result_exists: Result /= Void
object_comparison: Result.object_comparison
attribute (a_name: STRING): STRING

-- Attribute named a_name.

-- (From EM_GOOF_LOADER_NODE_PROCESSOR)

require
has_source: has_source
name_exists: a_name /= Void
name_not_empty: not a_name.is_empty
has_attribute: has_attribute (a_name)
ensure
Result_exists: Result /= Void
attribute_boolean (a_name: STRING): BOOLEAN

-- Boolean attribute named a_name.

-- (From EM_GOOF_LOADER_NODE_PROCESSOR)

require
has_source: has_source
name_exists: a_name /= Void
name_not_empty: not a_name.is_empty
has_attribute: has_attribute (a_name)
is_boolean: is_attribute_boolean (a_name)
attribute_double (a_name: STRING): DOUBLE

-- Double attribute named a_name.

-- (From EM_GOOF_LOADER_NODE_PROCESSOR)

require
has_source: has_source
name_exists: a_name /= Void
name_not_empty: not a_name.is_empty
has_attribute: has_attribute (a_name)
is_double: is_attribute_double (a_name)
attribute_integer (a_name: STRING): INTEGER

-- Integer attribute named a_name.

-- (From EM_GOOF_LOADER_NODE_PROCESSOR)

require
has_source: has_source
name_exists: a_name /= Void
name_not_empty: not a_name.is_empty
has_attribute: has_attribute (a_name)
is_integer: is_attribute_integer (a_name)
container: EM_GOOF_CONTAINER

-- 'Container' for adding object (use if /= void)

-- (From EM_GOOF_LOADER_NODE_PROCESSOR)

data: ANY

-- Data from subnodes for parent.

-- (From EM_GOOF_LOADER_NODE_PROCESSOR)

error_code: INTEGER

-- Code of error.

-- (From EM_GOOF_LOADER_ERROR_CONSTANTS)

error_description: STRING

-- Textual description of error.

-- (From EM_GOOF_LOADER_ERROR_CONSTANTS)

require
has_error: has_error
ensure
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)

source: XM_ELEMENT

-- Source to process.

-- (From EM_GOOF_LOADER_NODE_PROCESSOR)

subnodes: LIST [XM_ELEMENT]

-- List of subnodes.

-- (From EM_GOOF_LOADER_NODE_PROCESSOR)

target: ANY

--CITY_ELEMENT
-- Target to build.

-- (From EM_GOOF_LOADER_NODE_PROCESSOR)

text: STRING

-- Text of element.

-- (From EM_GOOF_LOADER_NODE_PROCESSOR)

require
has_source: has_source
has_text: has_text
ensure
Result_exists: Result /= Void

feature -- Measurement

subnode_count: INTEGER

-- Number of subnodes.

-- (From EM_GOOF_LOADER_NODE_PROCESSOR)

feature -- Status report

has_attribute (a_name: STRING): BOOLEAN

-- Is there an attribute named a_name?

-- (From EM_GOOF_LOADER_NODE_PROCESSOR)

require
has_source: has_source
name_exists: a_name /= Void
name_not_empty: not a_name.is_empty
has_error: BOOLEAN

-- Did an error occur?

-- (From EM_GOOF_LOADER_ERROR_CONSTANTS)

has_parent: BOOLEAN

-- Is a parent set?

-- (From EM_GOOF_LOADER_NODE_PROCESSOR)

has_source: BOOLEAN

-- Is a source set?

-- (From EM_GOOF_LOADER_NODE_PROCESSOR)

has_subnodes: BOOLEAN

-- Are there any subnodes?

-- (From EM_GOOF_LOADER_NODE_PROCESSOR)

has_target: BOOLEAN

-- Is a target set?

-- (From EM_GOOF_LOADER_NODE_PROCESSOR)

has_text: BOOLEAN

-- Does element have text attached?

-- (From EM_GOOF_LOADER_NODE_PROCESSOR)

is_attribute_boolean (a_name: STRING): BOOLEAN

-- Is attribute named a_name a boolean?

-- (From EM_GOOF_LOADER_NODE_PROCESSOR)

require
has_source: has_source
name_exists: a_name /= Void
name_not_empty: not a_name.is_empty
has_attribute: has_attribute (a_name)
is_attribute_double (a_name: STRING): BOOLEAN

-- Is attribute named a_name a double?

-- (From EM_GOOF_LOADER_NODE_PROCESSOR)

require
has_source: has_source
name_exists: a_name /= Void
name_not_empty: not a_name.is_empty
has_attribute: has_attribute (a_name)
is_attribute_integer (a_name: STRING): BOOLEAN

-- Is attribute named a_name an integer?

-- (From EM_GOOF_LOADER_NODE_PROCESSOR)

require
has_source: has_source
name_exists: a_name /= Void
name_not_empty: not a_name.is_empty
has_attribute: has_attribute (a_name)
is_reset: BOOLEAN

-- Is processor in default state?

-- (From EM_GOOF_LOADER_NODE_PROCESSOR)

valid_source (an_element: XM_ELEMENT): BOOLEAN

-- Is an_element a valid source?

-- (From EM_GOOF_LOADER_NODE_PROCESSOR)

require
source_exists: an_element /= Void

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)

reset

-- Reset processor.

-- (From EM_GOOF_LOADER_NODE_PROCESSOR)

ensure
reset: is_reset
set_error (a_code: INTEGER; an_error_string_array: ARRAY [STRING])

-- Set error to a_code with additional information an_error_string_array.

-- (From EM_GOOF_LOADER_ERROR_CONSTANTS)

require
error_code_positive: a_code >= 0
array_exists: an_error_string_array /= Void
complete: is_complete (a_code, an_error_string_array)
ensure
error_code_set: error_code = a_code
slots_set: slots = an_error_string_array
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_parent (a_parent: like parent)

-- Set parent to a_parent.

-- (From EM_GOOF_LOADER_NODE_PROCESSOR)

ensure
parent_set: parent = a_parent
set_source (an_element: XM_ELEMENT)

-- Set source to an_element.

-- (From EM_GOOF_LOADER_NODE_PROCESSOR)

require
an_element_exists: an_element /= Void
an_element_valid: valid_source (an_element)
ensure
source_set: source = an_element
set_target (a_target: like target)

-- Set target to a_target.

-- (From EM_GOOF_LOADER_NODE_PROCESSOR)

ensure
target_set: target = a_target

feature -- Basic operations

file: STRING

-- String in which the filename is stored

process

-- Process node.

-- (From EM_GOOF_LOADER_NODE_PROCESSOR)

require
has_source: has_source
no_error: not has_error
process_subnodes

-- Process subnodes.

-- (From EM_GOOF_LOADER_NODE_PROCESSOR)

require
has_source: has_source
no_error: not has_error
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)
send_data (a_data: ANY)

-- Store a_data.

-- (From EM_GOOF_LOADER_NODE_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

subnodes_exist: subnodes /= Void
subnode_count_definition: subnode_count = subnodes.count
has_subnode_definition: has_subnodes = (subnode_count > 0)
has_source_definition: has_source = (source /= Void)
has_target_definition: has_target = (target /= Void)
has_parent_definition: has_parent = (parent /= Void)
has_text_definition: has_text = (has_source and then source.text /= Void)
source_valid: has_source implies valid_source (source)

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

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)

end