home *** CD-ROM | disk | FTP | other *** search
/ OS/2 Shareware BBS: 10 Tools / 10-Tools.zip / ool_main.zip / ool / include / XAtom.h < prev    next >
Text File  |  1998-01-10  |  1KB  |  40 lines

  1. #ifndef __OOL_XTOM_H__
  2. #define __OOL_XTOM_H__
  3.  
  4. /*===========================================================================*/
  5. /* OOL ------------------- the Open Object Library ------------------- r 1.0 */
  6. /*===========================================================================*/
  7. /*                              class: XAtom                                 */
  8. /*                       derived from: XObject                               */
  9. /*                        last update: 12/97                                 */
  10. /*                      programmed by: Stefan von Brauk (sbrauk@gwdg.de)     */
  11. /*===========================================================================*/
  12.  
  13.  
  14. #include "xobject.h"
  15. #include "xexcept.h"
  16.  
  17. class _export_ XAtom: public XObject
  18. {
  19.       OOL_ATOMHANDLE atom;
  20.    public:
  21.       XAtom( const char * atomName, const BOOL failIfExist = FALSE)
  22.       {
  23.          HATOMTBL table = WinQuerySystemAtomTable();
  24.          atom = WinFindAtom(table, (PSZ) atomName);
  25.          if(atom)
  26.          {
  27.             if(failIfExist)
  28.                throw(XException("atom exists", -20));
  29.          } /* end if */
  30.          else
  31.             atom = WinAddAtom(table, (PSZ) atomName);
  32.          if(failIfExist)
  33.             throw(XException("couldn't create atom", -21));
  34.       }
  35.       OOL_ATOMHANDLE GetAtom() const { return atom; }
  36. };
  37.  
  38.  
  39. #endif
  40.