]> git.sur5r.net Git - bacula/bacula/blobdiff - bacula/src/wx-console/wxbutils.h
Some Win32 fixes
[bacula/bacula] / bacula / src / wx-console / wxbutils.h
index d2a0df4946bcec6b8fc3319b2d110444d26ba1c2..ea1b9126cdfef4e2f1961fe1d8be1a8631b55b8d 100644 (file)
@@ -3,7 +3,7 @@
  *   wxbDataParser, class that receives and analyses data
  *   wxbPanel, main frame's notebook panels
  *
- *    Nicolas Boichat, April 2004
+ *    Nicolas Boichat, April-July 2004
  *
  */
 /*
@@ -24,8 +24,8 @@
    Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.
  */
 
-#ifndef WXBPANEL_H
-#define WXBPANEL_H
+#ifndef WXBUTILS_H
+#define WXBUTILS_H
 
 #include "wx/wxprec.h"
 
    #include "wx/wx.h"
 #endif
 
+class wxbTableParser;
+class wxbDataParser;
+class wxbDataTokenizer;
+class wxbPromptParser;
+
+/*
+ *  General functions
+ */
+class wxbUtils
+{
+   public:
+      /* Initialization */
+      static void Init();
+      
+      /* Reset state */
+      static void Reset();
+   
+      /* Parse a table in tableParser */
+      static wxbTableParser* CreateAndWaitForParser(wxString cmd);
+
+      /* Run a command, and waits until result is fully received,
+       * if keepresults is true, returns a valid pointer to a wxbDataTokenizer
+       * containing the data. */
+      static wxbDataTokenizer* WaitForEnd(wxString cmd, bool keepresults = false, bool linebyline = true);
+
+      /* Run a command, and waits until prompt result is fully received,
+       * if keepresults is true, returns a valid pointer to a wxbPromptParser
+       * containing the data. */
+      static wxbPromptParser* WaitForPrompt(wxString cmd, bool keepresults = false);
+
+   private:
+      static bool inited;
+};
+
 /*
  *  abstract class that can receive director information.
  */
@@ -142,20 +176,22 @@ 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;
 };
 
-#endif // WXBPANEL_H
-
+#endif // WXBUTILS_H