home *** CD-ROM | disk | FTP | other *** search
/ DP Tool Club 24 / CD_ASCQ_24_0995.iso / vrac / apdtr.zip / ADMODDB.INT < prev    next >
Text File  |  1995-05-26  |  3KB  |  99 lines

  1. {$G+,X+,F+}
  2.  
  3. {Conditional defines that may affect this unit}
  4. {$I AWDEFINE.INC}
  5.  
  6. {*********************************************************}
  7. {*                   ADMODDB.PAS 1.00                    *}
  8. {*        Copyright (c) TurboPower Software 1995         *}
  9. {*                 All rights reserved.                  *}
  10. {*********************************************************}
  11.  
  12. unit AdModDB;
  13.   {-Delphi modem database component}
  14.  
  15. interface
  16.  
  17. uses
  18.   {-----RTL}
  19.   SysUtils,
  20.   Classes,
  21.   Messages,
  22.   WinTypes,
  23.   DsgnIntf,
  24.   Forms,
  25.   Controls,
  26.   {-----APD}
  27.   OoMisc,
  28.   AwModDB,
  29.   AdMisc,
  30.   AdExcept,
  31.   AdIniDB;
  32.  
  33. const
  34.   DefModemDBName = 'AWMODEM.INI';
  35.  
  36. type
  37.   TCustomModemDBase = class(TComponent)
  38.   private
  39.     DB        : PModemDatabase;         {record passed to DLL calls}
  40.     Strs      : TStringList;            {for returning lists of modems}
  41.     Scratch   : TModemData;             {scratch record for passing into DLL}
  42.     Changed   : Boolean;                {TRUE if database data has changed}
  43.     FOpen     : Boolean;                {TRUE if database has been opened}
  44.     FFileName : String;                 {file name, used mostly at design time}
  45.  
  46.     {property read/write}
  47.     procedure SetFileName(const NewName : String);
  48.       {-Update the database's file name.  Reopen under the new name}
  49.     procedure SetOpen(const OpenIt : Boolean);
  50.       {-Open or close the database}
  51.     function GetRecordList : TStrings;
  52.       {-Returns the names of each modem in the database}
  53.     function GetNumModems : Integer;
  54.       {-Returns the number of modems in the database}
  55.  
  56.     {utility}
  57.     procedure AssureOpen;
  58.       {-Make sure that the database is open, otherwise raise an exception}
  59.  
  60.   protected
  61.     property FileName : String
  62.       read FFileName write SetFileName;
  63.  
  64.   public
  65.     constructor Create(AOwner : TComponent); override;
  66.     destructor Destroy; override;
  67.  
  68.     procedure AddModem(const Modem : TModemInfo);
  69.       {-Add a modem to the database}
  70.     procedure UpdModem(ModemName : TModemName; const Modem : TModemInfo);
  71.       {-Update a modem's record in the database}
  72.     procedure DelModem(ModemName : TModemName);
  73.       {-Delete a modem from the database}
  74.     procedure GetModem(ModemName : TModemName; var Modem : TModemInfo);
  75.       {-Get a modem from the database}
  76.     procedure WriteToIni(const Rec : TModemInfo; Section, IniFile : String);
  77.       {-Write the modem to a user-specified .INI file}
  78.     procedure ReadFromIni(var Rec : TModemInfo; const Section, IniFile : String);
  79.       {-Read the modem from a user-specified .INI file}
  80.  
  81.     property NumModems : Integer
  82.       read GetNumModems;
  83.     property Modems : TStrings
  84.       read GetRecordList;
  85.     property Open : Boolean
  86.       read FOpen write SetOpen;
  87.   end;
  88.  
  89.   TModemDBase = class(TCustomModemDBase)
  90.   published
  91.     property FileName;
  92.   end;
  93.  
  94. procedure StrsToPChars(const StrRec : TModemInfo; var PCharRec : TModemData);
  95.   {-Convert a record with string variables to a record with PChars}
  96. procedure PCharsToStrs(const PCharRec : TModemData; var StrRec : TModemInfo);
  97.   {-Convert a record with PChar variables to a record with strings}
  98.  
  99.