⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 alertdrv.h

📁 AlertDriver c++模块化类库
💻 H
📖 第 1 页 / 共 2 页
字号:
         //------------
         short resourceControl;   /*determines if this object should hold the
                                    resource or release it for use by other
                                    objects or programs*/
   };   //class RecordingAlertDriver



   class StdAlertDriver : public AlertDriver
   {
      public:
         //platform-specific member functions
         //----------------------------------
         #ifdef BORLAND_CONTAIN
            virtual char* nameOf() const {return "StdAlertDriver";}
         #endif   //BORLAND_CONTAIN

      protected:
         //member functions
         //----------------
         virtual void           ReportError(const char *text);
         virtual void           ReportInfo(const char *text);
         virtual void           ReportMessage(const char *text);
         virtual unsigned short ReportWarning(const char *text,
                                              const unsigned short
                                                 defaultChoice);
   };   //class StdAlertDriver



   class StreamAlertDriver : public RecordingAlertDriver
   {
      public:
         //constructor(s)
         //--------------
         StreamAlertDriver(ostream &outputStream,
                           const short resourceControlMode = radASISRESOURCE) :
            RecordingAlertDriver(resourceControlMode), outStream(outputStream){}

         //member functions
         //----------------
         ostream& GetStream(void) const {return outStream;}

         //platform-specific member functions
         //----------------------------------
         #ifdef BORLAND_CONTAIN
            virtual char* nameOf() const {return "StreamAlertDriver";}
         #endif   //BORLAND_CONTAIN

      protected:
         //data members
         //------------
         ostream &outStream;   //references the stream to be used for output

         //member functions
         //----------------
         virtual void           ReportError(const char *text);
         virtual void           ReportInfo(const char *text);
         virtual void           ReportMessage(const char *text);
         virtual unsigned short ReportWarning(const char *text,
                                              const unsigned short
                                                 defaultChoice);
   };   //class StreamAlertDriver



   class TextFileAlertDriver : public StreamAlertDriver
   {
      public:
         //constructor(s)
         //--------------
         TextFileAlertDriver(const char *filename,
                             const short resourceControlMode);

         //destructor
         //----------
         virtual ~TextFileAlertDriver();

         //member functions
         //----------------
         void GetFilename(char *filename) const {strcpy(filename, adFilename);}

         //platform-specific member functions
         //----------------------------------
         #ifdef BORLAND_CONTAIN
            virtual char* nameOf() const {return "TextFileAlertDriver";}
         #endif   //BORLAND_CONTAIN

      protected:
         //member functions
         //----------------
         virtual void           ReportError(const char *text);
         virtual void           ReportInfo(const char *text);
         virtual void           ReportMessage(const char *text);
         virtual unsigned short ReportWarning(const char *text,
                                              const unsigned short
                                                 defaultChoice);

      private:
         //data members
         //------------
         char *adFilename;   //name of file to which alerts will be reported
         ofstream adFile;   //stream used to record alerts 

         //member functions
         //----------------
         void SetFilename(const char *filename);
   };   //class TextFileAlertDriver



#if defined BORLAND_TV
   class TurboVisionAlertDriver : public AlertDriver
   {
      public:
         //constructor(s)
         //--------------
         TurboVisionAlertDriver(void);

         //destructor
         //----------
         virtual ~TurboVisionAlertDriver() {FreeMsgDialog();}

      protected:
         //data members
         //------------
         TDialog     *adMsgDialog;   /*points to the dialog box used for
                                       messages*/
         TStaticText *adMsgText;     //points to text used for messages

         //member functions
         //----------------
         virtual void           FreeMsgDialog(void);
         virtual void           FreeMsgText(void);
         virtual TDialog*       InitMsgDialog(void);
         virtual TStaticText*   InitMsgText(const TRect& bounds,
                                            const char *text)
                                   {return new TStaticText(bounds, text);}
         virtual void           ReportError(const char *text);
         virtual void           ReportInfo(const char *text);
         virtual void           ReportMessage(const char *text);
         virtual unsigned short ReportWarning(const char *text,
                                              const unsigned short
                                                 defaultChoice);
   };   //class TurboVisionAlertDriver
#endif   //BORLAND_TV



#ifdef TARGET_WINDOWS
   class WindowsAlertDriver : public AlertDriver
   {
      public:
         //constructor(s)
         //--------------
         WindowsAlertDriver(const HWND hParentWnd = NULL);

         //destructor
         //----------
         ~WindowsAlertDriver() {FreeMsgWindow();}

         //member functions
         //----------------
         HWND GetParent(void) {return hWndParent;}
         void SetParent(HWND hParentWnd) {hWndParent = hParentWnd;}
         
         //platform-specific member functions
         //----------------------------------
         #ifdef BORLAND_CONTAIN
            virtual char* nameOf() const {return "WindowsAlertDriver";}
         #endif   //BORLAND_CONTAIN

      protected:
         //data members
         //------------
         HWND hWndMsgText,     //handle to the message text
              hWndMsgWindow,   //handle to the message window
              hWndParent;      /*handle to the parent window of windows created
                                 by this object*/

         //member functions
         //----------------
         virtual void           FreeMsgWindow(void);
         virtual HWND           InitMsgWindow(void)
                                   {return WindowsInitMessage(hWndParent);}
         virtual void           ReportError(const char *text);
         virtual void           ReportInfo(const char *text);
         virtual void           ReportMessage(const char *text);
         virtual unsigned short ReportWarning(const char *text,
                                              const unsigned short
                                                 defaultChoice);
   };   //class WindowsAlertDriver



   #ifdef BORLAND_OWL
      class BWCCAlertDriver : public WindowsAlertDriver
      {
         public:
            //platform-specific member functions
            //----------------------------------
            #ifdef BORLAND_CONTAIN
               virtual char* nameOf() const {return "BWCCAlertDriver";}
            #endif   //BORLAND_CONTAIN

         protected:
            //member functions
            //----------------
            virtual void           ReportError(const char *text);
            virtual void           ReportInfo(const char *text);
            virtual unsigned short ReportWarning(const char *text,
                                                 const unsigned short
                                                    defaultChoice);
      };   //class BWCCAlertDriver
   #endif   //BORLAND_OWL



#endif   //TARGET_WINDOWS



   //variable(s)
   //-----------
   extern AlertDriver *defaultAlertDriver;   //the default AlertDriver



#endif   //!ALERTDRV_H

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -