]> git.sur5r.net Git - bacula/bacula/blobdiff - bacula/src/wx-console/wxbutils.h
Remove SQLite2 scripts
[bacula/bacula] / bacula / src / wx-console / wxbutils.h
index 9c4ed6893efd6d31a8363a47f3c75305be214b8e..8a84417913e6d99fc63b3f00aa2af1c8b2fc835a 100644 (file)
@@ -1,27 +1,38 @@
 /*
- *
- *   wxbDataParser, class that receives and analyses data
- *   wxbPanel, main frame's notebook panels
- *
- *    Nicolas Boichat, April 2004
- *
- */
-/*
-   Copyright (C) 2004 Kern Sibbald and John Walker
+   Bacula® - The Network Backup Solution
+
+   Copyright (C) 2004-2008 Free Software Foundation Europe e.V.
 
-   This program is free software; you can redistribute it and/or
-   modify it under the terms of the GNU General Public License
-   as published by the Free Software Foundation; either version 2
-   of the License, or (at your option) any later version.
+   The main author of Bacula is Kern Sibbald, with contributions from
+   many others, a complete list can be found in the file AUTHORS.
+   This program is Free Software; you can redistribute it and/or
+   modify it under the terms of version two of the GNU General Public
+   License as published by the Free Software Foundation and included
+   in the file LICENSE.
 
-   This program is distributed in the hope that it will be useful,
-   but WITHOUT ANY WARRANTY; without even the implied warranty of
-   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
-   GNU General Public License for more details.
+   This program is distributed in the hope that it will be useful, but
+   WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+   General Public License for more details.
 
    You should have received a copy of the GNU General Public License
    along with this program; if not, write to the Free Software
-   Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.
+   Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
+   02110-1301, USA.
+
+   Bacula® is a registered trademark of Kern Sibbald.
+   The licensor of Bacula is the Free Software Foundation Europe
+   (FSFE), Fiduciary Program, Sumatrastrasse 25, 8006 Zürich,
+   Switzerland, email:ftf@fsfeurope.org.
+*/
+/*
+ *
+ *   wxbDataParser, class that receives and analyses data
+ *   wxbPanel, main frame's notebook panels
+ *
+ *    Nicolas Boichat, April-July 2004
+ *
+ *   Version $Id$
  */
 
 #ifndef WXBUTILS_H
@@ -46,10 +57,10 @@ class wxbUtils
    public:
       /* Initialization */
       static void Init();
-      
+
       /* Reset state */
       static void Reset();
-   
+
       /* Parse a table in tableParser */
       static wxbTableParser* CreateAndWaitForParser(wxString cmd);
 
@@ -62,7 +73,12 @@ class wxbUtils
        * if keepresults is true, returns a valid pointer to a wxbPromptParser
        * containing the data. */
       static wxbPromptParser* WaitForPrompt(wxString cmd, bool keepresults = false);
-
+      
+      /* Sleeps during milliseconds (wrapper for wxUsleep (2.4) or wxMilliSleep (2.6)) */
+      static void MilliSleep(unsigned long milliseconds);
+      
+      static wxString ConvertToPrintable(wxString& str);
+      
    private:
       static bool inited;
 };
@@ -85,7 +101,7 @@ class wxbDataParser
       /*
        * Receives director information, forwarded by wxbMainFrame, and sends it
        * line by line to the virtual function Analyse.
-       * 
+       *
        * Returns true if status == CS_PROMPT and the message has been parsed
        * correctly.
        */
@@ -112,7 +128,7 @@ class wxbPanel : public wxPanel
        *   Tab title in the notebook.
        */
       virtual wxString GetTitle() = 0;
-      
+
       /*
        *   Enable or disable this panel
        */
@@ -121,7 +137,7 @@ class wxbPanel : public wxPanel
 
 /*
  *  Receives director information, and splits it by line.
- * 
+ *
  * datatokenizer[0] retrieves first line
  */
 class wxbDataTokenizer: public wxbDataParser, public wxArrayString
@@ -137,11 +153,11 @@ class wxbDataTokenizer: public wxbDataParser, public wxArrayString
        *   Receives data to analyse.
        */
       virtual bool Analyse(wxString str, int status);
-      
-      /* Returns true if the last signal received was an end signal, 
+
+      /* Returns true if the last signal received was an end signal,
        * indicating that no more data is available */
       bool hasFinished();
-      
+
    private:
       bool finished;
 };
@@ -162,11 +178,11 @@ class wxbPromptParser: public wxbDataParser
        *   Receives data to analyse.
        */
       virtual bool Analyse(wxString str, int status);
-      
-      /* Returns true if the last signal received was an prompt signal, 
+
+      /* Returns true if the last signal received was an prompt signal,
        * or an end signal */
       bool hasFinished();
-      
+
       /* Returns true if the last message received is a prompt message */
       bool isPrompt();
 
@@ -175,17 +191,20 @@ class wxbPromptParser: public wxbDataParser
 
       /* Returns question string */
       wxString getQuestionString();
-      
-      /* Return a wxArrayString containing the indexed choices we have
+
+      /* Returns a wxArrayString containing the indexed choices we have
        * to answer the question, or NULL if this question is not a multiple
        * choice one. */
       wxArrayString* getChoices();
-      
-      
-      
+
+      /* Returns true if the expected answer to the choice list is a number,
+       * false if it is a string (for example yes/mod/no). */
+      bool isNumericalChoice();
+
    private:
       bool finished;
       bool prompt;
+      bool numerical;
       wxString introStr;
       wxArrayString* choices;
       wxString questionStr;