Jump to content

KrProfile

From EDM2
Revision as of 18:14, 5 April 2015 by Martini (talk | contribs) (Created page with "==Description == '''#include "krprof.hpp"''' Using this class, you can read and write data from/to os2.ini, os2sys.ini, or any other OS/2 style ini file that you choose, usin...")
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)

Description

#include "krprof.hpp"

Using this class, you can read and write data from/to os2.ini, os2sys.ini, or any other OS/2 style ini file that you choose, using the common << and >> operators.

Derivation

KrProfile inherits from iostream. It also inherits from the non-public class _KrProfileBase, but this is only for technical reasons.

Constructors

You can construct and destruct objects of this class.

Overload 1

public: 
KrProfile (const IString & aApp, profile aProfile = user, 
          Boolean iBuffered = false); 

Use this constructor to open the system ini file aProfile for reading and writing data of the application which is identified by the name aApp in the ini file.

By default, the object acts like a unit-buffered iostream, i.e. you can simply do your input output using the operators << and >>. If you want to avoid the slight overhead created by unit-buffering, and you want full buffering instead, set iBuffered=true If you do so, however, don't forget that you are now responsible for flushing the stream yourself using the manipulator flush.


Overload 2

public:
KrProfile (const IString & aApp, const IString & aProfile,
          Boolean iBuffered = false);

This is identical to overload 1, except that aProfile is now not neccessarily a system ini file, but the file name of any ini file. If it doesn't already exist, this constructor creates this ini file.

Public Functions

Application control

exists

removeApp

Constructors

KrProfile

~KrProfile

I/O functions

clearBuffer

readData

writeData

Key control

existsKey

key

removeKey

setKey

Retrieving information

good

size

Enumerations

Profile

public: enum profile { system, user, both };

If a system ini file is to be opened, a member of this enumeration should be passed to the constructor. These are their meanings:


system     Read and write to the OS/2 system ini file
           (usually called os2sys.ini)
user       Read and write to the OS/2 user ini file (usually
           called os2.ini)
both       Read from both above ini files, write to the OS/2
           user ini file.



Manipulators

Key control

clear

flush

Stream handling

remove