X-Git-Url: https://vcs.maemo.org/git/?a=blobdiff_plain;f=xml-base.cpp;fp=xml-base.cpp;h=88017cb56012be9e71fb1048fe85da004474f1f7;hb=2f79edb68ae955de3c3118a7f9181c7a1f3b0d72;hp=0000000000000000000000000000000000000000;hpb=eeb718b059f8b14807b976ae6410a3021b2d4576;p=vym diff --git a/xml-base.cpp b/xml-base.cpp new file mode 100644 index 0000000..88017cb --- /dev/null +++ b/xml-base.cpp @@ -0,0 +1,106 @@ +#include "xml-base.h" + +#include +#include +#include +#include + +#include "misc.h" +#include "settings.h" +#include "linkablemapobj.h" + +/* +static BranchObj *lastBranch; +static FloatObj *lastFloat; +static OrnamentedObj *lastOO; + +extern Settings settings; +extern QString vymVersion; +*/ + +parseBaseHandler::parseBaseHandler() {} + +parseBaseHandler::~parseBaseHandler() {} + +QString parseBaseHandler::errorProtocol() { return errorProt; } + + +/* +bool parseBaseHandler::startDocument() +{ + errorProt = ""; + state = StateInit; + laststate = StateInit; + stateStack.clear(); + stateStack.append(StateInit); + branchDepth=0; + htmldata=""; + isVymPart=false; + return true; +} +*/ + +QString parseBaseHandler::parseHREF(QString href) +{ + QString type=href.section(":",0,0); + QString path=href.section(":",1,1); + if (!tmpDir.endsWith("/")) + return tmpDir + "/" + path; + else + return tmpDir + path; +} + + +/* +QString parseBaseHandler::errorString() +{ + return "the document is not in the VYM file format"; +} +*/ + +bool parseBaseHandler::fatalError( const QXmlParseException& exception ) +{ + errorProt += QString( "Fatal parsing error: %1 in line %2, column %3\n") + .arg( exception.message() ) + .arg( exception.lineNumber() ) + .arg( exception.columnNumber() ); + // Try to read the bogus line + errorProt+=QString("File is: %1\n").arg(inputFile); + QString s; + if (loadStringFromDisk (inputFile,s)) + { + QStringList sl=QStringList::split ("\n",s); + int i=1; + QStringList::Iterator it = sl.begin(); + while (i"); + errorProt+=s; + } + return QXmlDefaultHandler::fatalError( exception ); +} + +void parseBaseHandler::setModel (VymModel *m) +{ + model=m; +} + +void parseBaseHandler::setTmpDir (QString tp) +{ + tmpDir=tp; +} + +void parseBaseHandler::setInputFile (QString f) +{ + inputFile=f; +} + +void parseBaseHandler::setLoadMode (const LoadMode &lm) +{ + loadMode=lm; +} +