home *** CD-ROM | disk | FTP | other *** search
/ Amiga ISO Collection / AmigaUtilCD2.iso / Programming / C / OTL-MC7.DMS / in.adf / classsource.lha / ClassSource / DOS / Dos / dos.c
Encoding:
C/C++ Source or Header  |  1995-02-12  |  1.2 KB  |  76 lines

  1. #include <classes/DOS/dos.h>
  2.  
  3. #include <exec/memory.h>
  4.  
  5. #pragma -
  6. #include <pragma/dos_lib.h>
  7. #include <pragma/exec_lib.h>
  8. #pragma +
  9.  
  10. DosObjectC::DosObjectC(ULONG type, struct TagItem *tags)
  11.     : ShareC(),
  12.       priv(TRUE)
  13. {
  14.     dostype = type;
  15.     dosobject = AllocDosObject(type,tags);
  16.     if (!dosobject)
  17.         throw DosObjectX(type);
  18. }
  19.  
  20. DosObjectC::DosObjectC(ULONG type, Tag tag1type, ...)
  21.     : ShareC(),
  22.       priv(TRUE)
  23. {
  24.     dostype = type;
  25.     dosobject = AllocDosObject(type,(struct TagItem *) &tag1type);
  26.     if (!dosobject)
  27.         throw DosObjectX(type);
  28. }
  29.  
  30. DosObjectC::DosObjectC(ULONG type, APTR object)
  31.     : ShareC(),
  32.       priv(FALSE)
  33. {
  34.     dostype = type;
  35.     dosobject = object;
  36.     if (!dosobject)
  37.         throw DosObjectX(type);
  38. }
  39.  
  40. DosObjectC::DosObjectC(const DosObjectC &s)
  41.     : ShareC(s)
  42. {
  43.     dostype = s.dostype;
  44.     dosobject = s.dosobject;
  45.     priv = s.priv;
  46. }
  47.  
  48. DosObjectC::~DosObjectC()
  49. {
  50.     if (only())
  51.     {
  52.         if (priv)
  53.             FreeDosObject(dostype,dosobject);
  54.     };
  55. }
  56.  
  57. DosObjectC &DosObjectC::operator= (const DosObjectC &s)
  58. {
  59.     if (this != &s)
  60.     {
  61.         if (only())
  62.         {
  63.             if (priv)
  64.                 FreeDosObject(dostype,dosobject);
  65.         };
  66.         ShareC::operator=(s);
  67.         dostype = s.dostype;
  68.         dosobject = s.dosobject;
  69.         priv = s.priv;
  70.     };
  71.     return *this;
  72. }
  73.  
  74. // *************************************************************
  75.  
  76.