indexing
	description: "Registry manager"
	status: "See notice at end of class"
	date: "$Date$"
	revision: "$Revision$"
	note: "Changed the type of Keys from INTEGER to POINTER"

class interface
	WEL_REGISTRY

feature -- Access

	default_key_value (key: POINTER; path: STRING): WEL_REGISTRY_KEY_VALUE
			-- Retrieve value of value_name associated with open
			-- key.
		require
			key_possible: valid_value_for_hkey (key)

	enumerate_key (key: POINTER; index: INTEGER): WEL_REGISTRY_KEY
			-- indexth subkey of key,
			-- Void if key has less than index subkeys.
		require
			key_possible: valid_value_for_hkey (key)
			index_possible: index <= number_of_subkeys (key)

	hkey_classes_root: POINTER
			-- (from WEL_HKEY)

	hkey_current_config: POINTER
			-- (from WEL_HKEY)

	hkey_current_user: POINTER
			-- (from WEL_HKEY)

	hkey_dyn_data: POINTER
			-- (from WEL_HKEY)

	hkey_local_machine: POINTER
			-- (from WEL_HKEY)

	hkey_performance_data: POINTER
			-- (from WEL_HKEY)

	hkey_users: POINTER
			-- (from WEL_HKEY)

	key_from_remote_host (host_name: STRING; root_key: POINTER): POINTER
			-- Connect the computer designed by its name 'host_name'.
			-- 'Host_name' should be under the format: \\computer_name
			-- 'root_key' is the key from where we want to start the
			-- investigations on the remote machine.
			-- If 'Host_name' is empty, then the local computer is used by default.
		require
			root_key_possible: root_key = hkey_local_machine or root_key = hkey_users or root_key = hkey_performance_data
			host_name_possible: host_name /= void

	key_value (key: POINTER; value_name: STRING): WEL_REGISTRY_KEY_VALUE
			-- Retrieve value of value_name associated with open
			-- key.
			-- The identifier 'key' relative to the parent key must
			-- have been opened with the KEY_QUERY_VALUE access.
		require
			value_name_possible: value_name /= void and then not value_name.is_empty
			key_valid: valid_value_for_hkey (key)
	
feature -- Actions

	create_new_key (key_path: STRING)
			-- Create a new key, with as path 'path'
			-- The path should be like "a\b\c"
			-- Please refer to WEL_HKEY for possible value for a.
		require
			at_least_one_back_slash: key_path /= void and then key_path.has ('\')

	open_key_value (key_path: STRING; value_name: STRING): WEL_REGISTRY_KEY_VALUE
			-- Open a key, with as path 'path' and
			-- name 'key_name'.
			-- The path should be like "a\b\c"
			-- Please refer to WEL_HKEY for possible value for a.
			-- Return Void if the operation did not correctly terminate.
		require
			key_name_possible: value_name /= void and then not value_name.is_empty
			at_least_one_back_slash: key_path /= void and then key_path.has ('\')

	open_key_with_access (key_path: STRING; acc: INTEGER): POINTER
			-- Open the key relative to the path 'key_path', with
			-- the access 'acc'.
			-- Return the key reference (defaul_pointer if the operation failed).
		require
			at_least_one_back_slash: key_path /= void and then key_path.has ('\')
	
feature -- Basic Actions

	close_key (key: POINTER)
			-- Close key.
			-- Return True if succeeded, False otherwise.
		require
			key_possible: valid_value_for_hkey (key)

	create_key (parent_key: POINTER; key_name: STRING; sam: INTEGER): POINTER
			-- Create key_name under parent_key according to sam.
			-- Return handle to created key or default_pointer on failure.
		require
			key_name_possible: key_name /= void and then not key_name.is_empty
			parent_key_possible: valid_value_for_hkey (parent_key)

	delete_key (parent_key: POINTER; key_name: STRING)
			-- Delete subkey key_name of parent_key.
			-- Return True if succeeded, False otherwise.
			-- Under Windows 95, all subkeys are deleted.
			-- Under Windows NT, only specified key is deleted
			-- it should not have subkeys.
		require
			key_name_possible: key_name /= void and then not key_name.is_empty
			parent_key_possible: valid_value_for_hkey (parent_key)

	enumerate_values (key: POINTER): LINKED_LIST [STRING]
			-- Find the names of the key values within the
			-- key referenced by 'key'.

	open_key (parent_key: POINTER; key_name: STRING; access_mode: INTEGER): POINTER
			-- Open subkey key_name of parent_key according to access_mode.
			-- Return handle to created key or default_pointer on failure.
		require
			key_name_possible: key_name /= void and then not key_name.is_empty
			parent_key_possible: valid_value_for_hkey (parent_key)
	
feature -- New actions

	delete_value (parent_key: POINTER; name: STRING)
		require
			key_possible: valid_value_for_hkey (parent_key)
			name_possible: name /= void

	enumerate_value (key: POINTER; index: INTEGER): STRING
			-- Find the name of the key_value corresponding
			-- to the key 'key and the index 'index'.

	number_of_subkeys (key: POINTER): INTEGER

	number_of_values (key: POINTER): INTEGER

	valid_value_for_hkey (key: POINTER): BOOLEAN
			-- Does key pointed by 'key' exists
	
feature -- Settings

	set_key_value (key: POINTER; value_name: STRING; value: WEL_REGISTRY_KEY_VALUE)
			-- Change value defined by key and value_name to value.
			-- The key identified by the hKey parameter must have been
			-- opened with KEY_SET_VALUE access
		require
			valid_value: value /= void
			valid_value_name: value_name /= void
			key_possible: valid_value_for_hkey (key)
	
feature -- Status

	basic_valid_name_for_hkey (name: STRING): BOOLEAN
			-- Return TRUE if 'name' correspond to one of the
			-- value names below.
			-- (from WEL_HKEY)
		require -- from WEL_HKEY
			name_possible: name /= void

	basic_valid_value_for_hkey (value: POINTER): BOOLEAN
			-- Return TRUE if 'value' is one of the basic following values.
			-- (from WEL_HKEY)

	index_value_for_root_keys (name: STRING): POINTER
			-- Return the index corresponding to a root key.
			-- (from WEL_HKEY)
		require -- from WEL_HKEY
			name_possible: name /= void and then basic_valid_name_for_hkey (name)

	last_call_successful: BOOLEAN
			-- Did last call succeed?
	
invariant

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

end -- class WEL_REGISTRY