]> git.sur5r.net Git - bacula/bacula/blob - bacula/src/wx-console/wxbutils.cpp
Added wxbutils.cpp, win32 test corrected.
[bacula/bacula] / bacula / src / wx-console / wxbutils.cpp
1 /*
2  *
3  *   wxbDataParser, class that receives and analyses data
4  *
5  *    Nicolas Boichat, April 2004
6  *
7  */
8 /*
9    Copyright (C) 2004 Kern Sibbald and John Walker
10
11    This program is free software; you can redistribute it and/or
12    modify it under the terms of the GNU General Public License
13    as published by the Free Software Foundation; either version 2
14    of the License, or (at your option) any later version.
15
16    This program is distributed in the hope that it will be useful,
17    but WITHOUT ANY WARRANTY; without even the implied warranty of
18    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
19    GNU General Public License for more details.
20
21    You should have received a copy of the GNU General Public License
22    along with this program; if not, write to the Free Software
23    Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.
24  */
25  
26 #include "wxbutils.h"
27
28 #include "wxbmainframe.h"
29
30 #include "csprint.h"
31
32 /* Creates a new wxbDataParser, and register it in wxbMainFrame */
33 wxbDataParser::wxbDataParser() {
34    wxbMainFrame::GetInstance()->Register(this);
35 }
36
37 /* Destroy a wxbDataParser, and unregister it in wxbMainFrame */
38 wxbDataParser::~wxbDataParser() {
39    wxbMainFrame::GetInstance()->Unregister(this);
40 }
41
42 /* Creates a new wxbDataTokenizer */
43 wxbDataTokenizer::wxbDataTokenizer(): wxbDataParser(), wxArrayString() {
44    finished = false;
45 }
46
47 /* Destroy a wxbDataTokenizer */
48 wxbDataTokenizer::~wxbDataTokenizer() {
49
50 }
51
52 /*
53  *   Receives director information, forwarded by wxbMainFrame.
54  */
55 void wxbDataTokenizer::Print(wxString str, int status) {
56    finished = ((status == CS_END) || (status == CS_DISCONNECTED));
57
58    if (str != "") {
59       Add(str);
60    }
61 }
62
63 /* Returns true if the last signal received was an end signal, 
64  * indicating that no more data is available */
65 bool wxbDataTokenizer::hasFinished() {
66    return finished;
67 }