All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Defines
Public Types | Public Member Functions
QGpCoreTools::XMLErrorReport Class Reference

Brief description of class still missing. More...

#include <XMLErrorReport.h>

List of all members.

Public Types

enum  Option { Read = 0x01, Write = 0x2, NoMessageBox = 0x04 }

Public Member Functions

bool exec (XMLClass::Error err)
 Q_DECLARE_FLAGS (Options, Option)
void setFileName (const QString &f)
void setTitle (const QString &t)
 XMLErrorReport (Options o)
 ~XMLErrorReport ()

Detailed Description

Brief description of class still missing.

Full description of class still missing


Member Enumeration Documentation

Enumerator:
Read 
Write 
NoMessageBox 
{Read=0x01, Write=0x2, NoMessageBox=0x04};

Constructor & Destructor Documentation

Description of constructor still missing

  {
    _options=o;
    StringStream * s=new StringStream(&_log);
    _redirection=new StreamRedirection(s);
  }

Description of constructor still missing

  {
    delete _redirection; // For security if exec() is not used.
  }

Member Function Documentation

Entering this function, all the XML process is finished and stream can be deleted.

References QGpCoreTools::Message::critical(), QGpCoreTools::endl(), QGpCoreTools::XMLClass::message(), MSG_ID, QGpCoreTools::XMLClass::NoError, NoMessageBox, Read, QGpCoreTools::App::setStreamPrefix(), QGpCoreTools::App::stream(), QGpCoreTools::tr(), and Write.

Referenced by SciFigs::GraphContent::addLayers(), createBands(), createCurve(), createCurveName(), createDots(), createGrid(), createManyCurves(), GeopsyCore::CustomFileFormats::CustomFileFormats(), SciFigs::GraphicSheet::fileOpen(), ControlPanel::load(), SciFigs::LegendWidget::load(), SciFigs::ColorPaletteWidget::load(), DinverGui::open(), SciFigs::GraphContent::pasteLayers(), SciFigs::GraphicObject::pasteMakeUp(), SciFigs::GraphicSheet::pasteMakeUp(), SciFigs::GraphicObject::restoreMakeUp(), SciFigs::GraphicSheet::restoreMakeUp(), and SciFigs::LegendWidget::save().

  {
    delete _redirection;
    _redirection=0; // for a smooth destructor
    if(err!=XMLClass::NoError) {
      if(_options & NoMessageBox) {
        App::stream() << _title << endl;
        App::setStreamPrefix("  ");
        if(!_fileName.isEmpty()) {
          if(_options & Read) {
            App::stream() << tr("An error occurred while reading from file %1\n").arg(_fileName);
          } else if(_options & Write) {
            App::stream() << tr("An error occurred while writing to file %1\n").arg(_fileName);
          }
        }
        App::stream() << XMLClass::message(err) << endl;
        if(!_log.isEmpty()) {
          App::stream() << _log;
        }
        App::setStreamPrefix(QString::null);
        App::stream() << endl;
      } else {
        QString msg;
        if(_fileName.isEmpty()) {
          if(_options & Read) {
            msg=tr("An error occurred while reading XML content\n");
          } else if(_options & Write) {
            msg=tr("An error occurred while writing XML content\n");
          } else {
            msg=tr("An error occurred while accesing XML content\n");
          }
        } else {
          if(_options & Read) {
            msg=tr("An error occurred while reading from file %1\n").arg(_fileName);
          } else if(_options & Write) {
            msg=tr("An error occurred while writing to file %1\n").arg(_fileName);
          } else {
            msg=tr("An error occurred while accessing file %1\n").arg(_fileName);
          }
        }
        msg+=XMLClass::message(err)+"\n";
        if(!_log.isEmpty()) {
          msg+=tr("\nDetails:\n")+_log;
        }
        Message::critical(MSG_ID, _title, msg, true);
      }
      return false;
    } else {
      if(!_log.isEmpty()) {
        App::stream() << _title << endl;
        App::setStreamPrefix("  ");
        App::stream() << _log;
        App::setStreamPrefix(QString::null);
        App::stream() << endl;
      }
      return true;
    }
  }
void QGpCoreTools::XMLErrorReport::setFileName ( const QString &  f) [inline]
void QGpCoreTools::XMLErrorReport::setTitle ( const QString &  t) [inline]

The documentation for this class was generated from the following files:
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Defines