FolderParser.cpp

Go to the documentation of this file.
00001 #include "FolderParser.h"
00002 
00003 FolderParser::FolderParser( Folder& folder, const QString& location ) : folder( folder ), isFolderFile( false ), location( location ) {
00004 }
00005 
00006 bool FolderParser::startDocument() {
00007     return( true );
00008 }
00009 
00010 bool FolderParser::startElement( const QString&, const QString&, const QString& qname, const QXmlAttributes& attribs ) {
00011     if( qname == QString( "folder" ) ) {
00012         folder.setTitle( attribs.value( QString( "name" ) ) );
00013         folder.setAuthor( attribs.value( QString( "author" ) ) );
00014         desc = QString();
00015         isFolderFile = true;
00016     }
00017     else if( qname == QString( "desc" ) ) {
00018         mustKeepText = true;
00019         tempCh = QString();
00020     }
00021     return( true );
00022 }
00023 
00024 bool FolderParser::characters( const QString& characters ) {
00025     if( mustKeepText ) {
00026         tempCh = characters.stripWhiteSpace();
00027         mustKeepText = false;
00028     }
00029     return( true );
00030 }
00031 
00032 bool FolderParser::endElement( const QString&, const QString&, const QString& qname ) {
00033     if( qname == QString( "desc" ) ) {
00034         desc = tempCh;
00035         folder.setDescription( desc );
00036     }
00037     
00038     return( true );
00039 }
00040 
00041 bool FolderParser::endDocument() {
00042     return( true );
00043 }
00044 
00045 bool FolderParser::fatalError( const QXmlParseException& exception ) {
00046     QMessageBox::warning( 0, QObject::tr( "Error" ), 
00047         QObject::tr( "ParseError" )
00048             .arg( exception.lineNumber() )
00049             .arg( exception.columnNumber() )
00050             .arg( exception.message() ) );
00051     return( false );
00052 }
00053 
00054 bool FolderParser::isVocabularyFile() {
00055     return( isFolderFile );
00056 }

Generated on Sun Mar 1 17:30:47 2009 for toMOTko by  doxygen 1.5.6