indexing
	cluster: "demangler"
	namespace: "candidate"
	description: "Factory for reports."
	original_author: "Justin Finnerty"
	original_date: "July 2005"
	current_date: "$Date: 2005/10/28 04:21:50 $"
	current_author: "$Author: finnerty $"
	revision: "$Revision: 2.3 $"	
	-- $Log: report_factory.ge,v $
	-- Revision 2.3  2005/10/28 04:21:50  finnerty
	-- Added information for the new DEARCH_REPORT.
	--
	-- Revision 2.2  2005/09/30 06:49:12  finnerty
	-- Finalised for alpha release with SE and VE compilers
	--
	-- Revision 2.1  2005/09/06 22:58:52  finnerty
	-- Renamed *.e to *.ge for gepp
	--
	-- Revision 2.0  2005/08/26 23:31:39  finnerty
	-- == alpha version ==
	--
	-- Revision 1.1  2005/08/24 12:33:13  finnerty
	-- Factory for SYNC_REPORTs. This also adds the configuration options for
	-- SYNC_REPORT subtypes (which allows them to be present before any
	-- report object is created).
	--

class REPORT_FACTORY
	-- Create reports

#ifdef SE
insert
#else
inherit
#endif
CONFIGURATION_STATUS

creation {ANY}
	make
	
feature {ANY}
	-- queries
	add_reports_to (a_dir: SYNCHRONISED_DIRECTORY) is
			-- Add all reports to a_dir
		local
			l_report: SYNC_REPORT
		do
			if config_manager.has ("no-filedup") and then
				not config_manager.item ("no-filedup").is_set then
				!DEDUP_REPORT!l_report.make_dedup_report (a_dir)
				if l_report.sync_dir = a_dir then
					a_dir.reports.put_last (l_report)
				end
			end
			if config_manager.has ("no-compdup") and then
				not config_manager.item ("no-compdup").is_set then
				!DEBUZ_REPORT!l_report.make_debuz_report (a_dir)
				if l_report.sync_dir = a_dir then
					a_dir.reports.put_last (l_report)
				end
			end
			if config_manager.has ("no-archdup") and then
				not config_manager.item ("no-archdup").is_set then
				!DEARCH_REPORT!l_report.make_dearch_report (a_dir)
				if l_report.sync_dir = a_dir then
					a_dir.reports.put_last (l_report)
				end
			end
			if config_manager.has ("no-dirdup") and then
				not config_manager.item ("no-dirdup").is_set then
				!DIRDUP_REPORT!l_report.make_dirdup_report (a_dir)
				if l_report.sync_dir = a_dir then
					a_dir.reports.put_last (l_report)
				end
			end
			-- Add other reports...
		end
	
feature {REPORT_FACTORY}
	-- Creation method
	make is
			-- Initialise attributes to valid values
		do
			add_config
		end

feature {REPORT_FACTORY}
	-- Hidden methods
	add_config is
			-- Add configuration options for SYNC_REPORTS
		local
			l_option: CONFIGURATION_OPTION
		once
			if not config_manager.has ("no-filedup") then
				!!l_option.make("no-filedup"
									 , "Do not attempt to find duplicated backup files"
									 , "No duplicate test")
				l_option.set_default_value ("no-filedup")
				l_option.set_is_boolean
				l_option.set_tab_label ("Report")
				config_manager.force (l_option, l_option.name)
			end
			if not config_manager.has ("no-compdup") then
				!!l_option.make("no-compdup"
									 , "Do not attempt to find files with a compressed duplicate version."
									 , "No compressed duplicate test")
				l_option.set_default_value ("no-compdup")
				l_option.set_is_boolean
				l_option.set_tab_label ("Report")
				config_manager.force (l_option, l_option.name)
			end
			if not config_manager.has ("no-archdup") then
				!!l_option.make("no-archdup"
									 , "Do not attempt to find duplicated archive files."
									 , "No duplicate archive test")
				l_option.set_default_value ("no-archdup")
				l_option.set_is_boolean
				l_option.set_tab_label ("Report")
				config_manager.force (l_option, l_option.name)
			end
			if not config_manager.has ("no-dirdup") then
				!!l_option.make("no-dirdup"
									 , "Do not attempt to find duplicated directory trees."
									 , "No directory duplicate test")
				l_option.set_default_value ("no-dirdup")
				l_option.set_is_boolean
				l_option.set_tab_label ("Report")
				config_manager.force (l_option, l_option.name)
			 end
			 if not config_manager.has ("backup-suffix") then
				 !!l_option.make ("backup-suffix"
										, "A ':' separated list of backup filename suffixes."
										, "List of backup suffixes" )
				 l_option.set_default_value (".bak:~:.~1~:.~2~:.~3~")
				 l_option.set_tab_label ("Report")
				 config_manager.force (l_option, l_option.name)
			 end
			 if not config_manager.has ("compress-suffix") then
				 !!l_option.make ("compress-suffix"
										, "A ':' separated list of compressed filename suffixes."
										, "List of compressed suffixes" )
				 l_option.set_default_value (".gz:.bz2")
				 l_option.set_tab_label ("Report")
				 config_manager.force (l_option, l_option.name)
			 end
			 if not config_manager.has ("archive-suffix") then
				 !!l_option.make ("archive-suffix"
										, "A ':' separated list of archive filename suffixes."
										, "List of archive suffixes" )
				 l_option.set_default_value (".tar:.tar.gz:.tar.bz2:.tgz:.tbz2:.rpm:.zip")
				 l_option.set_tab_label ("Report")
				 config_manager.force (l_option, l_option.name)
			 end
			 if not config_manager.has ("duplicate-cutoff") then
				 !!l_option.make ("duplicate-cutoff"
										, "The maximum number of files with the same name to consider as potential leads for finding duplicate branches."
										, "Number of files with same name before exclude in duplicate directory report." )
				 l_option.set_default_value ("10")
				 l_option.set_tab_label ("Report")
				 config_manager.force (l_option, l_option.name)
			 end
			 --  if not config_manager.has ("list_of_ignored_names") then
			 -- 	 !!l_option.make ("list_of_ignored_names"
			 -- 							, "A ':' separated list for common filenames to exclude when trying to find duplicate directories."
			 -- 							, "List of common filenames." )
			 -- 	 l_option.set_default_value ("CVS:Makefile:makefile:core")
			 -- 	 l_option.set_tab_label ("Report")
			 -- 	 config_manager.force (l_option, l_option.name)
			 --  end
		end
end -- class REPORT_FACTORY
