If the class is under control of the programmer, direct implementation is usually the best approach. The sample program uses the later approach because it is the most non-obvious of the two approaches. The reader will notice that the example is contrived. To exercise the code, these tasks were performed for both profile and EA based option sets. Initialize several variables, get an anchor block, and open the test profile create empty set test.cpp Declare object of type INIOptionset with a string and handle for the profile INIOptionSet.cpp Constructor for string and handle pass string to the BOptionSet for the application name, then hold onto the handle for subesquent file operations create items test.cpp Declares for a StrOptionItem and two Option items.
Option is a contrived class defined in the file option.h.
Both of these objects take a value an d a string used as the name of the option. The name is passed on to the BOptionItem parent class. The element is then added to the set or replaces a previous item of the same name. The size of the item name is recorded. The items are stored on the profile test.ini.