home *** CD-ROM | disk | FTP | other *** search
/ OS/2 Shareware BBS: 10 Tools / 10-Tools.zip / krcls012.zip / KrClass / doc / krclref.INF (.txt) < prev    next >
OS/2 Help File  |  1997-02-25  |  46KB  |  1,695 lines

  1.  
  2. ΓòÉΓòÉΓòÉ 1. About this guide ΓòÉΓòÉΓòÉ
  3.  
  4. Kroni's Classes 
  5. Version 0.12
  6.  
  7. --  A class library for lazy PM programmers  --
  8.  
  9. Reference Guide 
  10.  
  11.  
  12.  Software requirements:    OS/2 Warp and Visual Age C++.
  13.  
  14.  Hardware Requirements:    none (anything which runs Warp and VAC++ is good enough).
  15.  
  16. Please read the file readme.1st and the copyright notice before you go on! 
  17.  
  18.  
  19. ΓòÉΓòÉΓòÉ 1.1. Copyright notice ΓòÉΓòÉΓòÉ
  20.  
  21. Kroni's Classes -  License.
  22.  
  23. You may: 
  24.  
  25.      make and distribute as many copies of the complete archive as you want. 
  26.       When doing this, the archive must always stay complete and may not be 
  27.       changed in any way. 
  28.  
  29.      install the software on one computer and run all .exe files. 
  30.  
  31.  If you are not registered, you may not do anything else with the software, 
  32.  including studying of the source code. 
  33.  
  34.  To register, you must write your full name and the version number of Kroni's 
  35.  Classes on a postcard and mail it to the author. 
  36.  
  37.  If you are registered, you get the following additional rights:  You may 
  38.  
  39.      use the source codes for studying 
  40.  
  41.      use and change the software to write your own programs 
  42.  
  43.      distribute compiled versions of your own programs 
  44.  
  45.      distribute source codes of your programs that include parts or all of 
  46.       Kroni's Classes if you also include the copyright notices that are placed 
  47.       at the top of all original source code files of Kroni's Classes. 
  48.  
  49.  NOTE THE DISCLAIMERS. 
  50.  
  51.  
  52. ΓòÉΓòÉΓòÉ 1.2. DISCLAIMERS ΓòÉΓòÉΓòÉ
  53.  
  54. NOTE THESE DISCLAIMERS: 
  55.  
  56. I release this software "as is". Use it completely at your own risk. I can not 
  57. be hold responsible for any damage which is inflicted directly or indirectly to 
  58. you or other persons or objects in any way by bugs or unexpected behaviour of 
  59. Kroni's Classes. If you do not accept this, you are not allowed to use the 
  60. software at all. If these conditions are illegal in your country, it is not 
  61. allowed to use the software in your country at all. 
  62.  
  63. I wrote this software completely on my own. However, in some countries, even 
  64. simple algorithms might be copyrighted. This means that in some countries I 
  65. might not have the right to grant you the above rights. If this is indeed the 
  66. case in your country, it is not allowed to use the software in your country at 
  67. all. 
  68.  
  69.  
  70. ΓòÉΓòÉΓòÉ 1.3. Contacting the author ΓòÉΓòÉΓòÉ
  71.  
  72. The author's name and address are: 
  73.  
  74. Wolfgang Kronberg 
  75. Richard-Linde-Weg 16a 
  76. 21033 Hamburg 
  77. Germany 
  78.  
  79. Please send your registration to this address. 
  80.  
  81. Registered users may also contact the author using this e-mail address: 
  82.  
  83. vlk@amt.cmlink.de 
  84.  
  85. Please keep mails to this account small (<10k). 
  86.  
  87.  
  88. ΓòÉΓòÉΓòÉ 1.4. Introduction ΓòÉΓòÉΓòÉ
  89.  
  90. This reference guide lists all public classes and functions defined in Kroni's 
  91. Classes and explaines the meaning of their members and arguments. Since Kroni's 
  92. Classes are build upon the IBM open class library, this reference guide tries 
  93. to maintain the open class library's reference guide's "look & feel". 
  94.  
  95. This guide should not be used as a general tutorial. Please have a look at the 
  96. user's guide and the demo software to find out more about that subject. 
  97.  
  98.  
  99. ΓòÉΓòÉΓòÉ 2. Classes by Name ΓòÉΓòÉΓòÉ
  100.  
  101. KrAntiFrame 
  102. KrAsyncMain 
  103. KrAlignment 
  104. KrBitfield 
  105. KrBitfieldData 
  106. KrChoice 
  107. KrChoiceData 
  108. KrCommonTextOutput 
  109. KrCoordSystemTranslator 
  110. KrDrawingCanvas 
  111. KrFrame 
  112. KrGBox 
  113. KrGLine 
  114. KrGString 
  115. KrGraphicList 
  116. KrMemoryBitmap 
  117. KrMenuBar 
  118. KrPoint 
  119. KrPrinter 
  120. KrProfile 
  121. KrRectangle 
  122. KrTrace 
  123. KrUserDataField 
  124. KrWinComm 
  125.  
  126.  
  127. ΓòÉΓòÉΓòÉ 3. Carefree main() function ΓòÉΓòÉΓòÉ
  128.  
  129. By inheriting from the KrAsyncMain class, you get a new main() function which 
  130. offers convenient features. 
  131.  
  132.  
  133. ΓòÉΓòÉΓòÉ 3.1. KrAsyncMain ΓòÉΓòÉΓòÉ
  134.  
  135. Description 
  136.  
  137. Derivation 
  138.  
  139. Constructors 
  140.  
  141. Public Functions 
  142.  
  143. Enumerations 
  144.  
  145.  
  146. ΓòÉΓòÉΓòÉ 3.1.1. Class Description - KrAsyncMain ΓòÉΓòÉΓòÉ
  147.  
  148. #include "krasyncm.hpp" 
  149.  
  150. Beginners to OS/2 PM programming usually find this message processing style in 
  151. which PM programs have to be written highly disturbing. The IBM open class 
  152. library helps somewhat by providing ICurrentApplication::run(). However, the 
  153. associated handler concept is not easy to comprehend, and the programmer ist 
  154. still responsible for not blocking the message queue for more than a few 
  155. milliseconds. 
  156.  
  157. By inheriting from KrAsyncMain, you get a new main() function with the 
  158. following nice features: 
  159.  
  160.      It runs in its own thread on idle priority. This means that you can do 
  161.       whatever you want in this main() function, the system will still be able 
  162.       to multitask as if no system load existed, you'll be able to move around 
  163.       your app's window on the screen etc., but main() will still get as much 
  164.       CPU power as possible under these circumstances (usually, this will be 
  165.       approx. 99.9%). 
  166.  
  167.      It will receive commands send to your window, thus benefiting from the 
  168.       advantages of the message system while avoiding its disadvantages (s.a). 
  169.  
  170.      It will receive a startup message, i.e. you can now easily write commands 
  171.       which are supposed to be part of the program's initialization, but which 
  172.       also require that the system parts of the application already are fully 
  173.       functional (i.e. that IApplication::current().run() ist already running). 
  174.  
  175.  
  176. ΓòÉΓòÉΓòÉ 3.1.2. Derivation - KrAsyncMain ΓòÉΓòÉΓòÉ
  177.  
  178. KrAsyncMain inherits both from ICommandHandler and from IThreadFn. 
  179.  
  180.  
  181. ΓòÉΓòÉΓòÉ 3.1.3. Constructors - KrAsyncMain ΓòÉΓòÉΓòÉ
  182.  
  183. KrAsyncMain is a virtual class. You cannot construct objects of this class. 
  184. Instead, derive a new class from KrAsyncMain which defines at least a new 
  185. function main. 
  186.  
  187. You can construct one object of a derived class and attach it to your 
  188. application's main window. Though it might be possible to create more objects 
  189. and destruct them, this is not recommended. 
  190.  
  191. The construction of this object should take place immediately before calling 
  192. IApplication::current().run(). 
  193.  
  194. Overload 1 
  195.  
  196. public: 
  197. KrAsyncMain (IWindow* mainWindow); 
  198.  
  199.  
  200. ΓòÉΓòÉΓòÉ 3.1.4. Public Functions - KrAsyncmain ΓòÉΓòÉΓòÉ
  201.  
  202. Constructors 
  203. KrAsyncMain 
  204.  
  205. main() function 
  206. main 
  207.  
  208.  
  209. ΓòÉΓòÉΓòÉ 3.1.4.1. KrAsyncMain::main ΓòÉΓòÉΓòÉ
  210.  
  211. You must overwrite this pure virtual function. It is called on program startup 
  212. and whenever a command is received by your application's main window. This 
  213. command may come from any source, including having been issued from within this 
  214. function. 
  215.  
  216. The command is passed in the parameter event. Have a look at the enumeration 
  217. commands to find out what commands are used. 
  218.  
  219. public: 
  220. virtual void main (IEvent & event) = 0; 
  221.  
  222. Note:   This function is called once at a time only. You don't need to take 
  223.         care of any synchronization issues, but you must be aware that no 
  224.         further commands will be processed by this function while it is still 
  225.         running. 
  226.  
  227. However, if commands are received while the function is still running, these 
  228. commands are not lost. Instead, they are stored in a FIFO (first in, first out) 
  229. queue and being processed as soon as the function is left. 
  230.  
  231.  
  232. ΓòÉΓòÉΓòÉ 3.1.5. Enumerations - KrAsyncMain ΓòÉΓòÉΓòÉ
  233.  
  234. commands 
  235.  
  236.  
  237. ΓòÉΓòÉΓòÉ 3.1.5.1. KrAsyncMain::commands ΓòÉΓòÉΓòÉ
  238.  
  239. public: 
  240. typedef enum {cmdStartUp = 1, cmdFuncFinished, cmdUser} commands; 
  241.  
  242. These command codes are being passed in IEvent::parameter1() to main. These are 
  243. their meanings: 
  244.  
  245.  
  246.  cmdStartUp           Used on first call after program startup
  247.  
  248.  cmdFuncFinished      Reserved for internal use
  249.  
  250.  cmdUser              This and all subsequent values are free for you to
  251.                       use for your own commands. Be aware, however, that
  252.                       you must avoid conflicts with other commands sent
  253.                       to your application's main window, e.g. IDs of
  254.                       menu items.
  255.  
  256.  
  257. ΓòÉΓòÉΓòÉ 4. Menu support ΓòÉΓòÉΓòÉ
  258.  
  259. Use KrMenuBar to add a menu bar (possibly with drop-down menus) to your 
  260. application. 
  261.  
  262.  
  263. ΓòÉΓòÉΓòÉ 4.1. KrMenuBar ΓòÉΓòÉΓòÉ
  264.  
  265. #include "krmenu.hpp" 
  266.  
  267. KrMenuBar does not provide real new features, but rather a bugfix. It behaves 
  268. exactely like IMenuBar, from which it inherits, with one exception: when 
  269. constructed using 
  270.  
  271. public: 
  272. KrMenuBar (IFrameWindow *owner, const Style & style = defaultStyle()); 
  273.  
  274. the correct system font for menus is used to build the menu bar and the 
  275. associated menus (IMenuBar erranously uses the system proportional font). 
  276.  
  277.  
  278. ΓòÉΓòÉΓòÉ 5. Screen text output ΓòÉΓòÉΓòÉ
  279.  
  280. The class KrCommonTextOutput allows you to easily output text to the screen. 
  281.  
  282.  
  283. ΓòÉΓòÉΓòÉ 5.1. KrCommonTextOutput ΓòÉΓòÉΓòÉ
  284.  
  285. Description 
  286.  
  287. Derivation 
  288.  
  289. Constructors 
  290.  
  291. Public Functions 
  292.  
  293.  
  294. ΓòÉΓòÉΓòÉ 5.1.1. Class Description - KrCommonTextOutput ΓòÉΓòÉΓòÉ
  295.  
  296. #include "krcto.hpp" 
  297.  
  298. This class contains a ostream object. All output that goes to this object is 
  299. displayed in an IMultiLineEdit window. 
  300.  
  301. You can use this class to redirect output from cout etc. to the screen. 
  302.  
  303.  
  304. ΓòÉΓòÉΓòÉ 5.1.2. Derivation - KrCommonTextOutput ΓòÉΓòÉΓòÉ
  305.  
  306. KrCommonTextOutput inherits from IMultiLineEdit. 
  307.  
  308.  
  309. ΓòÉΓòÉΓòÉ 5.1.3. Constructors - KrCommonTextOutput ΓòÉΓòÉΓòÉ
  310.  
  311. You can construct and destruct objects of this class. 
  312.  
  313. Overload 1 
  314.  
  315. public: 
  316.  
  317. KrCommonTextOutput (unsigned long id, IWindow* parent, IWindow* owner,
  318.           const IRectangle& initial = IRectangle (),
  319.           const Style& style = defaultStyle () | readOnly);
  320.  
  321. The constructor works exactly like the corresponding constructor of 
  322. IMultiLineEdit. 
  323.  
  324.  
  325. ΓòÉΓòÉΓòÉ 5.1.4. Public Functions - KrCommonTextOutput ΓòÉΓòÉΓòÉ
  326.  
  327. Constructors 
  328. KrCommonTextOutput 
  329.  
  330. Associated stream 
  331. stream 
  332.  
  333.  
  334. ΓòÉΓòÉΓòÉ 5.1.4.1. KrCommonTextOutput::stream ΓòÉΓòÉΓòÉ
  335.  
  336. Use this function to access the ostream associated to the KrCommonTextOutput 
  337. object. 
  338.  
  339. public: 
  340. ostream & stream (); 
  341.  
  342. Usually, you will assign it to some other stream like cout using the operator 
  343. =. 
  344.  
  345. Note:   The ostream has and needs the property ios::unitbuf. Unfortunately, 
  346.         this is not copied by the operator =. Hence, you must take care of this 
  347.         yourself by calling ios::setf (ios::unitbuf). 
  348.  
  349. Do not use this function before the object is properly initialized, i.e. before 
  350. IApplication::current().run() has been called. 
  351.  
  352.  
  353. ΓòÉΓòÉΓòÉ 6. Easy user input ΓòÉΓòÉΓòÉ
  354.  
  355. The class KrWinComm provides you with the ability to easily query the user for 
  356. input for some basic variable types, using the common >> operator. 
  357.  
  358. In addition, the following classes let you ask the user for input of more 
  359. complicated data structures and even of arbitrary types. 
  360.  
  361. KrBitfield 
  362. KrBitfieldData 
  363. KrChoice 
  364. KrChoiceData 
  365. KrUserDataField 
  366.  
  367.  
  368. ΓòÉΓòÉΓòÉ 6.1. KrWinComm ΓòÉΓòÉΓòÉ
  369.  
  370. Description 
  371.  
  372. Derivation 
  373.  
  374. Constructors 
  375.  
  376. Public Functions 
  377.  
  378. Operators 
  379.  
  380. Manipulators 
  381.  
  382.  
  383. ΓòÉΓòÉΓòÉ 6.1.1. Class Description - KrWinComm ΓòÉΓòÉΓòÉ
  384.  
  385. #include "krwc.hpp" 
  386.  
  387. This class, in combination with some operators, acts similar to an istream 
  388. object. It queries data from the user by presenting him a dialog box. 
  389.  
  390. Please note that this class does not really inherit from istream, so that not 
  391. all types which can be input via an istream can also immediately be input via a 
  392. KrWinComm object. It is possible, however, to provide that support for 
  393. arbitrary objects in a convenient way. Have a look at the user's guide and the 
  394. demo programs dialog3 and demo to learn details. 
  395.  
  396.  
  397. ΓòÉΓòÉΓòÉ 6.1.2. Derivation - KrWinComm ΓòÉΓòÉΓòÉ
  398.  
  399. KrWinComm inherits from IBase. 
  400.  
  401.  
  402. ΓòÉΓòÉΓòÉ 6.1.3. Constructors - KrWinComm ΓòÉΓòÉΓòÉ
  403.  
  404. You can construct and destruct objects of this class. 
  405.  
  406. Overload 1 
  407.  
  408. public: 
  409.  
  410. KrWinComm (const IString & aTitle = "Dialog");
  411.  
  412. The constructor initializes essential object data, but does not create the 
  413. dialog window. The window is created when the first input is queried from the 
  414. KrWinComm object. The dialog title can be changed at a later time using 
  415. setTitle. 
  416.  
  417.  
  418. ΓòÉΓòÉΓòÉ 6.1.4. Public Functions - KrWinComm ΓòÉΓòÉΓòÉ
  419.  
  420. Appearance 
  421. setFont 
  422. setTitle 
  423.  
  424. Constructors 
  425. KrWinComm 
  426. ~KrWinComm 
  427.  
  428. Diagnostics 
  429. ok 
  430.  
  431. Display Dialog 
  432. run 
  433.  
  434. Input 
  435. addEntryField 
  436.  
  437. Output 
  438. addToNextPrompt 
  439. setNextPrompt 
  440.  
  441.  
  442. ΓòÉΓòÉΓòÉ 6.1.4.1. KrWinComm::setFont ΓòÉΓòÉΓòÉ
  443.  
  444. Use this function to change the default font used in the dialog window. 
  445.  
  446. public: 
  447. void setFont (const IFont & aFont); 
  448.  
  449.  
  450. ΓòÉΓòÉΓòÉ 6.1.4.2. KrWinComm::setTitle ΓòÉΓòÉΓòÉ
  451.  
  452. Use this function to change the dialog window's title. 
  453.  
  454. public: 
  455. void setTitle (const IString & aTitle); 
  456.  
  457.  
  458. ΓòÉΓòÉΓòÉ 6.1.4.3. KrWinComm::~KrWinComm ΓòÉΓòÉΓòÉ
  459.  
  460. public: 
  461. ~KrWinComm (); 
  462.  
  463.  
  464. ΓòÉΓòÉΓòÉ 6.1.4.4. KrWinComm::ok ΓòÉΓòÉΓòÉ
  465.  
  466. Use this function to find out whether the last dialog has been aborted. 
  467.  
  468. public: 
  469. Boolean ok (); 
  470.  
  471. This function returns true if the user completed the dialog and pressed the OK 
  472. button, and false if he aborted it. 
  473.  
  474.  
  475. ΓòÉΓòÉΓòÉ 6.1.4.5. KrWinComm::run ΓòÉΓòÉΓòÉ
  476.  
  477. This function displays the dialog and waits for the user input. 
  478.  
  479. public: 
  480. Boolean run (); 
  481.  
  482. The function returns true if the user completed the dialog and pressed the OK 
  483. button, and false if he aborted it. 
  484.  
  485. Note:   It is recommended to use the display modifier instead of this function. 
  486.  
  487.  
  488. ΓòÉΓòÉΓòÉ 6.1.4.6. KrWinComm::addEntryField ΓòÉΓòÉΓòÉ
  489.  
  490. This function prepares the KrWinComm object to input variables of the 
  491. corresponding type. 
  492.  
  493. Overload 1 
  494.  
  495. public: 
  496. void addEntryField (IString & s); 
  497.  
  498. Overload 2 
  499.  
  500. public: 
  501. void addEntryField (double & d); 
  502.  
  503. Overload 3 
  504.  
  505. public: 
  506. void addEntryField (unsigned long & l); 
  507.  
  508. Overload 4 
  509.  
  510. public: 
  511. void addEntryField (signed long & l); 
  512.  
  513. Overload 5 
  514.  
  515. public: 
  516. void addEntryField (KrBitfield & b); 
  517.  
  518. Overload 6 
  519.  
  520. public: 
  521. void addEntryField (KrChoice & c); 
  522.  
  523. Overload 7 
  524.  
  525. public: 
  526. void addEntryField (KrUserDataField & f); 
  527.  
  528. Overload 8 
  529.  
  530. public: 
  531. void addEntryField (KrUserDataField * f); 
  532.  
  533. The function returns true if the user completed the dialog and pressed the OK 
  534. button, and false if he aborted it. 
  535.  
  536. Note:   Do not use any of these functions. Use the corresponding operator >> 
  537.         instead. 
  538.  
  539.  
  540. ΓòÉΓòÉΓòÉ 6.1.4.7. KrWinComm::addToNextPrompt ΓòÉΓòÉΓòÉ
  541.  
  542. This function appends a string to the introducing line for the next input 
  543. field. 
  544.  
  545. public: 
  546. void addToNextPrompt (const IString & title); 
  547.  
  548. Note:   It is recommended to use the operator << instead of this function. 
  549.  
  550.  
  551. ΓòÉΓòÉΓòÉ 6.1.4.8. KrWinComm::setNextPrompt ΓòÉΓòÉΓòÉ
  552.  
  553. This function sets the introducing line for the next input field. 
  554.  
  555. public: 
  556. void setNextPrompt (const IString & title); 
  557.  
  558. Note:   It is recommended to use the operator << instead of this function. 
  559.  
  560.  
  561. ΓòÉΓòÉΓòÉ 6.1.5. Operators - KrWinComm ΓòÉΓòÉΓòÉ
  562.  
  563. For your convenience, overloads to the common input and output operator are 
  564. provided for the use with KrWinComm 
  565.  
  566. operator << 
  567. operator >> 
  568.  
  569. Note:   Make sure you do not use any of these operatrs before 
  570.         IApplication::current().run() has been called, since they require the 
  571.         existence of a message queue. 
  572.  
  573.  
  574. ΓòÉΓòÉΓòÉ 6.1.5.1. KrWinCom - operator << ΓòÉΓòÉΓòÉ
  575.  
  576. This operator lets the programmer add "prompt lines" to the dialog window 
  577. presented to the user. KrWinComm accumulates all strings directed to it using 
  578. this operator, until the operator >> is used to input some variable. Then, the 
  579. accumulated string is used as the prompt line, and its contents is deleted so 
  580. that the same can be done for the next input variable. 
  581.  
  582. Overload 1 
  583.  
  584. public: 
  585. KrWinComm & operator << (KrWinComm & aWinComm, 
  586.              const IString & aString); 
  587.  
  588.  
  589. ΓòÉΓòÉΓòÉ 6.1.5.2. KrWinCom - operator >> ΓòÉΓòÉΓòÉ
  590.  
  591. Use the overloads of this operator to query input from the user. 
  592.  
  593. Use the last overload, which expects a pointer to a KrUserDataField object, to 
  594. define the input for objects for which no pre-defined operator exists, and 
  595. which are not derived from KrUserDataField. The corresponding KrUserDataField 
  596. will be deleted after the dialog window has been displayed. Have a look at the 
  597. user's guide and the sample programs display3.cpp and demo.cpp for details on 
  598. this subject. 
  599.  
  600. The other overloads do not delete the objects passed to them as arguments. 
  601.  
  602. Overload 1 
  603.  
  604. public: 
  605. KrWinComm & operator >> (KrWinComm & aWinComm, 
  606.              IString & aString); 
  607.  
  608. Overload 2 
  609.  
  610. public: 
  611. KrWinComm & operator >> (KrWinComm & aWinComm, 
  612.              double & aDouble); 
  613.  
  614. Overload 3 
  615.  
  616. public: 
  617. KrWinComm & operator >> (KrWinComm & aWinComm, 
  618.              unsigned long & aUnsigned); 
  619.  
  620. Overload 4 
  621.  
  622. public: 
  623. KrWinComm & operator >> (KrWinComm & aWinComm, 
  624.              signed long & aSigned); 
  625.  
  626. Overload 5 
  627.  
  628. public: 
  629. KrWinComm & operator >> (KrWinComm & aWinComm, 
  630.              KrBitfield & aBitfield); 
  631.  
  632. Overload 6 
  633.  
  634. public: 
  635. KrWinComm & operator >> (KrWinComm & aWinComm, 
  636.              KrChoice & aChoice); 
  637.  
  638. Overload 7 
  639.  
  640. public: 
  641. KrWinComm & operator >> (KrWinComm & aWinComm, 
  642.              KrUserDataField & aUserData); 
  643.  
  644. Overload 8 
  645.  
  646. public: 
  647. KrWinComm & operator >> (KrWinComm & aWinComm, 
  648.              KrUserDataField* aUserData); 
  649.  
  650.  
  651. ΓòÉΓòÉΓòÉ 6.1.6. Manipulators - KrWinComm ΓòÉΓòÉΓòÉ
  652.  
  653. The display manipulator will show the dialog on the screen and let the user 
  654. type his input. Its influence on KrWinComm objects is similar to that of the 
  655. operator flush on ostream objects. 
  656.  
  657.  
  658. ΓòÉΓòÉΓòÉ 6.1.6.1. KrWinComm - manipulator display ΓòÉΓòÉΓòÉ
  659.  
  660. This manipulator displays the dialog window defined by previous uses of the 
  661. operators << and >> on a KrWinComm object and evaluates the user input. 
  662.  
  663. public: 
  664. KrWinComm & display (KrWinComm & aWinComm); 
  665.  
  666.  
  667. ΓòÉΓòÉΓòÉ 6.2. KrBitfield ΓòÉΓòÉΓòÉ
  668.  
  669. Description 
  670.  
  671. Derivation 
  672.  
  673. Constructors 
  674.  
  675. Public Functions 
  676.  
  677.  
  678. ΓòÉΓòÉΓòÉ 6.2.1. Class Description - KrBitfield ΓòÉΓòÉΓòÉ
  679.  
  680. #include "krwc.hpp" 
  681.  
  682. This class represents a set of options, each of which has a name, and each of 
  683. which can indpendently be selected or deselected. Its main purpose is to be 
  684. used as an input data structure for  KrWinComm. 
  685.  
  686.  
  687. ΓòÉΓòÉΓòÉ 6.2.2. Derivation - KrBitfield ΓòÉΓòÉΓòÉ
  688.  
  689. KrBitfield inherits from IBase. 
  690.  
  691.  
  692. ΓòÉΓòÉΓòÉ 6.2.3. Constructors - KrBitfield ΓòÉΓòÉΓòÉ
  693.  
  694. You can construct and destruct objects of this class. 
  695.  
  696. The default constructor creates an empty set of options. Before an object 
  697. created that way is actually used, add should have been called at least once. 
  698.  
  699. Overload 1 
  700.  
  701. public: 
  702. KrBitfield (); 
  703.  
  704. You may also construct a KrBitfield object from an existing KrBitfieldData 
  705. object. 
  706.  
  707. Overload 2 
  708.  
  709. public: 
  710. KrBitfield (const KrBitfieldData & aData); 
  711.  
  712.  
  713. ΓòÉΓòÉΓòÉ 6.2.4. Public Functions - KrBitfield ΓòÉΓòÉΓòÉ
  714.  
  715. Adding new options 
  716. add 
  717.  
  718. Constructors 
  719. KrBitfield 
  720.  
  721. Control options 
  722. isChecked 
  723. toggle 
  724.  
  725. Queries 
  726. getFirstKey 
  727. getNextKey 
  728. getText 
  729. numberOfEntries 
  730.  
  731.  
  732. ΓòÉΓòÉΓòÉ 6.2.4.1. KrBitfield::add ΓòÉΓòÉΓòÉ
  733.  
  734. There are to ways to add a new option to the set. 
  735.  
  736. Overload 1 
  737.  
  738. public: 
  739. int add (const IString & newEntry, Boolean checked = false); 
  740.  
  741. Use this overload to add an option and assign the next free id to it. This id 
  742. is returned by the function. The parameter checked lets you control whether the 
  743. option should initialy be set. 
  744.  
  745. Overload 2 
  746.  
  747. public: 
  748. int add (int id, const IString & newEntry, Boolean checked = false); 
  749.  
  750. Use this overload to add an option and assign a predefined id to it. If this id 
  751. is not free anymore, the call fails, and zero is returned. Otherwise, the 
  752. predefined id itself is returned. 
  753.  
  754.  
  755. ΓòÉΓòÉΓòÉ 6.2.4.2. KrBitfield::isChecked ΓòÉΓòÉΓòÉ
  756.  
  757. Use this function to query the status of the option identified by the parameter 
  758. id. 
  759.  
  760. public: 
  761. Boolean isChecked (int id); 
  762.  
  763.  
  764. ΓòÉΓòÉΓòÉ 6.2.4.3. KrBitfield::toggle ΓòÉΓòÉΓòÉ
  765.  
  766. Use this function to change the status of an option. There are two overloads. 
  767. Both return the new status of the option identified by the parameter id. 
  768.  
  769. Overload 1 
  770.  
  771. public: 
  772. Boolean toggle (int id, Boolean check); 
  773.  
  774. Use this overload to set the option to the value check. 
  775.  
  776. Overload 2 
  777.  
  778. public: 
  779. Boolean toggle (int id); 
  780.  
  781. This overload inverts the current status of the option. 
  782.  
  783.  
  784. ΓòÉΓòÉΓòÉ 6.2.4.4. KrBitfield::getFirstKey ΓòÉΓòÉΓòÉ
  785.  
  786. This function returns the id of the first option in the set. 
  787.  
  788. public: 
  789. int getFirstKey (); 
  790.  
  791. Note:   If you call this function when the set is empty, an IEmptyException is 
  792.         thrown. 
  793.  
  794.  
  795. ΓòÉΓòÉΓòÉ 6.2.4.5. KrBitfield::getNextKey ΓòÉΓòÉΓòÉ
  796.  
  797. This function returns the id of the next option in the set which comes after 
  798. the id passed as an argument. 
  799.  
  800. public: 
  801. int getNextKey (int id); 
  802.  
  803. Note:   If you pass an invalid id to this function, an ICursorInvalidException 
  804.         is thrown. 
  805.  
  806. If the id passed to the function already belongs to the last option, this same 
  807. id is returned. 
  808.  
  809.  
  810. ΓòÉΓòÉΓòÉ 6.2.4.6. KrBitfield::getText ΓòÉΓòÉΓòÉ
  811.  
  812. This function returns the name of the option whose id is passed as an argument. 
  813.  
  814. public: 
  815. IString & getText (int id); 
  816.  
  817. Note:   If you pass an invalid id to this function, an INotContainsKeyException 
  818.         is thrown. 
  819.  
  820.  
  821. ΓòÉΓòÉΓòÉ 6.2.4.7. KrBitfield::numberOfEntries ΓòÉΓòÉΓòÉ
  822.  
  823. This function returns the number of options currently in the set. 
  824.  
  825. public: 
  826. int numberOfEntries (); 
  827.  
  828.  
  829. ΓòÉΓòÉΓòÉ 6.3. KrBitfieldData ΓòÉΓòÉΓòÉ
  830.  
  831. This is a template class derived from IKeySortedSet, which contains the data of 
  832. the set of options included in a KrBitfield object. 
  833.  
  834. Do not use this class in your programs, since it might change or even 
  835. altogether disappear in a future version of Kroni's Classes. 
  836.  
  837.  
  838. ΓòÉΓòÉΓòÉ 6.4. KrChoice ΓòÉΓòÉΓòÉ
  839.  
  840. Description 
  841.  
  842. Derivation 
  843.  
  844. Constructors 
  845.  
  846. Public Functions 
  847.  
  848.  
  849. ΓòÉΓòÉΓòÉ 6.4.1. Class Description - KrChoice ΓòÉΓòÉΓòÉ
  850.  
  851. #include "krwc.hpp" 
  852.  
  853. This class represents a set of choices, each of which has a name, and of which 
  854. exactly one is chosen at a time. Its main purpose is to be used as an input 
  855. data structure for  KrWinComm. 
  856.  
  857.  
  858. ΓòÉΓòÉΓòÉ 6.4.2. Derivation - KrChoice ΓòÉΓòÉΓòÉ
  859.  
  860. KrChoice inherits from IBase. 
  861.  
  862.  
  863. ΓòÉΓòÉΓòÉ 6.4.3. Constructors - KrChoice ΓòÉΓòÉΓòÉ
  864.  
  865. You can construct and destruct objects of this class. 
  866.  
  867. The default constructor creates an empty set of choices. Before an object 
  868. created that way is actually used, add should have been called at least once. 
  869.  
  870. Overload 1 
  871.  
  872. public: 
  873. KrChoice (); 
  874.  
  875. You may also construct a KrChoice object from an existing KrChoiceData object. 
  876.  
  877. Overload 2 
  878.  
  879. public: 
  880. KrChoice (const KrChoiceData & aData); 
  881.  
  882.  
  883. ΓòÉΓòÉΓòÉ 6.4.4. Public Functions - KrChoice ΓòÉΓòÉΓòÉ
  884.  
  885. Active choice 
  886. get 
  887. set 
  888.  
  889. Adding new choices 
  890. add 
  891.  
  892. Constructors 
  893. KrChoice 
  894.  
  895. Queries 
  896. getFirstKey 
  897. getNextKey 
  898. getText 
  899. numberOfEntries 
  900.  
  901.  
  902. ΓòÉΓòÉΓòÉ 6.4.4.1. KrChoice::get ΓòÉΓòÉΓòÉ
  903.  
  904. This function returns the id of the currently active choice. 
  905.  
  906. public: 
  907. int get(); 
  908.  
  909.  
  910. ΓòÉΓòÉΓòÉ 6.4.4.2. KrChoice::set ΓòÉΓòÉΓòÉ
  911.  
  912. Pass a choice's id as an argument to this function to make the choice the 
  913. active one. 
  914.  
  915. public: 
  916. void set (int id); 
  917.  
  918.  
  919. ΓòÉΓòÉΓòÉ 6.4.4.3. KrChoice::add ΓòÉΓòÉΓòÉ
  920.  
  921. There are to ways to add a new choice to the set. 
  922.  
  923. Overload 1 
  924.  
  925. public: 
  926. int add (const IString & newChoice); 
  927.  
  928. Use this overload to add a choice and assign the next free id to it. This id is 
  929. returned by the function. 
  930.  
  931. Overload 2 
  932.  
  933. public: 
  934. int add (int id, const IString & newChoice); 
  935.  
  936. Use this overload to add a choice and assign a predefined id to it. If this id 
  937. is not free anymore, the call fails, and zero is returned. Otherwise, the 
  938. predefined id itself is returned. 
  939.  
  940.  
  941. ΓòÉΓòÉΓòÉ 6.4.4.4. KrChoice::getFirstKey ΓòÉΓòÉΓòÉ
  942.  
  943. This function returns the id of the first choice in the set. 
  944.  
  945. public: 
  946. int getFirstKey (); 
  947.  
  948. Note:   If you call this function when the set is empty, an IEmptyException is 
  949.         thrown. 
  950.  
  951.  
  952. ΓòÉΓòÉΓòÉ 6.4.4.5. KrChoice::getNextKey ΓòÉΓòÉΓòÉ
  953.  
  954. This function returns the id of the next choice in the set which comes after 
  955. the id passed as an argument. 
  956.  
  957. public: 
  958. int getNextKey (int id); 
  959.  
  960. Note:   If you pass an invalid id to this function, an ICursorInvalidException 
  961.         is thrown. 
  962.  
  963. If the id passed to the function already belongs to the last choice, this same 
  964. id is returned. 
  965.  
  966.  
  967. ΓòÉΓòÉΓòÉ 6.4.4.6. KrChoice::getText ΓòÉΓòÉΓòÉ
  968.  
  969. This function returns the name of the choice whose id is passed as an argument. 
  970.  
  971. public: 
  972. IString & getText (int id); 
  973.  
  974. Note:   If you pass an invalid id to this function, an INotContainsKeyException 
  975.         is thrown. 
  976.  
  977.  
  978. ΓòÉΓòÉΓòÉ 6.4.4.7. KrChoice::numberOfEntries ΓòÉΓòÉΓòÉ
  979.  
  980. This function returns the number of choices currently in the set. 
  981.  
  982. public: 
  983. int numberOfEntries (); 
  984.  
  985.  
  986. ΓòÉΓòÉΓòÉ 6.5. KrChoiceData ΓòÉΓòÉΓòÉ
  987.  
  988. This is a template class derived from IKeySortedSet, which contains the data of 
  989. the set of choices included in a KrChoice object. 
  990.  
  991. Do not use this class in your programs, since it might change or even 
  992. altogether disappear in a future version of Kroni's Classes. 
  993.  
  994.  
  995. ΓòÉΓòÉΓòÉ 6.6. KrUserDataField ΓòÉΓòÉΓòÉ
  996.  
  997. Description 
  998.  
  999. Derivation 
  1000.  
  1001. Constructors 
  1002.  
  1003. Public Functions 
  1004.  
  1005.  
  1006. ΓòÉΓòÉΓòÉ 6.6.1. Class Description - KrUserDataField ΓòÉΓòÉΓòÉ
  1007.  
  1008. #include "krwc.hpp" 
  1009.  
  1010. This virtual class is used to provide KrWinComm support for variables of 
  1011. arbitrary types. Refer to the user's guide and the demo programs dialog3.cpp 
  1012. and demo.cpp for inforation on how to use it. 
  1013.  
  1014.  
  1015. ΓòÉΓòÉΓòÉ 6.6.2. Derivation - KrUserDataField ΓòÉΓòÉΓòÉ
  1016.  
  1017. KrUserDataField inherits from IBase. 
  1018.  
  1019.  
  1020. ΓòÉΓòÉΓòÉ 6.6.3. Constructors - KrUserDataField ΓòÉΓòÉΓòÉ
  1021.  
  1022. This is a virtual class. You cannot construct objects of this class. Instead, 
  1023. use this class as a base to define new classes and overwrite all functions. 
  1024.  
  1025. No constructor is defined for this class. 
  1026.  
  1027.  
  1028. ΓòÉΓòÉΓòÉ 6.6.4. Public Functions - KrUserDataField ΓòÉΓòÉΓòÉ
  1029.  
  1030. Pure virtual functions 
  1031. initialize 
  1032. transform 
  1033.  
  1034.  
  1035. ΓòÉΓòÉΓòÉ 6.6.4.1. KrUserDataField::initialize ΓòÉΓòÉΓòÉ
  1036.  
  1037. public: 
  1038. virtual int initialize (IMultiCellCanvas & c, int start) = 0; 
  1039.  
  1040. When this function is called, the drawing of the actual dialog window is 
  1041. currently taking place, and this object must now create its own window objects 
  1042. and place them in the IMultiCellCanvas c, starting at row start. 
  1043.  
  1044. Only column 4 of c should be used. As many rows as desired may be used. The 
  1045. number of the first unused row must be returned. 
  1046.  
  1047. For further details, refer to the user's guide and the demo programs 
  1048. dialog3.cpp and demo.cpp 
  1049.  
  1050.  
  1051. ΓòÉΓòÉΓòÉ 6.6.4.2. KrUserDataField::transform ΓòÉΓòÉΓòÉ
  1052.  
  1053. public: 
  1054. virtual Boolean transform (Boolean doIt) = 0; 
  1055.  
  1056. To give the user the opportunity to do input, window elements like IEntryField 
  1057. must be used. If doIt is true, this function must transform the data in the 
  1058. window element to the actual user data. 
  1059.  
  1060. If doIt is false, the function may only test whether such a transform is 
  1061. possible with the data in the window element. 
  1062.  
  1063. If successfull transformation is possible or has been performed, true is 
  1064. returned. Otherwise, false is returned. 
  1065.  
  1066.  
  1067. ΓòÉΓòÉΓòÉ 7. Graphics Classes ΓòÉΓòÉΓòÉ
  1068.  
  1069. Sorry, no information yet 
  1070.  
  1071.  
  1072. ΓòÉΓòÉΓòÉ 8. Printing ΓòÉΓòÉΓòÉ
  1073.  
  1074. To easily print your graphics on any printer, use the KrPrinter class. 
  1075.  
  1076.  
  1077. ΓòÉΓòÉΓòÉ 8.1. KrPrinter ΓòÉΓòÉΓòÉ
  1078.  
  1079. Description 
  1080.  
  1081. Derivation 
  1082.  
  1083. Constructors 
  1084.  
  1085. Public Functions 
  1086.  
  1087.  
  1088. ΓòÉΓòÉΓòÉ 8.1.1. Class Description - KrPrinter ΓòÉΓòÉΓòÉ
  1089.  
  1090. #include "krprint.hpp" 
  1091.  
  1092. This class is used to output graphics to a printer. Its use is similar to that 
  1093. of IDrawingCanvas. 
  1094.  
  1095. In addition, KrPrinter provides methods to let the user choose the printer and 
  1096. the settings he wants to use. 
  1097.  
  1098.  
  1099. ΓòÉΓòÉΓòÉ 8.1.2. Derivation - KrPrinter ΓòÉΓòÉΓòÉ
  1100.  
  1101. KrPrinter inherits from IBase. 
  1102.  
  1103.  
  1104. ΓòÉΓòÉΓòÉ 8.1.3. Constructors - KrPrinter ΓòÉΓòÉΓòÉ
  1105.  
  1106. You can construct and destruct objects of this class. 
  1107.  
  1108. Overload 1 
  1109.  
  1110. public: 
  1111. KrPrinter (); 
  1112.  
  1113. The default constructor does not set any graphics list. Use setList before 
  1114. doing any printing. 
  1115.  
  1116. The printer which is used when print is called is initially the system default 
  1117. printer, using its default settings. 
  1118.  
  1119.  
  1120. ΓòÉΓòÉΓòÉ 8.1.4. Public Functions - KrPrinter ΓòÉΓòÉΓòÉ
  1121.  
  1122. Constructors 
  1123. KrPrinter 
  1124.  
  1125. Graphic List 
  1126. setList 
  1127.  
  1128. Printing 
  1129. print 
  1130.  
  1131. Retrieving Information 
  1132. getArea 
  1133.  
  1134. User Interaction 
  1135. printDialog 
  1136.  
  1137.  
  1138. ΓòÉΓòÉΓòÉ 8.1.4.1. KrPrinter::setList ΓòÉΓòÉΓòÉ
  1139.  
  1140. Use this function to select an IGList into the KrPrinter object. The contents 
  1141. of the IGList will be printed when print is called. 
  1142.  
  1143. The function returns the previously used IGList. If no IGList has been selected 
  1144. into the KrPronter object so far, 0 is returned. 
  1145.  
  1146. public: 
  1147. IGList* setList (IGList& list); 
  1148.  
  1149.  
  1150. ΓòÉΓòÉΓòÉ 8.1.4.2. KrPrinter::print ΓòÉΓòÉΓòÉ
  1151.  
  1152. Use this function to print the contents of the IGList previously selected by 
  1153. setList. 
  1154.  
  1155. The string title is used as the job title which appears in the queue display of 
  1156. the printer object. 
  1157.  
  1158. public: 
  1159. Boolean print (IString title); 
  1160.  
  1161.  
  1162. ΓòÉΓòÉΓòÉ 8.1.4.3. KrPrinter::getArea ΓòÉΓòÉΓòÉ
  1163.  
  1164. This function returns the rectangular area in system coordinates on which 
  1165. drawing on the printer takes place. p1 represents the lower left corner, p2 the 
  1166. upper right corner. 
  1167.  
  1168. public: 
  1169. void getArea (IPoint & p1, IPoint & p2); 
  1170.  
  1171.  
  1172. ΓòÉΓòÉΓòÉ 8.1.4.4. KrPrinter::printDialog ΓòÉΓòÉΓòÉ
  1173.  
  1174. This function pops up a dialog window in which the user can choose any printer 
  1175. which is to be used on subsequent calls to print. The user is also prompted to 
  1176. define his own printer settings for the print job. The printer and its settings 
  1177. are stored for the lifetime of the KrPrinter object. The only way to change 
  1178. them is to call printDialog again. 
  1179.  
  1180. At the end of his input, the user may either press the OK button or the Cancel 
  1181. button. If he chose the OK button, true is returned. 
  1182.  
  1183. public: 
  1184. Boolean printDialog (); 
  1185.  
  1186.  
  1187. ΓòÉΓòÉΓòÉ 9. Ini file access ΓòÉΓòÉΓòÉ
  1188.  
  1189. To easily access data in OS/2 system ini files or in your own ini files, use 
  1190. the KrProfile class. 
  1191.  
  1192.  
  1193. ΓòÉΓòÉΓòÉ 9.1. KrProfile ΓòÉΓòÉΓòÉ
  1194.  
  1195. Description 
  1196.  
  1197. Derivation 
  1198.  
  1199. Constructors 
  1200.  
  1201. Public Functions 
  1202.  
  1203. Enumerations 
  1204.  
  1205. Manipulators 
  1206.  
  1207.  
  1208. ΓòÉΓòÉΓòÉ 9.1.1. Class Description - KrProfile ΓòÉΓòÉΓòÉ
  1209.  
  1210. #include "krprof.hpp" 
  1211.  
  1212. Using this class, you can read and write data from/to os2.ini, os2sys.ini, or 
  1213. any other OS/2 style ini file that you choose, using the common << and >> 
  1214. operators. 
  1215.  
  1216.  
  1217. ΓòÉΓòÉΓòÉ 9.1.2. Derivation - KrProfile ΓòÉΓòÉΓòÉ
  1218.  
  1219. KrProfile inherits from iostream. It also inherits from the non-public class 
  1220. _KrProfileBase, but this is only for technical reasons. 
  1221.  
  1222.  
  1223. ΓòÉΓòÉΓòÉ 9.1.3. Constructors - KrProfile ΓòÉΓòÉΓòÉ
  1224.  
  1225. You can construct and destruct objects of this class. 
  1226.  
  1227. Overload 1 
  1228.  
  1229. public: 
  1230. KrProfile (const IString & aApp, profile aProfile = user, 
  1231.       Boolean iBuffered = false); 
  1232.  
  1233. Use this constructor to open the system ini file aProfile for reading and 
  1234. writing data of the application which is identified by the name aApp in the ini 
  1235. file. 
  1236.  
  1237. By default, the object acts like a unit-buffered iostream, i.e. you can simply 
  1238. do your input output using the operators << and >>. If you want to avoid the 
  1239. slight overhead created by unit-buffering, and you want full buffering instead, 
  1240. set iBuffered=true If you do so, however, don't forget that you are now 
  1241. responsible for flushing the stream yourself using the manipulator flush. 
  1242.  
  1243. Overload 2 
  1244.  
  1245. public:
  1246. KrProfile (const IString & aApp, const IString & aProfile,
  1247.       Boolean iBuffered = false);
  1248.  
  1249. This is identical to overload 1, except that aProfile is now not neccessarily a 
  1250. system ini file, but the file name of any ini file. If it doesn't already 
  1251. exist, this constructor creates this ini file. 
  1252.  
  1253.  
  1254. ΓòÉΓòÉΓòÉ 9.1.4. Public Functions - KrProfile ΓòÉΓòÉΓòÉ
  1255.  
  1256. Application control 
  1257. exists 
  1258. removeApp 
  1259.  
  1260. Constructors 
  1261. KrProfile 
  1262. ~KrProfile 
  1263.  
  1264. I/O functions 
  1265. clearBuffer 
  1266. readData 
  1267. writeData 
  1268.  
  1269. Key control 
  1270. existsKey 
  1271. key 
  1272. removeKey 
  1273. setKey 
  1274.  
  1275. Retrieving information 
  1276. good 
  1277. size 
  1278.  
  1279.  
  1280. ΓòÉΓòÉΓòÉ 9.1.4.1. KrProfile::exists ΓòÉΓòÉΓòÉ
  1281.  
  1282. Returns true if any data of the application already exists in the ini file, and 
  1283. false otherwise. 
  1284.  
  1285. public: 
  1286. Boolean exists (); 
  1287.  
  1288.  
  1289. ΓòÉΓòÉΓòÉ 9.1.4.2. KrProfile::removeApp ΓòÉΓòÉΓòÉ
  1290.  
  1291. Removes all data of the application from the ini file. 
  1292.  
  1293. public: 
  1294. void removeApp (); 
  1295.  
  1296.  
  1297. ΓòÉΓòÉΓòÉ 9.1.4.3. KrProfile::~KrProfile ΓòÉΓòÉΓòÉ
  1298.  
  1299. public: 
  1300. ~KrProfile (); 
  1301.  
  1302.  
  1303. ΓòÉΓòÉΓòÉ 9.1.4.4. KrProfile::clearBuffer ΓòÉΓòÉΓòÉ
  1304.  
  1305. Do not use this function, since it might become private in a later version. Use 
  1306. the manipulator clear instead. 
  1307.  
  1308. public: 
  1309. void clearBuffer (); 
  1310.  
  1311.  
  1312. ΓòÉΓòÉΓòÉ 9.1.4.5. KrProfile::readData ΓòÉΓòÉΓòÉ
  1313.  
  1314. This function appends the contents of the ini file associated to the current 
  1315. key to the stream. Its direct use may be confusing; it is recommended to use 
  1316. the >> operator instead, which will call this function only when neccessary. 
  1317. This function may become private in a later version. 
  1318.  
  1319. public: 
  1320. virtual void readData (); 
  1321.  
  1322.  
  1323. ΓòÉΓòÉΓòÉ 9.1.4.6. KrProfile::writeData ΓòÉΓòÉΓòÉ
  1324.  
  1325. Do not use this function, since it might become private in a later version. Use 
  1326. the manipulator flush instead. 
  1327.  
  1328. public: 
  1329. virtual void writeData (Boolean callFromBuff); 
  1330.  
  1331.  
  1332. ΓòÉΓòÉΓòÉ 9.1.4.7. KrProfile::existsKey ΓòÉΓòÉΓòÉ
  1333.  
  1334. Returns true if any data associated to the current key already exists in the 
  1335. ini file, and false otherwise. 
  1336.  
  1337. public: 
  1338. Boolean existsKey (); 
  1339.  
  1340.  
  1341. ΓòÉΓòÉΓòÉ 9.1.4.8. KrProfile::key ΓòÉΓòÉΓòÉ
  1342.  
  1343. Returns the currently set key. 
  1344.  
  1345. public: 
  1346. IString & key (); 
  1347.  
  1348.  
  1349. ΓòÉΓòÉΓòÉ 9.1.4.9. KrProfile::removeKey ΓòÉΓòÉΓòÉ
  1350.  
  1351. Removes all data associated to the currently set key from the ini file. 
  1352.  
  1353. public: 
  1354. void removeKey (); 
  1355.  
  1356.  
  1357. ΓòÉΓòÉΓòÉ 9.1.4.10. KrProfile::setKey ΓòÉΓòÉΓòÉ
  1358.  
  1359. Clears the stream and sets a new key. Before setKey is called for the first 
  1360. time, the key "Default" is set. 
  1361.  
  1362. public: 
  1363. void setKey (const IString & aKey = "Default"); 
  1364.  
  1365.  
  1366. ΓòÉΓòÉΓòÉ 9.1.4.11. KrProfile::good ΓòÉΓòÉΓòÉ
  1367.  
  1368. Returns true if the ini file was successfully opened, and false otherwise. 
  1369.  
  1370. public: 
  1371. Boolean good (); 
  1372.  
  1373.  
  1374. ΓòÉΓòÉΓòÉ 9.1.4.12. KrProfile::size ΓòÉΓòÉΓòÉ
  1375.  
  1376. Returns the number of bytes currently stored in the ini file under the current 
  1377. key. 
  1378.  
  1379. public: 
  1380. long size (); 
  1381.  
  1382.  
  1383. ΓòÉΓòÉΓòÉ 9.1.5. Enumerations - KrProfile ΓòÉΓòÉΓòÉ
  1384.  
  1385. profile 
  1386.  
  1387.  
  1388. ΓòÉΓòÉΓòÉ 9.1.5.1. KrProfile::profile ΓòÉΓòÉΓòÉ
  1389.  
  1390. public: 
  1391. enum profile { system, user, both }; 
  1392.  
  1393. If a system ini file is to be opened, a member of this enumeration should be 
  1394. passed to the constructor. These are their meanings: 
  1395.  
  1396.  
  1397.  system     Read and write to the OS/2 system ini file
  1398.             (usually called os2sys.ini)
  1399.  
  1400.  user       Read and write to the OS/2 user ini file (usually
  1401.             called os2.ini)
  1402.  
  1403.  both       Read from both above ini files, write to the OS/2
  1404.             user ini file.
  1405.  
  1406.  
  1407. ΓòÉΓòÉΓòÉ 9.1.6. Manipulators - KrProfile ΓòÉΓòÉΓòÉ
  1408.  
  1409. Key control 
  1410. clear 
  1411. flush 
  1412.  
  1413. Stream handling 
  1414. remove 
  1415.  
  1416.  
  1417. ΓòÉΓòÉΓòÉ 9.1.6.1. clear ΓòÉΓòÉΓòÉ
  1418.  
  1419. Use this manipulator to clear the stream. This is neccessary if you have 
  1420. already read from or written to the stream, but want to discard that data and 
  1421. write completely new data to that key instead of appending to the old data. 
  1422.  
  1423. public: 
  1424. KrProfile & clear (KrProfile & aProfile); 
  1425.  
  1426.  
  1427. ΓòÉΓòÉΓòÉ 9.1.6.2. flush ΓòÉΓòÉΓòÉ
  1428.  
  1429. Use this manipulator to flush the stream. This is only neccessary if you have 
  1430. constructed the KrProfile object as a fully buffered stream. 
  1431.  
  1432. public: 
  1433. KrProfile & flush (KrProfile & aProfile); 
  1434.  
  1435.  
  1436. ΓòÉΓòÉΓòÉ 9.1.6.3. flush ΓòÉΓòÉΓòÉ
  1437.  
  1438. This manipulator is a convenient way to call removeKey. 
  1439.  
  1440. public: 
  1441. KrProfile & remove (KrProfile & aProfile); 
  1442.  
  1443.  
  1444. ΓòÉΓòÉΓòÉ 10. Error handling ΓòÉΓòÉΓòÉ
  1445.  
  1446. The IBM open class library extensively uses exceptions both to inform the 
  1447. programmer about the success of actions performed by classes of the library and 
  1448. to provide comprehensive debugging information. 
  1449.  
  1450. Unfortunately, however, the user of an application will not see any error 
  1451. messages when the program is aborted due to an uncatched exception. Instead, 
  1452. the program will just terminate. The KrTraceclass take care of this and other 
  1453. error handling related issues. 
  1454.  
  1455.  
  1456. ΓòÉΓòÉΓòÉ 10.1. KrTrace ΓòÉΓòÉΓòÉ
  1457.  
  1458. Description 
  1459.  
  1460. Derivation 
  1461.  
  1462. Constructors 
  1463.  
  1464. Public Functions 
  1465.  
  1466. Enumerations 
  1467.  
  1468. Macros 
  1469.  
  1470.  
  1471. ΓòÉΓòÉΓòÉ 10.1.1. Class Description - KrTrace ΓòÉΓòÉΓòÉ
  1472.  
  1473. #include "krtrace.hpp" 
  1474.  
  1475. This class handles uncatched exceptions. Whenever an uncatched exception 
  1476. occurres, the following is done: 
  1477.  
  1478.    1. Optionally, the exception data is writen to some location 
  1479.  
  1480.    2. Optionally, the user is informed that an error has occurred 
  1481.  
  1482.    3. The program is terminated 
  1483.  
  1484.  This class uses and enhances the functionality of ITrace. 
  1485.  
  1486.  
  1487. ΓòÉΓòÉΓòÉ 10.1.2. Derivation - KrTrace ΓòÉΓòÉΓòÉ
  1488.  
  1489. KrTrace inherits from IBase. 
  1490.  
  1491.  
  1492. ΓòÉΓòÉΓòÉ 10.1.3. Constructors - KrTrace ΓòÉΓòÉΓòÉ
  1493.  
  1494. You cannot construct objects of this class. Instead, make use of its 
  1495. enumerations and of its static member functions. 
  1496.  
  1497. Overload 1 
  1498.  
  1499. private: 
  1500. KrProfile (); 
  1501.  
  1502.  
  1503. ΓòÉΓòÉΓòÉ 10.1.4. Public Functions - KrTrace ΓòÉΓòÉΓòÉ
  1504.  
  1505. Exception handling 
  1506. tellUser 
  1507. traceTo 
  1508.  
  1509. Exception throwing 
  1510. _throw 
  1511.  
  1512.  
  1513. ΓòÉΓòÉΓòÉ 10.1.4.1. KrTrace::tellUser ΓòÉΓòÉΓòÉ
  1514.  
  1515. Use this function to determine how detailed (if at all) the user should be 
  1516. informed about a program crash by a message box. 
  1517.  
  1518. public: 
  1519. static void tellUser (userInfo aInfo); 
  1520.  
  1521.  
  1522. ΓòÉΓòÉΓòÉ 10.1.4.2. KrTrace::traceTo ΓòÉΓòÉΓòÉ
  1523.  
  1524. Use this function to determine whether trace and exception information should 
  1525. be logged, and if yes, to which destination. 
  1526.  
  1527. Overload 1 
  1528.  
  1529. public: 
  1530. static void traceTo (traceTarget aTarget); 
  1531.  
  1532. Overload 1 traces to the destination aTarget. 
  1533.  
  1534. Overload 2 
  1535.  
  1536. public: 
  1537. static void traceTo (const IString & s); 
  1538.  
  1539. Overload 2 traces to a file. Its filename is given by s. 
  1540.  
  1541. Overload 3 
  1542.  
  1543. public: 
  1544. static void traceTo (); 
  1545.  
  1546. Overload 3 traces to the file progname.log in the current directory, where 
  1547. progname is the name of the exe-file of the program (without the .exe suffix). 
  1548.  
  1549. Note:   Overload 3 requires that the IBM open class library has been correctly 
  1550.         initialized using IApplication::current().setArgs(). 
  1551.  
  1552.  
  1553. ΓòÉΓòÉΓòÉ 10.1.4.3. KrTrace::_throw ΓòÉΓòÉΓòÉ
  1554.  
  1555. You should not call this function directly, but use one of the macros instead. 
  1556.  
  1557. Overload 1 
  1558.  
  1559. public:
  1560. static void _throw (const IException & ex, const char* fileName,
  1561.           const char* functionName, unsigned long lineNumber);
  1562.  
  1563. Overload 2 
  1564.  
  1565. public:
  1566. static void _throw (const IException & ex, const char* fileName,
  1567.           const char* functionName, unsigned long lineNumber,
  1568.           const IString & group);
  1569.  
  1570.  
  1571. ΓòÉΓòÉΓòÉ 10.1.5. Enumerations - KrTrace ΓòÉΓòÉΓòÉ
  1572.  
  1573. traceTarget 
  1574.  
  1575. userInfo 
  1576.  
  1577.  
  1578. ΓòÉΓòÉΓòÉ 10.1.5.1. KrTrace::traceTarget ΓòÉΓòÉΓòÉ
  1579.  
  1580. public: 
  1581. enum traceTarget {stdout, stderr, file, queue, none}; 
  1582.  
  1583. This enumeration is used to identify the logging destination when calling 
  1584. traceTo. These are the meanings of their members: 
  1585.  
  1586.  
  1587.  stdout     Write all log information to stdout
  1588.  
  1589.  stderr     Write all log information to stderr
  1590.  
  1591.  file       Write all log information to a file. If a file
  1592.             name has already been set using traceTo, that name
  1593.             is used. If no file name has been set so far,
  1594.             traceTo is called without arguments to determine a
  1595.             filename. In this case, please note the remarks to
  1596.             traceTo.
  1597.  
  1598.  queue      Write all log information to the queue
  1599.             \\QUEUES\\PRINT32.
  1600.  
  1601.  none       Do not perform any logging. This is the default
  1602.             until traceTo is called.
  1603.  
  1604.  
  1605. ΓòÉΓòÉΓòÉ 10.1.5.2. KrTrace::userInfo ΓòÉΓòÉΓòÉ
  1606.  
  1607. public: 
  1608. enum userInfo {noMsg, simple, logFile, full}; 
  1609.  
  1610. Use this enumeration with tellUser to tell the system whether the user of your 
  1611. application should recieve information about crashes. The meanings of their 
  1612. members are: 
  1613.  
  1614.  
  1615.  noMsg      Do not give the user any message and just exit
  1616.             from the program. This is the default until
  1617.             tellUser is called. This is also what the IBM open
  1618.             class library does if Kroi's Classes are not used.
  1619.  
  1620.  simple     Just tell the user that an error was encountered
  1621.             and that the program cannot continue.
  1622.  
  1623.  logFile    Like "simple", but tell the user also the location
  1624.             of the log file (if any exists).
  1625.  
  1626.  full       Like "logFile", but also pop up full information
  1627.             about the exception which caused the crash.
  1628.  
  1629.  
  1630. ΓòÉΓòÉΓòÉ 10.1.6. Macros - KrTrace ΓòÉΓòÉΓòÉ
  1631.  
  1632. For use with the KrTrace class, the following macros are defined: 
  1633.  
  1634. KRTHROW(exc) 
  1635. KRNAMEDTHROW(exc,name) 
  1636.  
  1637. KRTHROW works exactly like ITHROW, but accepts also temporaries as arguments 
  1638. (if you try this with ITHROW, all position information will be lost). 
  1639.  
  1640. KRNAMEDTHROW works like KRTHROW, but expects another parameter name, which 
  1641. should be an IString object and contains the name of the group this exception 
  1642. belongs to. Use this to identify the module the exception was thrown from. 
  1643.  
  1644.  
  1645. ΓòÉΓòÉΓòÉ <hidden> Dummy ΓòÉΓòÉΓòÉ
  1646.  
  1647.  
  1648. ΓòÉΓòÉΓòÉ <hidden> Dummy ΓòÉΓòÉΓòÉ
  1649.  
  1650.  
  1651. ΓòÉΓòÉΓòÉ <hidden> Dummy ΓòÉΓòÉΓòÉ
  1652.  
  1653.  
  1654. ΓòÉΓòÉΓòÉ <hidden> Dummy ΓòÉΓòÉΓòÉ
  1655.  
  1656.  
  1657. ΓòÉΓòÉΓòÉ <hidden> Dummy ΓòÉΓòÉΓòÉ
  1658.  
  1659.  
  1660. ΓòÉΓòÉΓòÉ <hidden> Dummy ΓòÉΓòÉΓòÉ
  1661.  
  1662.  
  1663. ΓòÉΓòÉΓòÉ <hidden> Dummy ΓòÉΓòÉΓòÉ
  1664.  
  1665.  
  1666. ΓòÉΓòÉΓòÉ <hidden> Dummy ΓòÉΓòÉΓòÉ
  1667.  
  1668.  
  1669. ΓòÉΓòÉΓòÉ <hidden> Dummy ΓòÉΓòÉΓòÉ
  1670.  
  1671.  
  1672. ΓòÉΓòÉΓòÉ <hidden> Dummy ΓòÉΓòÉΓòÉ
  1673.  
  1674.  
  1675. ΓòÉΓòÉΓòÉ <hidden> Dummy ΓòÉΓòÉΓòÉ
  1676.  
  1677.  
  1678. ΓòÉΓòÉΓòÉ <hidden> Dummy ΓòÉΓòÉΓòÉ
  1679.  
  1680.  
  1681. ΓòÉΓòÉΓòÉ <hidden> Dummy ΓòÉΓòÉΓòÉ
  1682.  
  1683.  
  1684. ΓòÉΓòÉΓòÉ <hidden> Dummy ΓòÉΓòÉΓòÉ
  1685.  
  1686.  
  1687. ΓòÉΓòÉΓòÉ <hidden> Dummy ΓòÉΓòÉΓòÉ
  1688.  
  1689.  
  1690. ΓòÉΓòÉΓòÉ <hidden> Dummy ΓòÉΓòÉΓòÉ
  1691.  
  1692.  
  1693. ΓòÉΓòÉΓòÉ <hidden> Dummy ΓòÉΓòÉΓòÉ
  1694.  
  1695.