]> git.sur5r.net Git - bacula/bacula/blob - bacula/src/wx-console/wxbtableparser.h
Fix some trivial errors and implemented the restore of IRIX xattrs.
[bacula/bacula] / bacula / src / wx-console / wxbtableparser.h
1 /*
2  *
3  *   Class used to parse tables received from director in this format :
4  *
5  *  +---------+---------+-------------------+
6  *  | Header1 | Header2 | ...               |
7  *  +---------+---------+-------------------+
8  *  |  Data11 | Data12  | ...               |
9  *  |  ....   |  ...    | ...               |
10  *  +---------+---------+-------------------+
11  *
12  *    Nicolas Boichat, April 2004
13  *
14  *    Version $Id$
15  */
16 /*
17    Bacula® - The Network Backup Solution
18
19    Copyright (C) 2004-2009 Free Software Foundation Europe e.V.
20
21    The main author of Bacula is Kern Sibbald, with contributions from
22    many others, a complete list can be found in the file AUTHORS.
23    This program is Free Software; you can redistribute it and/or
24    modify it under the terms of version three of the GNU Affero General Public
25    License as published by the Free Software Foundation and included
26    in the file LICENSE.
27
28    This program is distributed in the hope that it will be useful, but
29    WITHOUT ANY WARRANTY; without even the implied warranty of
30    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
31    General Public License for more details.
32
33    You should have received a copy of the GNU Affero General Public License
34    along with this program; if not, write to the Free Software
35    Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
36    02110-1301, USA.
37
38    Bacula® is a registered trademark of Kern Sibbald.
39    The licensor of Bacula is the Free Software Foundation Europe
40    (FSFE), Fiduciary Program, Sumatrastrasse 25, 8006 Zürich,
41    Switzerland, email:ftf@fsfeurope.org.
42 */
43
44 #ifndef WXBTABLEPARSER_H
45 #define WXBTABLEPARSER_H
46
47 #include "wx/wxprec.h"
48
49 #ifdef __BORLANDC__
50    #pragma hdrstop
51 #endif
52
53 // for all others, include the necessary headers (this file is usually all you
54 // need because it includes almost all "standard" wxWindows headers)
55 #ifndef WX_PRECOMP
56    #include "wx/wx.h"
57 #endif
58
59 #include "wxbutils.h"
60
61 #include <wx/dynarray.h>
62
63 /*
64  * Allow the use of Object Array (auto-deletion, object returned as themselves
65  * and not as pointers)
66  */
67 class wxbArrayString: public wxArrayString, public wxObject {
68    public:
69       wxbArrayString(int n = 2000);
70       virtual ~wxbArrayString();
71 };
72
73 WX_DECLARE_OBJARRAY( wxbArrayString, wxbTable );
74
75 /*
76  * Class used to parse tables received from director. Data can be accessed with
77  * the operator [].
78  *
79  * Example : wxString elem = parser[3][2]; fetches column 2 of element 3.
80  */
81 class wxbTableParser: public wxbTable, public wxbDataParser
82 {
83    public:
84       wxbTableParser(bool header = true);
85       virtual ~wxbTableParser();
86
87       /*
88        *   Receives data to analyse.
89        */
90       virtual bool Analyse(wxString str, int status);
91
92       /*
93        *   Return true table parsing has finished.
94        */
95       bool hasFinished();
96
97       /*
98        *   Returns table header as an array of wxStrings.
99        */
100       const wxbArrayString& GetHeader();
101    private:
102       wxbArrayString tableHeader;
103
104       /*
105        * 0 - Table has not begun
106        * 1 - first +--+ line obtained, header will follow
107        * 2 - second +--+ line obtained, data will follow
108        * 3 - last +--+ line obtained, table parsing has finished
109        */
110       int separatorNum;
111 };
112
113 #endif // WXBTABLEPARSER_H