Automatic generation produced by ISE Eiffel
note description: "Windows Registry preferences storage implementation." legal: "See notice at end of class." status: "See notice at end of class." class interface PREFERENCES_STORAGE_DEFAULT create make_empty -- Create preferences storage in the registry. Registry key created base on name of application -- in HKEY_CURRENT_USER\Software\. So location will be HKEY_CURRENT_USER\Software\APPLICATION_NAME_HERE -- (from PREFERENCES_STORAGE_REGISTRY) ensure -- from PREFERENCES_STORAGE_I has_location: location /= Void default_version: version.same_string (default_version) make_versioned (a_version: attached like version) -- Create preferences storage with a_version as `version`. -- Location to store preferences will be generated based on name of application. -- Redefine `make_empty` to change behavior. -- (from PREFERENCES_STORAGE_I) require -- from PREFERENCES_STORAGE_I a_version_not_void: a_version /= Void a_version_valid: valid_version (a_version) ensure -- from PREFERENCES_STORAGE_I has_location: location /= Void version_set: version = a_version make_with_location (a_location: READABLE_STRING_GENERAL) -- Create preference storage in the at location a_location. -- Try to read preference at a_location if it exists, if not create new one. -- Preferences will be stored in a_location between sessions, which is the -- path to either: -- * the root registry key where preferences are stored, -- * or the file where preferences are stored, -- depending on which storage is chosen (registry or xml ... ). -- (from PREFERENCES_STORAGE_I) require -- from PREFERENCES_STORAGE_I location_not_void: a_location /= Void location_not_empty: not a_location.is_empty ensure -- from PREFERENCES_STORAGE_I has_location: location /= Void location_set: location = a_location default_version: version.same_string (default_version) make_with_location_and_version (a_location: READABLE_STRING_GENERAL; a_version: attached like version) -- Create preference storage in the at location a_location with a_version as `version`. -- Try to read preference at a_location if it exists, if not create new one. -- Preferences will be stored in a_location between sessions, which is the -- path to either: -- * the root registry key where preferences are stored, -- * or the file where preferences are stored, -- depending on which storage is chosen (registry or xml ... ). -- Redefine `make_with_location` to change behavior. -- (from PREFERENCES_STORAGE_I) require -- from PREFERENCES_STORAGE_I location_not_void: a_location /= Void location_not_empty: not a_location.is_empty a_version_not_void: a_version /= Void a_version_valid: valid_version (a_version) ensure -- from PREFERENCES_STORAGE_I has_location: location /= Void location_set: location = a_location version_set: version = a_version feature -- Access default_version: IMMUTABLE_STRING_32 -- Default version if none specified. -- (from PREFERENCES_VERSIONS) enumerate_key (key: POINTER; index: INTEGER_32): detachable WEL_REGISTRY_KEY -- indexth subkey of key, -- Void if key has less than index subkeys. -- (from WEL_REGISTRY) require -- from WEL_REGISTRY key_possible: valid_value_for_hkey (key) index_non_negative: index >= 0 index_less_than_count: index < number_of_subkeys (key) generating_type: TYPE [detachable PREFERENCES_STORAGE_DEFAULT] -- Type of current object -- (type of which it is a direct instance) -- (from ANY) ensure -- from ANY generating_type_not_void: Result /= Void generator: STRING_8 -- Name of current object's generating class -- (base class of the type of which it is a direct instance) -- (from ANY) ensure -- from ANY generator_not_void: Result /= Void generator_not_empty: not Result.is_empty frozen hkey_classes_root: POINTER -- (from WEL_HKEY) ensure -- from WEL_HKEY is_class: class frozen hkey_current_config: POINTER -- (from WEL_HKEY) ensure -- from WEL_HKEY is_class: class frozen hkey_current_user: POINTER -- (from WEL_HKEY) ensure -- from WEL_HKEY is_class: class frozen hkey_dyn_data: POINTER -- (from WEL_HKEY) ensure -- from WEL_HKEY is_class: class frozen hkey_local_machine: POINTER -- (from WEL_HKEY) ensure -- from WEL_HKEY is_class: class frozen hkey_performance_data: POINTER -- (from WEL_HKEY) ensure -- from WEL_HKEY is_class: class frozen hkey_users: POINTER -- (from WEL_HKEY) ensure -- from WEL_HKEY is_class: class frozen key_all_access: INTEGER_32 -- Combines the KEY_QUERY_VALUE, KEY_ENUMERATE_SUB_KEYS, -- KEY_NOTIFY, KEY_CREATE_SUB_KEY, KEY_CREATE_LINK, and -- KEY_SET_VALUE access rights, plus all the standard -- access rights except SYNCHRONIZE. -- (from WEL_REGISTRY_ACCESS_MODE) ensure -- from WEL_REGISTRY_ACCESS_MODE is_class: class frozen key_create_link: INTEGER_32 -- Permission to create a symbolic link. -- (from WEL_REGISTRY_ACCESS_MODE) ensure -- from WEL_REGISTRY_ACCESS_MODE is_class: class frozen key_create_sub_key: INTEGER_32 -- Permission to create subkeys. -- (from WEL_REGISTRY_ACCESS_MODE) ensure -- from WEL_REGISTRY_ACCESS_MODE is_class: class frozen key_enumerate_sub_keys: INTEGER_32 -- Permission to enumerate subkeys. -- (from WEL_REGISTRY_ACCESS_MODE) ensure -- from WEL_REGISTRY_ACCESS_MODE is_class: class frozen key_execute: INTEGER_32 -- Permission for read access. -- (from WEL_REGISTRY_ACCESS_MODE) ensure -- from WEL_REGISTRY_ACCESS_MODE is_class: class key_from_remote_host (host_name: READABLE_STRING_GENERAL; 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. -- (from WEL_REGISTRY) require -- from WEL_REGISTRY 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 frozen key_notify: INTEGER_32 -- Permission for change notification. -- (from WEL_REGISTRY_ACCESS_MODE) ensure -- from WEL_REGISTRY_ACCESS_MODE is_class: class frozen key_query_value: INTEGER_32 -- Permission to query subkey data. -- (from WEL_REGISTRY_ACCESS_MODE) ensure -- from WEL_REGISTRY_ACCESS_MODE is_class: class frozen key_read: INTEGER_32 -- Combines the STANDARD_RIGHTS_READ, KEY_QUERY_VALUE, -- KEY_ENUMERATE_SUB_KEYS, and KEY_NOTIFY access rights. -- (from WEL_REGISTRY_ACCESS_MODE) ensure -- from WEL_REGISTRY_ACCESS_MODE is_class: class frozen key_set_value: INTEGER_32 -- Permission to set subkey data. -- (from WEL_REGISTRY_ACCESS_MODE) ensure -- from WEL_REGISTRY_ACCESS_MODE is_class: class key_value (key: POINTER; value_name: READABLE_STRING_GENERAL): detachable 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. -- (from WEL_REGISTRY) require -- from WEL_REGISTRY value_name_possible: value_name /= Void key_valid: valid_value_for_hkey (key) Key_wow64_32key: INTEGER_32 = 512 -- Access to a 32-bit key from either a 32-bit or 64-bit application. -- (from WEL_REGISTRY_ACCESS_MODE) Key_wow64_64key: INTEGER_32 = 256 -- Access to a 64-bit key from either a 32-bit or 64-bit application. -- (from WEL_REGISTRY_ACCESS_MODE) frozen key_write: INTEGER_32 -- Combines the STANDARD_RIGHTS_WRITE, KEY_SET_VALUE, -- and KEY_CREATE_SUB_KEY access rights. -- (from WEL_REGISTRY_ACCESS_MODE) ensure -- from WEL_REGISTRY_ACCESS_MODE is_class: class version: IMMUTABLE_STRING_32 -- Format version. -- (from PREFERENCES_STORAGE_I) Version_1_0: IMMUTABLE_STRING_32 -- (from PREFERENCES_VERSIONS) Version_2_0: IMMUTABLE_STRING_32 -- (from PREFERENCES_VERSIONS) feature -- Comparison frozen deep_equal (a: detachable ANY; b: like arg #1): BOOLEAN -- Are a and b either both void -- or attached to isomorphic object structures? -- (from ANY) ensure -- from ANY instance_free: class shallow_implies_deep: standard_equal (a, b) implies Result both_or_none_void: (a = Void) implies (Result = (b = Void)) same_type: (Result and (a /= Void)) implies (b /= Void and then a.same_type (b)) symmetric: Result implies deep_equal (b, a) frozen equal (a: detachable ANY; b: like arg #1): BOOLEAN -- Are a and b either both void or attached -- to objects considered equal? -- (from ANY) ensure -- from ANY instance_free: class definition: Result = (a = Void and b = Void) or else ((a /= Void and b /= Void) and then a.is_equal (b)) frozen is_deep_equal alias "≡≡≡" (other: PREFERENCES_STORAGE_DEFAULT): BOOLEAN -- Are Current and other attached to isomorphic object structures? -- (from ANY) require -- from ANY other_not_void: other /= Void ensure -- from ANY shallow_implies_deep: standard_is_equal (other) implies Result same_type: Result implies same_type (other) symmetric: Result implies other.is_deep_equal (Current) is_equal (other: PREFERENCES_STORAGE_DEFAULT): BOOLEAN -- Is other attached to an object considered -- equal to current object? -- (from ANY) require -- from ANY other_not_void: other /= Void ensure -- from ANY symmetric: Result implies other ~ Current consistent: standard_is_equal (other) implies Result frozen standard_equal (a: detachable ANY; b: like arg #1): BOOLEAN -- Are a and b either both void or attached to -- field-by-field identical objects of the same type? -- Always uses default object comparison criterion. -- (from ANY) ensure -- from ANY instance_free: class definition: Result = (a = Void and b = Void) or else ((a /= Void and b /= Void) and then a.standard_is_equal (b)) frozen standard_is_equal alias "≜" (other: PREFERENCES_STORAGE_DEFAULT): BOOLEAN -- Is other attached to an object of the same type -- as current object, and field-by-field identical to it? -- (from ANY) require -- from ANY other_not_void: other /= Void ensure -- from ANY same_type: Result implies same_type (other) symmetric: Result implies other.standard_is_equal (Current) feature -- Status report conforms_to (other: ANY): BOOLEAN -- Does type of current object conform to type -- of other (as per Eiffel: The Language, chapter 13)? -- (from ANY) require -- from ANY other_not_void: other /= Void same_type (other: ANY): BOOLEAN -- Is type of current object identical to type of other? -- (from ANY) require -- from ANY other_not_void: other /= Void ensure -- from ANY definition: Result = (conforms_to (other) and other.conforms_to (Current)) valid_version (a_version: detachable IMMUTABLE_STRING_32): BOOLEAN -- Is a_version a supported version? -- (from PREFERENCES_VERSIONS) feature -- Duplication copy (other: PREFERENCES_STORAGE_DEFAULT) -- Update current object using fields of object attached -- to other, so as to yield equal objects. -- (from ANY) require -- from ANY other_not_void: other /= Void type_identity: same_type (other) ensure -- from ANY is_equal: Current ~ other frozen deep_copy (other: PREFERENCES_STORAGE_DEFAULT) -- Effect equivalent to that of: -- `copy` (other . `deep_twin`) -- (from ANY) require -- from ANY other_not_void: other /= Void ensure -- from ANY deep_equal: deep_equal (Current, other) frozen deep_twin: PREFERENCES_STORAGE_DEFAULT -- New object structure recursively duplicated from Current. -- (from ANY) ensure -- from ANY deep_twin_not_void: Result /= Void deep_equal: deep_equal (Current, Result) frozen standard_copy (other: PREFERENCES_STORAGE_DEFAULT) -- Copy every field of other onto corresponding field -- of current object. -- (from ANY) require -- from ANY other_not_void: other /= Void type_identity: same_type (other) ensure -- from ANY is_standard_equal: standard_is_equal (other) frozen standard_twin: PREFERENCES_STORAGE_DEFAULT -- New object field-by-field identical to other. -- Always uses default copying semantics. -- (from ANY) ensure -- from ANY standard_twin_not_void: Result /= Void equal: standard_equal (Result, Current) frozen twin: PREFERENCES_STORAGE_DEFAULT -- New object equal to Current -- `twin` calls `copy`; to change copying/twinning semantics, redefine `copy`. -- (from ANY) ensure -- from ANY twin_not_void: Result /= Void is_equal: Result ~ Current feature -- Basic operations frozen default: detachable PREFERENCES_STORAGE_DEFAULT -- Default value of object's type -- (from ANY) frozen default_pointer: POINTER -- Default value of type POINTER -- (Avoid the need to write p.`default` for -- some p of type POINTER.) -- (from ANY) ensure -- from ANY instance_free: class default_rescue -- Process exception for routines with no Rescue clause. -- (Default: do nothing.) -- (from ANY) frozen do_nothing -- Execute a null action. -- (from ANY) ensure -- from ANY instance_free: class feature -- Actions create_new_key (key_path: READABLE_STRING_GENERAL) -- 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. -- (from WEL_REGISTRY) require -- from WEL_REGISTRY at_least_one_back_slash: key_path /= Void and then key_path.has_code (('\').natural_32_code) delete_key_value (key_path, value_name: READABLE_STRING_GENERAL) -- Delete key_path key value value_name. -- The path should be like "a\b\c" -- Please refer to WEL_HKEY for possible value for a. -- (from WEL_REGISTRY) require -- from WEL_REGISTRY at_least_one_back_slash: key_path /= Void and then key_path.has_code (('\').natural_32_code) key_name_possible: value_name /= Void open_key_value (key_path: READABLE_STRING_GENERAL; value_name: READABLE_STRING_GENERAL): detachable 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. -- (from WEL_REGISTRY) require -- from WEL_REGISTRY key_name_possible: value_name /= Void at_least_one_back_slash: key_path /= Void and then key_path.has_code (('\').natural_32_code) open_key_with_access (key_path: READABLE_STRING_GENERAL; acc: INTEGER_32): POINTER -- Open the key relative to the path 'key_path', with -- the access 'acc'. -- Return the key reference (default_pointer if the operation failed). -- (from WEL_REGISTRY) require -- from WEL_REGISTRY at_least_one_back_slash: key_path /= Void and then key_path.has_code (('\').natural_32_code) save_key_value (key_path, value_name: READABLE_STRING_GENERAL; value: WEL_REGISTRY_KEY_VALUE) -- Set value of key in key_path with name value_name to value. -- Create key if needed. -- The path should be like "a\b\c" -- Please refer to WEL_HKEY for possible value for a. -- (from WEL_REGISTRY) require -- from WEL_REGISTRY at_least_one_back_slash: key_path /= Void and then key_path.has_code (('\').natural_32_code) key_name_possible: value_name /= Void valid_value: value /= Void feature -- Basic Actions close_key (key: POINTER) -- Close key. -- Return True if succeeded, False otherwise. -- (from WEL_REGISTRY) require -- from WEL_REGISTRY key_possible: valid_value_for_hkey (key) create_key (parent_key: POINTER; key_name: READABLE_STRING_GENERAL; sam: INTEGER_32): POINTER -- Create key_name under parent_key according to sam. -- Return handle to created key or default_pointer on failure. -- (from WEL_REGISTRY) require -- from WEL_REGISTRY 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: READABLE_STRING_GENERAL) -- 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. -- (from WEL_REGISTRY) require -- from WEL_REGISTRY 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_32] -- Find the names of the key values within the -- key referenced by 'key'. -- (from WEL_REGISTRY) open_key (parent_key: POINTER; key_name: READABLE_STRING_GENERAL; access_mode: INTEGER_32): POINTER -- Open subkey key_name of parent_key according to access_mode. -- Return handle to created key or default_pointer on failure. -- (from WEL_REGISTRY) require -- from WEL_REGISTRY 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: READABLE_STRING_GENERAL) -- (from WEL_REGISTRY) require -- from WEL_REGISTRY key_possible: valid_value_for_hkey (parent_key) name_possible: name /= Void number_of_subkeys (key: POINTER): INTEGER_32 -- (from WEL_REGISTRY) number_of_values (key: POINTER): INTEGER_32 -- (from WEL_REGISTRY) valid_value_for_hkey (key: POINTER): BOOLEAN -- Does key pointed by 'key' exists -- (from WEL_REGISTRY) feature -- Output Io: STD_FILES -- Handle to standard file setup -- (from ANY) ensure -- from ANY instance_free: class io_not_void: Result /= Void out: STRING_8 -- New string containing terse printable representation -- of current object -- (from ANY) ensure -- from ANY out_not_void: Result /= Void print (o: detachable ANY) -- Write terse external representation of o -- on standard output. -- (from ANY) ensure -- from ANY instance_free: class frozen tagged_out: STRING_8 -- New string containing terse printable representation -- of current object -- (from ANY) ensure -- from ANY tagged_out_not_void: Result /= Void feature -- Platform Operating_environment: OPERATING_ENVIRONMENT -- Objects available from the operating system -- (from ANY) ensure -- from ANY instance_free: class operating_environment_not_void: Result /= Void feature -- Settings set_key_value (key: POINTER; value_name: READABLE_STRING_GENERAL; 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 -- (from WEL_REGISTRY) require -- from WEL_REGISTRY 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: READABLE_STRING_GENERAL): BOOLEAN -- Return True if 'name' correspond to one of the -- value names below. -- (from WEL_HKEY) require -- from WEL_HKEY name_possible: name /= Void name_valid: name.is_valid_as_string_8 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: READABLE_STRING_GENERAL): POINTER -- Return the index corresponding to a root key. -- (from WEL_HKEY) require -- from WEL_HKEY name_not_void: name /= Void name_valid: name.is_valid_as_string_8 valid_key: basic_valid_name_for_hkey (name) last_call_successful: BOOLEAN -- Did last call succeed? -- (from WEL_REGISTRY) invariant -- from PREFERENCES_STORAGE_REGISTRY has_session_values: session_values /= Void -- from PREFERENCES_STORAGE_I has_location: location /= Void preferences_not_void_when_initialized: initialized implies preferences /= Void -- from ANY reflexive_equality: standard_is_equal (Current) reflexive_conformance: conforms_to (Current) note copyright: "Copyright (c) 1984-2009, Eiffel Software and others" license: "Eiffel Forum License v2 (see http://www.eiffel.com/licensing/forum.txt)" source: "[ Eiffel Software 5949 Hollister Ave., Goleta, CA 93117 USA Telephone 805-685-1006, Fax 805-685-6869 Website http://www.eiffel.com Customer support http://support.eiffel.com ]" end -- class PREFERENCES_STORAGE_DEFAULT -- Generated by Eiffel Studio --
For more details: eiffel.org