]> git.sur5r.net Git - bacula/bacula/blobdiff - bacula/src/wx-console/wxbtableparser.cpp
- wxbRestorePanel : Fixed problem when the newly created job is not at the end of...
[bacula/bacula] / bacula / src / wx-console / wxbtableparser.cpp
index 71d354d6401dab8c048587ab7270238bea66d95e..d5944e128bc3d756d7dfddaf7deb1ea0b2b17791 100644 (file)
 
 #include "wxbmainframe.h"
 
+#include <wx/arrimpl.cpp>
+
+WX_DEFINE_OBJARRAY(wxbTable);
+
+wxbArrayString::wxbArrayString(int n) : wxArrayString(), wxObject() {
+   Alloc(n);
+}
+
+wxbArrayString::~wxbArrayString() {
+   
+}
+
 /*
  *   wxbTableParser constructor
  */
-wxbTableParser::wxbTableParser() : wxbTable(5), wxbDataParser() {
+wxbTableParser::wxbTableParser() : wxbTable(), wxbDataParser(true) {
    separatorNum = 0;
-   tableHeader = wxbTableRow(5);
+   tableHeader = wxbArrayString();
 }
 
 /*
@@ -56,25 +68,24 @@ wxbTableParser::~wxbTableParser() {
 /*
  *   Returns table header as an array of wxStrings.
  */
-wxbTableRow* wxbTableParser::GetHeader() {
-   return &tableHeader;
+const wxbArrayString& wxbTableParser::GetHeader() {
+   return tableHeader;
 }
 
 /*
- *   Receives director information, forwarded by the wxbPanel which
- *  uses this parser.
+ *   Receives data to analyse.
  */
-void wxbTableParser::Print(wxString str, int status) {
+bool wxbTableParser::Analyse(wxString str, int status) {
    if ((status == CS_END) && (separatorNum > 0)) {
       separatorNum = 3;
    }
 
-   if (separatorNum == 3) return;
+   if (separatorNum == 3) return false;
 
    if (str.Length() > 4) {
       if ((str.GetChar(0) == '+') && (str.GetChar(str.Length()-2) == '+') && (str.GetChar(str.Length()-1) == '\n')) {
          separatorNum++;
-         return;
+         return false;
       }
 
       if ((str.GetChar(0) == '|') && (str.GetChar(str.Length()-2) == '|') && (str.GetChar(str.Length()-1) == '\n')) {
@@ -82,21 +93,20 @@ void wxbTableParser::Print(wxString str, int status) {
          wxStringTokenizer tkz(str, "|", wxTOKEN_STRTOK);
 
          if (separatorNum == 1) {
-            int i = 0;
             while ( tkz.HasMoreTokens() ) {
-               tableHeader[i++] = tkz.GetNextToken().Trim(true).Trim(false);
+               tableHeader.Add(tkz.GetNextToken().Trim(true).Trim(false));
             }
          }
          else if (separatorNum == 2) {
-            wxbTableRow tablerow(tableHeader.size());
-            int i = 0;
+            wxbArrayString tablerow(tableHeader.GetCount());
             while ( tkz.HasMoreTokens() ) {
-               tablerow[i++] = tkz.GetNextToken().Trim(true).Trim(false);
+               tablerow.Add(tkz.GetNextToken().Trim(true).Trim(false));
             }
-            (*this)[size()] = tablerow;
+            Add(tablerow);
          }
       }
    }
+   return false;
 }
 
 /*