Menu

[557893]: / xml-base.cpp  Maximize  Restore  History

Download this file

108 lines (89 with data), 2.1 kB

  1
  2
  3
  4
  5
  6
  7
  8
  9
 10
 11
 12
 13
 14
 15
 16
 17
 18
 19
 20
 21
 22
 23
 24
 25
 26
 27
 28
 29
 30
 31
 32
 33
 34
 35
 36
 37
 38
 39
 40
 41
 42
 43
 44
 45
 46
 47
 48
 49
 50
 51
 52
 53
 54
 55
 56
 57
 58
 59
 60
 61
 62
 63
 64
 65
 66
 67
 68
 69
 70
 71
 72
 73
 74
 75
 76
 77
 78
 79
 80
 81
 82
 83
 84
 85
 86
 87
 88
 89
 90
 91
 92
 93
 94
 95
 96
 97
 98
 99
100
101
102
103
104
105
106
#include "xml-base.h"
#include <QMessageBox>
#include <QColor>
#include <QTextStream>
#include <iostream>
#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=s.split ("\n");
int i=1;
QStringList::Iterator it = sl.begin();
while (i<exception.lineNumber())
{
it++;
i++;
}
s=*it;
s.insert (exception.columnNumber()-1,"<ERROR>");
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, int p)
{
loadMode=lm;
insertPos=p;
}
Want the latest updates on software, tech news, and AI?
Get latest updates about software, tech news, and AI from SourceForge directly in your inbox once a month.