/*
 * This file is part of DesktopBSD, see the README file.
 *
 * Author: Peter Hofer <ph@desktopbsd.net>
 *         (C) 2004, 2005
 *
 * Copyright: BSD, see the COPYING file included in this distribution
 *
 */

#ifndef __DEVICE_H
#define __DEVICE_H

#include <qstring.h>

/** @brief Base class for devices.
  *
  * Device objects must be initialized with a proper device
  * name and should represent that device until they are deleted.
  *
  * operator=() and copy constructors of inherited
  * classes are possible exceptions for this behavior.
  */
class Device {
public:
   enum  Type {
      Invalid,  /**< Only used internally. */
      Unknown,

      Floppy,
      ATAPI_CD,
      ATA_Disk,
      ATA_RAID,
      SCSI_CD,
      SCSI_DirectAccess,
      IDE_WD100
   };

   Device(const Device &  dev);
   Device(const QString &  name);

   virtual ~Device();

   virtual  QString  getName()			const;
   virtual  QString  getDesc()			const;
   virtual  QString  getDriver()			const;
   virtual  Type		getDeviceType()	const;

   virtual  Device&  operator= (const Device &);


protected:
   /** @attention Only use this for copy constructors of inherited classes! */
   Device();

   void  setDevice(QString);


private:
   QString	name;    /**<  Device Name, e.g. 'fd0'                 */
   QString	desc;    /**<  Description, e.g. '1440-KB 3.5" drive'  */
   QString	driver;  /**<  Driver, e.g. 'fd'                       */
};


inline  Device::Device() {
};


inline  Device::Device(const Device &  dev) {
   operator= (dev);
};


/** Initialize with a device name, e.g. fxp0 */
inline  Device::Device(const QString &  name) {
   setDevice(name);
};


inline  Device::~Device() {
};


/** @sa name */
inline  QString  Device::getName()  const {
   return  name;
};


/** @sa desc */
inline  QString  Device::getDesc()  const {
   return  desc;
};


/** @sa driver */
inline  QString  Device::getDriver()  const {
   return  driver;
};


#endif /* __DEVICE_H */
