mirror of https://github.com/BOINC/boinc.git
108 lines
3.0 KiB
C++
108 lines
3.0 KiB
C++
// $Id$
|
|
//
|
|
// The contents of this file are subject to the BOINC Public License
|
|
// Version 1.0 (the "License"); you may not use this file except in
|
|
// compliance with the License. You may obtain a copy of the License at
|
|
// http://boinc.berkeley.edu/license_1.0.txt
|
|
//
|
|
// Software distributed under the License is distributed on an "AS IS"
|
|
// basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See the
|
|
// License for the specific language governing rights and limitations
|
|
// under the License.
|
|
//
|
|
// The Original Code is the Berkeley Open Infrastructure for Network Computing.
|
|
//
|
|
// The Initial Developer of the Original Code is the SETI@home project.
|
|
// Portions created by the SETI@home project are Copyright (C) 2002
|
|
// University of California at Berkeley. All Rights Reserved.
|
|
//
|
|
// Contributor(s):
|
|
//
|
|
// Revision History:
|
|
//
|
|
// $Log$
|
|
// Revision 1.2 2004/07/12 08:46:25 rwalton
|
|
// Document parsing of the <get_state/> message
|
|
//
|
|
// Revision 1.1 2004/06/25 22:50:57 rwalton
|
|
// Client spamming server hotfix
|
|
//
|
|
//
|
|
|
|
#if defined(__GNUG__) && !defined(__APPLE__)
|
|
#pragma implementation "FileInfo.h"
|
|
#endif
|
|
|
|
#include "stdwx.h"
|
|
#include <wx/arrimpl.cpp>
|
|
#include "FileInfo.h"
|
|
#include "error_numbers.h"
|
|
|
|
|
|
IMPLEMENT_DYNAMIC_CLASS(CFileInfo, CXMLParser)
|
|
WX_DEFINE_OBJARRAY(CArrayFileInfo);
|
|
|
|
|
|
CFileInfo::CFileInfo(void)
|
|
{
|
|
name = _T("");
|
|
generated_locally = false;
|
|
uploaded = false;
|
|
upload_when_present = false;
|
|
sticky = false;
|
|
pers_xfer_active = false;
|
|
xfer_active = false;
|
|
num_retries = 0;
|
|
bytes_xferred = 0.0;
|
|
file_offset = 0.0;
|
|
xfer_speed =0.0;
|
|
hostname = _T("");
|
|
project = NULL;
|
|
}
|
|
|
|
|
|
CFileInfo::~CFileInfo(void)
|
|
{
|
|
}
|
|
|
|
|
|
wxInt32 CFileInfo::Parse(wxTextInputStream* input)
|
|
{
|
|
wxString buf;
|
|
while (buf = input->ReadLine()) {
|
|
if (match_tag(buf, "</file_info>")) return 0;
|
|
else if (parse_str(buf, "<name>", name)) continue;
|
|
else if (match_tag(buf, "<generated_locally/>")) {
|
|
generated_locally = true;
|
|
continue;
|
|
}
|
|
else if (match_tag(buf, "<uploaded/>")) {
|
|
uploaded = true;
|
|
continue;
|
|
}
|
|
else if (match_tag(buf, "<upload_when_present/>")) {
|
|
upload_when_present = true;
|
|
continue;
|
|
}
|
|
else if (match_tag(buf, "<sticky/>")) {
|
|
sticky = true;
|
|
continue;
|
|
}
|
|
else if (match_tag(buf, "<persistent_file_xfer>")) {
|
|
pers_xfer_active = true;
|
|
continue;
|
|
}
|
|
else if (match_tag(buf, "<file_xfer>")) {
|
|
xfer_active = true;
|
|
continue;
|
|
}
|
|
else if (parse_int(buf, "<num_retries>", num_retries)) continue;
|
|
else if (parse_double(buf, "<bytes_xferred>", bytes_xferred)) continue;
|
|
else if (parse_double(buf, "<file_offset>", file_offset)) continue;
|
|
else if (parse_double(buf, "<xfer_speed>", xfer_speed)) continue;
|
|
else if (parse_str(buf, "<hostname>", hostname)) continue;
|
|
}
|
|
return ERR_XML_PARSE;
|
|
}
|
|
|