The IProfile class represents profile data sets. This class provides functions to query and set persistent application data based on application-defined keys.
The profile data set stores information using the following two keys:
The objects representing profile data sets are Xrm database files.
The profile data set stores information using the following two keys:
The objects representing profile data sets are initialization (.ini) files.
Note:
Profile data is stored in the Windows registry instead of an initialization file. The registry preserves case information but ignores the case in all operations. Thus, application names and key names are not case sensitive.
Use these members to construct, copy, assign, and destruct objects of this class. You can construct objects of this class by using the name of the profile data set or by using the copy constructor to copy one profile to another.
![]() |
public:
virtual ~IProfile()
This destructor closes the profile data set.
Windows | OS/2 | AIX |
Yes | Yes | Yes |
![]() |
public:
IProfile(const IProfile& aProfile)
Create a profile object using a reference to an existing profile object. Use this constructor if you want to make a copy of an existing profile object.
IAccessError | The IProfile object was not constructed. The profile name may be invalid. |
Windows | OS/2 | AIX |
Yes | Yes | Yes |
public:
IProfile(const char* profileName)
Create a profile object with the specified profile name.
IInvalidParameter | The IProfile object was not constructed. The profile name is missing. |
IAccessError | The IProfile object was not constructed. The profile name may be invalid. |
Windows | OS/2 | AIX |
Yes | Yes | Yes |
![]() |
public:
IProfile& operator =(const IProfile& aProfile)
Assigns the member data of an object of this class to another object of this class.
IAccessError | The IProfile object was not assigned. The profile name may be invalid. |
Windows | OS/2 | AIX |
Yes | Yes | Yes |
Use these members to get or set the default application name. The default application name is a component of the keys that are used to access the profile. This name is used by default for all reads and writes to the profile.
![]() |
public:
virtual IString defaultApplicationName() const
Returns the default application name.
Windows | OS/2 | AIX |
Yes | Yes | Yes |
![]() |
public:
virtual IProfile& setDefaultApplicationName( const char* applName )
Sets the default application name. All subsequent calls that do not supply an application name to functions of this class use this default name.
Windows | OS/2 | AIX |
Yes | Yes | Yes |
Use these members to access general profile information.
![]() |
public:
virtual IString applicationOrKeyAt( const Cursor& cursor ) const
Returns the application name or key at the specified cursor.
IInvalidParameter | The application name or key was not returned. The cursor is invalid. |
Windows | OS/2 | AIX |
Yes | Yes | Yes |
![]() |
public:
static void disableKeyMapping()
Disables the mapping of special characters for the Win32 registry.
Windows | OS/2 | AIX |
Yes | Yes | No |
![]() |
public:
static void enableKeyMapping(bool mapKey = true)
Enables the mapping of characters that would be otherwise illegal (* and ?) in Win32 registry keys. IProfile converts them to and from special characters, which you might see if you edit the registry directly.
Windows | OS/2 | AIX |
Yes | Yes | No |
![]() |
public:
virtual IProfileHandle handle() const
Returns the profile handle.
Windows | OS/2 | AIX |
No | Yes | Yes |
![]() |
public:
virtual IString name() const
Returns the profile's name.
Windows | OS/2 | AIX |
Yes | Yes | Yes |
In AIX, the name returned includes the path.
![]() |
public:
virtual unsigned long numberOfApplications() const
Returns the number of application names in the profile.
Windows | OS/2 | AIX |
Yes | Yes | Ignored |
![]() |
public:
virtual unsigned long numberOfKeys( const char* applName = 0 ) const
Returns the number of keys for the application name.
IInvalidParameter | The number of keys was not returned. The application name is missing and a default has not been specified. |
Windows | OS/2 | AIX |
Yes | Yes | Yes |
Use these members to read or write application data for an application.
![]() |
Writes the specified numeric, text, or binary data. You must specify text and binary data as an IString.
public:
virtual IProfile& addOrReplaceElementWithKey( const char* key, const IString& data, const char* applName = 0 )
Use this version of the function if your data is in a text or binary format.
IInvalidParameter | The application data was not written. The key name is missing. |
IInvalidParameter | The application data was not written. The application name is missing and a default has not been specified. |
IAccessError | The application data was not written. The application name or key may be invalid. |
Windows | OS/2 | AIX |
Yes | Yes | Yes |
AIX does not support the writing of binary data.
Storing data larger than two kilobytes is not recommended due to performance and size restrictions. For data larger than two kilobytes, applications should store the data as a file and store the file name in the profile.
public:
virtual IProfile& addOrReplaceElementWithKey( const char* key, long data, const char* applName = 0 )
Use this version of the function if your data is numeric.
IInvalidParameter | The application data was not written. The key name is missing. |
IInvalidParameter | The application data was not written. The application name is missing and a default has not been specified. |
IAccessError | The application data was not written. The application name or key may be invalid. |
Windows | OS/2 | AIX |
Yes | Yes | Yes |
AIX does not support the writing of binary data.
![]() |
public:
virtual bool containsKeyName( const char* key, const char* applName = 0 )
If the profile contains data for the specified application and key pair, true is returned.
Windows | OS/2 | AIX |
Yes | Yes | Yes |
![]() |
public:
virtual IProfile& deleteElementWithApplication( const char* applName = 0 )
Removes the data for all keys for the specified application name.
IInvalidParameter | The application data was not removed. The application name is missing and a default has not been specified. |
IAccessError | The application data was not removed. The application name may be invalid. |
Windows | OS/2 | AIX |
Yes | Yes | Yes |
![]() |
public:
virtual IProfile& deleteElementWithKey( const char* key, const char* applName = 0 )
Removes the data at the specified application and key name pair.
IInvalidParameter | The application data was not removed. The key name is missing. |
IInvalidParameter | The application data was not removed. The application name is missing and a default has not been specified. |
IAccessError | The application data was not removed. The application name or key may be invalid. |
Windows | OS/2 | AIX |
Yes | Yes | Yes |
![]() |
public:
static void deleteProfile(const char* profileName)
Removes the specified profile from the system.
Windows | OS/2 | AIX |
Yes | Yes | No |
![]() |
public:
virtual IString elementWithKey( const char* key, const char* applName = 0 )
Reads the application data and returns it as an IString.
IInvalidParameter | The application data was not read. The key name is missing. |
IInvalidParameter | The application data was not read. The application name is missing and a default has not been specified. |
IAccessError | The application data was not read. The application name or key may be invalid. |
IInvalidRequest | The application data was not read. The application name or key may be invalid. |
Windows | OS/2 | AIX |
Yes | Yes | Yes |
![]() |
public:
virtual long integerWithKey( const char* key, const char* applName = 0 )
Reads the application data and returns it as a long integer.
IInvalidParameter | The application data was not read. The key name is missing. |
IInvalidParameter | The application data was not read. The application name is missing and a default has not been specified. |
IAccessError | The application data was not read. The application name or key may be invalid. |
Windows | OS/2 | AIX |
Yes | Yes | Yes |
![]() |
public:
static bool isKeyMappingEnabled()
Returns true is key mapping is enabled.
Windows | OS/2 | AIX |
Yes | Yes | No |
Use these members to return the special objects of this class that correspond to the system and user profiles.
![]() |
public:
static IProfile systemProfile()
Returns the system profile.
Windows | OS/2 | AIX |
Yes | Yes | Ignored |
![]() |
public:
static IProfile userProfile()
Returns the user profile.
Windows | OS/2 | AIX |
Yes | Yes | Ignored |
Use these members to test a profile for an application name or an application and key name pair.
![]() |
public:
virtual bool containsApplication( const char* applName ) const
If the profile contains data for the specified application name, true is returned.
IInvalidParameter | The profile query was not returned. The application name is missing. |
Windows | OS/2 | AIX |
Yes | Yes | Yes |