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
|
#include <string>
#include <vector>
#include <iostream>
using namespace std;
#include "category.h"
#include "errors.h"
#include "globals.h"
#include "utility.h"
#ifdef GUI
#include <qmessagebox.h>
#include "browser.h"
#endif
void addParseWarning( string msg )
{
string address = parsingfile + ":" + itos( (*linenrv)[linenr-1] ) + ":";
parsewarningv.push_back( address + " " + msg );
}
void addParseWarning( string msg, int linenr )
{
string address = parsingfile + ":" + itos( linenr ) + ":";
parsewarningv.push_back( address + " " + msg );
}
void showParseWarnings( )
{
if( parsewarningv.empty() )
return;
string msg;
for( unsigned int n = 0; n < parsewarningv.size(); n++ )
msg += parsewarningv[n] + "\n";
msg.erase( msg.length()-1, 1 );
#ifdef GUI
string caption = "Parse Warning";
if( parsewarningv.size() > 1 )
caption += "s";
QMessageBox mb( caption.c_str(), msg.c_str(), QMessageBox::Warning, QMessageBox::Ok, 0, 0 );
mb.exec();
#else
cout << msg << endl;
#endif
}
void showNavigationError( Category *category, string msg )
{
if( category == 0 )
{
showNavigationError( msg );
return;
}
msg = fullPath( cPath, category ) + ":\n" + msg;
showNavigationError( msg );
}
void showNavigationError( string msg )
{
if( checkingstructure )
return;
#ifdef GUI
QMessageBox mb( "Navigation Error", msg.c_str(), QMessageBox::Warning, QMessageBox::Ok, 0, 0 );
mb.exec();
#else
cout << msg << endl;
#endif
}
|