indexing description: "[ Parses the xml for the xae game object" ]" author: "Steiner Fabrizio" date: "$Date$" revision: "$Revision$" class GAME_PARSER inherit XML_INPUT_FILE_PARSER NODE_PROCESSOR_REGISTRY PARSER_INTERFACE create make_parser feature -- Initialization make_parser is -- Create the parser. do set_pool (create {OBJECT_POOL}.make) make from Processor_registry.start until Processor_registry.off loop Processor_registry.item_for_iteration.set_pool (pool) Processor_registry.forth end end feature -- Status report can_process: BOOLEAN is -- Can document tree be processed? do Result := is_parsed and then has_processor (root_element.name) end get_game: GAME is -- returns the game object build do result := game end set_filename(a_filename: STRING) is -- sets filename do set_file_name(a_filename) -- CHANGES -> linux-win -- pool.set_directory (File_system.absolute_parent_directory(a_filename) + "\") pool.set_directory (File_system.absolute_parent_directory(a_filename) + "/") end startparsing is -- starts parsing the file require else file_name /= void pool.get_directory /= void pool /= void do create game.make pool.clear_pool parse if not has_error then process end end error_string: STRING is -- returns error string do result := error_description end error_happened: BOOLEAN is -- has an error occurred do result := has_error end feature {NONE} game: GAME process is -- Process document tree. local p: NODE_PROCESSOR do p := processor (root_element.name) p.set_source (root_element) if p.has_error then set_error (p.error_code, p.slots) is_parsed := False end if not has_error then p.set_target(game) p.process if p.has_error then set_error (p.error_code, p.slots) is_parsed := False end end end invariant can_process_definition: can_process = (is_parsed and has_processor (root_element.name)) end