SAProfile

A Profile class for standard ASCII files for VACPP 3.0 or 4.0

Last Update: 14.04.2000
What is SAProfile ?
===================
SAProfile is a class that implements standard Windows INI files in ASCII format.
It provides the same functionality as the IProfile class from IBM's Open Class
Library with some small restrictions (see Restrictions later in this text).
Additionally SAProfile implements a feature called Variable Reference Solving.
By default Variable Reference Solving is disabled. For more details see Variable
Reference Solving.
The standard Windows INI files are organized in Sections and Entrys. Every section
is marked with a section name included in square brackets ("[]").
Every entry has a name and a value separated by an equal sign.

Restrictions
============
- Because the resulting INI file is a standard ASCII file you can not store binary
  values to the INI file yet. Maybe this will be implemented in a future release
  of SAProfile.
- The member function handle() is not implemented yet so you can not retrieve
  a handle for the profile.
- The member function deleteProfile(const char *profileName) is not implemented
  yet. To delete the profile simply delete the ASCII file.

Variable Reference Solving
==========================
This feature is disabled by default. You can enable it by calling
enableResolveVariableReferences(bool enable=true). When enabled the implementation
resolves variables in the following way:
If an entry value has a text string included in percent signs and square brackets,
it trys to resolve the reference.
Excample contents of an INI file:
[Variables]
MyVariable=Hello

[CommonSection]
PrintString=%[Variables.MyVariable]% World !

When retrieving the value of PrintString with Variable Reference Solving enabled
the result is:
Hello World !
When retrieving the value with Variable Reference Solving disabled, the result is:
%[Variables.MyVariable]% World !

The variable name is splitted in two strings separated by a dot. The first string
is the section name. The second string is the entry name. If the section name is
empty (for example %[.MyVariable]%) the current section will be used.

Implementation notes
====================
The constructor of SAProfile loads the complete file into the memory. When
accessing an entry SAProfile first checks the time stamp of the file. If the file
was changed after loading the profile then it will be reloaded again.
Setting an entry causes the complete profile to be written to disk. This ensures
that multiple applications can have access to the same profile and they have all
the actual profile in their memory space.
Unfortunately this technique slows down the performance of SAProfile compared to
the standard IProfile class. So if you don't want to check the time stamps you
can disable it with disableTimeChecking() before accessing some entries. But be
aware that disabling time checking the representation of the profile in the
applications memory space can be an other than the real contents of the file.
Time checking can be reenabled with a call to
enableTimeChecking(bool enable=true)

Copyright and Licence
=====================
SAProfile is copyright (c) 2000 by Stefan Fröhlich. You can use and change it to
meet your own needs without any payments. If you want to change the
implementation you have to rename the class. In all cases the header of the
files (the first six lines) must remain intact.
For feature requests contact the autor at Stefan.Fröhlich@t-online.de
 
 





Download SAProfile

Back