KDevelop API Documentation

structureparser.cpp

Go to the documentation of this file.
00001 /***************************************************************************
00002                           structureparser.cpp  -  description
00003                              -------------------
00004     begin                : Sun Dec 3 2000
00005     copyright            : (C) 2000 by Ivan Hawkes
00006     email                : linuxgroupie@ivanhawkes.com
00007  ***************************************************************************/
00008 
00009 /***************************************************************************
00010  *                                                                         *
00011  *   This program is free software; you can redistribute it and/or modify  *
00012  *   it under the terms of the GNU General Public License as published by  *
00013  *   the Free Software Foundation; either version 2 of the License, or     *
00014  *   (at your option) any later version.                                   *
00015  *                                                                         *
00016  ***************************************************************************/
00017 
00018 #include "structureparser.h"
00019 
00020 
00021 StructureParser::StructureParser (BugList * Parent)
00022 {
00023     m_pParent = Parent;
00024 }
00025 
00026 
00027 bool StructureParser::startDocument()
00028 {
00029     // We would need to clear the list down before begining work.
00030     m_pParent->pMainBugList->clear ();
00031 
00032     return TRUE;
00033 }
00034 
00035 
00036 bool StructureParser::endDocument()
00037 {
00038     return TRUE;
00039 }
00040 
00041 
00042 bool StructureParser::startElement (const QString & namespaceURI, const QString & localName, const QString & qName, const QXmlAttributes & atts)
00043 {
00044     QString     Tag;
00045 
00046     // Just trying to ensure we recognise the tags, regardless of case.
00047     Tag = qName.upper ();
00048 
00049     // If this is the main tag, we will clear out the variable used for storing the tag values.
00050     if (Tag == "BUG")
00051     {
00052         //memset (&CurrentBug,sizeof (CurrentBug),0);
00053         CurrentBug = new Bug;
00054     }
00055 
00056     // BugID
00057     if (Tag == "BUGID")
00058     {
00059         State = stateBugID;
00060     }
00061     else if (Tag == "DESCRIPTION")
00062     {
00063         State = stateDescription;
00064     }
00065     else if (Tag == "SEVERITY")
00066     {
00067         State = stateSeverity;
00068     }
00069     else if (Tag == "CLASS")
00070     {
00071         State = stateBugClass;
00072     }
00073     else if (Tag == "LOCATION")
00074     {
00075         State = stateLocation;
00076     }
00077     else if (Tag == "REPORTUSERNAME")
00078     {
00079         State = stateReportUserName;
00080     }
00081     else if (Tag == "REPORTEMAIL")
00082     {
00083         State = stateReportEMail;
00084     }
00085     else if (Tag == "REPORTDATE")
00086     {
00087         State = stateReportDate;
00088     }
00089     else if (Tag == "FIXED")
00090     {
00091         State = stateFixed;
00092     }
00093     else if (Tag == "FIXDATE")
00094     {
00095         State = stateFixDate;
00096     }
00097     else if (Tag == "PACKAGE")
00098     {
00099         State = statePackage;
00100     }
00101     else if (Tag == "VERSIONNO")
00102     {
00103         State = stateVersionNo;
00104     }
00105     else if (Tag == "NOTES")
00106     {
00107         State = stateNotes;
00108     }
00109     else if (Tag == "WORKAROUND")
00110     {
00111         State = stateWorkaround;
00112     }
00113     else if (Tag == "FIXSCHEDULED")
00114     {
00115         State = stateFixScheduled;
00116     }
00117     else if (Tag == "ASSIGNEDTO")
00118     {
00119         State = stateAssignedTo;
00120     }
00121     else if (Tag == "ASSIGNEDDATE")
00122     {
00123         State = stateAssignedDate;
00124     }
00125     else if (Tag == "ASSIGNEDEMAIL")
00126     {
00127         State = stateAssignedEMail;
00128     }
00129     else if (Tag == "REPEAT")
00130     {
00131         State = stateRepeat;
00132     }
00133     else if (Tag == "SYSINFO")
00134     {
00135         State = stateSysInfo;
00136     }
00137     else if (Tag == "PRIORITY")
00138     {
00139         State = statePriority;
00140     }
00141     else if (Tag == "DEVELOPER")
00142     {
00143         State = stateDeveloperID;
00144     }
00145     else if (Tag == "INITIALS")
00146     {
00147         State = stateInitials;
00148     }
00149     else if (Tag == "COUNTER")
00150     {
00151         State = stateCounter;
00152     }
00153     else
00154     {
00155         State = stateUnknown;
00156     }
00157 
00158     return TRUE;
00159 }
00160 
00161 
00162 bool StructureParser::characters ( const QString & ch )
00163 {
00164     switch (State)
00165     {
00166         case stateBugID:
00167             CurrentBug->BugID = ch;
00168             break;
00169 
00170         case stateDescription:
00171             CurrentBug->Description = ch;
00172             break;
00173 
00174         case stateSeverity:
00175             CurrentBug->Severity = ch;
00176             break;
00177 
00178         case stateBugClass:
00179             CurrentBug->BugClass = ch;
00180             break;
00181 
00182         case stateLocation:
00183             CurrentBug->Location = ch;
00184             break;
00185 
00186         case stateReportUserName:
00187             CurrentBug->ReportUserName = ch;
00188             break;
00189 
00190         case stateReportEMail:
00191             CurrentBug->ReportEMail = ch;
00192             break;
00193 
00194         case statePackage:
00195             CurrentBug->Package = ch;
00196             break;
00197 
00198         case stateVersionNo:
00199             CurrentBug->VersionNo = ch;
00200             break;
00201 
00202         case stateNotes:
00203             CurrentBug->Notes = ch;
00204             break;
00205 
00206         case stateWorkaround:
00207             CurrentBug->Workaround = ch;
00208             break;
00209 
00210         case stateAssignedTo:
00211             CurrentBug->AssignedTo = ch;
00212             break;
00213 
00214         case stateAssignedEMail:
00215             CurrentBug->AssignedEMail = ch;
00216             break;
00217 
00218         case stateRepeat:
00219             CurrentBug->Repeat = ch;
00220             break;
00221 
00222         case stateSysInfo:
00223             CurrentBug->SysInfo = ch;
00224             break;
00225 
00226         case statePriority:
00227             CurrentBug->Priority = ch;
00228             break;
00229 
00230         case stateDeveloperID:
00231             // Just in case.
00232             CurrentInitials = "";
00233             CurrentCount = 1;
00234             break;
00235 
00236         case stateInitials:
00237             CurrentInitials = ch;
00238             break;
00239 
00240         case stateCounter:
00241             CurrentCount = ch.toInt ();
00242             break;
00243 
00244         case stateFixed:
00245             if (ch.toInt () == 0)
00246                 CurrentBug->Fixed = FALSE;
00247             else
00248                 CurrentBug->Fixed = TRUE;
00249             break;
00250 
00251         case stateReportDate:
00252             // Date is read from file in format dd/mm/yyyy
00253             CurrentBug->ReportDate.setYMD (ch.right (4).toInt (),ch.mid (ch.find ('/') + 1,ch.findRev ('/') - ch.find ('/') - 1).toInt (),ch.left (ch.find ('/')).toInt ());//ch;
00254             break;
00255 
00256         case stateFixDate:
00257             // Date is read from file in format dd/mm/yyyy
00258             CurrentBug->FixDate.setYMD (ch.right (4).toInt (),ch.mid (ch.find ('/') + 1,ch.findRev ('/') - ch.find ('/') - 1).toInt (),ch.left (ch.find ('/')).toInt ());//ch;
00259             break;
00260 
00261         case stateAssignedDate:
00262             // Date is read from file in format dd/mm/yyyy
00263             CurrentBug->AssignedDate.setYMD (ch.right (4).toInt (),ch.mid (ch.find ('/') + 1,ch.findRev ('/') - ch.find ('/') - 1).toInt (),ch.left (ch.find ('/')).toInt ());//ch;
00264             break;
00265 
00266         case stateFixScheduled:
00267             // Date is read from file in format dd/mm/yyyy
00268             CurrentBug->FixScheduled.setYMD (ch.right (4).toInt (),ch.mid (ch.find ('/') + 1,ch.findRev ('/') - ch.find ('/') - 1).toInt (),ch.left (ch.find ('/')).toInt ());//ch;
00269             break;
00270 
00271         case stateUnknown:
00272             // This is an error condition.
00273             break;
00274     }
00275 
00276     return TRUE;
00277 }
00278 
00279 
00280 bool StructureParser::endElement (const QString & namespaceURI, const QString & localName, const QString & qName)
00281 {
00282     QString     Tag;
00283 
00284     // Just trying to ensure we recognise the tags, regardless of case.
00285     Tag = qName.upper ();
00286 
00287     // When a bug tag is closed we should add the bug to the listbox.
00288     if (Tag == "BUG")
00289     {
00290         m_pParent->InsertBug (CurrentBug);
00291     }
00292     else if (Tag == "DEVELOPER")
00293     {
00294         AddDeveloper ();
00295     }
00296 
00297     return TRUE;
00298 }
00299 
00300 
00301 void StructureParser::AddDeveloper ()
00302 {
00303     BugCounter *    pBugCounter;
00304 
00305     // Add the current developer settings into the dictionary.
00306     pBugCounter = new BugCounter;
00307     pBugCounter->Initials = CurrentInitials;
00308     pBugCounter->LastBugNumber = CurrentCount;
00309     m_pParent->Developers.insert (pBugCounter->Initials, pBugCounter);
00310 }
KDE Logo
This file is part of the documentation for KDevelop Version 3.1.2.
Documentation copyright © 1996-2004 the KDE developers.
Generated on Wed Mar 23 00:03:54 2005 by doxygen 1.3.9.1 written by Dimitri van Heesch, © 1997-2003