messages.cpp
Go to the documentation of this file.
/***************************************************************************
ofx_messages.cpp
-------------------
copyright : (C) 2002 by Benoit Gr�goire
email : benoitg@coeus.ca
***************************************************************************/
/***************************************************************************
* *
* This program is free software; you can redistribute it and/or modify *
* it under the terms of the GNU General Public License as published by *
* the Free Software Foundation; either version 2 of the License, or *
* (at your option) any later version. *
* *
***************************************************************************/
#include <iostream>
#include <stdlib.h>
#include <string>
#include "ParserEventGeneratorKit.h"
#include "ofx_utilities.hh"
#include "messages.hh"
#include "config.h"
#include "libofx.h"
SGMLApplication::OpenEntityPtr entity_ptr;
SGMLApplication::Position position;
int ofx_PARSER_msg = false;
int ofx_DEBUG_msg = false;
int ofx_DEBUG1_msg = false;
int ofx_DEBUG2_msg = false;
int ofx_DEBUG3_msg = false;
int ofx_DEBUG4_msg = false;
int ofx_DEBUG5_msg = false;
int ofx_STATUS_msg = false;
int ofx_INFO_msg = false;
int ofx_WARNING_msg = false;
int ofx_ERROR_msg = false;
int ofx_show_position = true;
void show_line_number()
{
extern SGMLApplication::OpenEntityPtr entity_ptr;
extern SGMLApplication::Position position;
if (ofx_show_position == true)
{
SGMLApplication::Location *location = new SGMLApplication::Location(entity_ptr, position);
cerr << "(Above message occured on Line " << location->lineNumber << ", Column " << location->columnNumber << ")" << endl;
delete location;
}
}
int message_out(OfxMsgType error_type, const string message)
{
switch (error_type)
{
case DEBUG :
if (ofx_DEBUG_msg == true)
{
cerr << "LibOFX DEBUG: " << message << "\n";
show_line_number();
}
break;
case DEBUG1 :
if (ofx_DEBUG1_msg == true)
{
cerr << "LibOFX DEBUG1: " << message << "\n";
show_line_number();
}
break;
case DEBUG2 :
if (ofx_DEBUG2_msg == true)
{
cerr << "LibOFX DEBUG2: " << message << "\n";
show_line_number();
}
break;
case DEBUG3 :
if (ofx_DEBUG3_msg == true)
{
cerr << "LibOFX DEBUG3: " << message << "\n";
show_line_number();
}
break;
case DEBUG4 :
if (ofx_DEBUG4_msg == true)
{
cerr << "LibOFX DEBUG4: " << message << "\n";
show_line_number();
}
break;
case DEBUG5 :
if (ofx_DEBUG5_msg == true)
{
cerr << "LibOFX DEBUG5: " << message << "\n";
show_line_number();
}
break;
case STATUS :
if (ofx_STATUS_msg == true)
{
cerr << "LibOFX STATUS: " << message << "\n";
show_line_number();
}
break;
case INFO :
if (ofx_INFO_msg == true)
{
cerr << "LibOFX INFO: " << message << "\n";
show_line_number();
}
break;
case WARNING :
if (ofx_WARNING_msg == true)
{
cerr << "LibOFX WARNING: " << message << "\n";
show_line_number();
}
break;
case ERROR :
if (ofx_ERROR_msg == true)
{
cerr << "LibOFX ERROR: " << message << "\n";
show_line_number();
}
break;
case PARSER :
if (ofx_PARSER_msg == true)
{
cerr << "LibOFX PARSER: " << message << "\n";
show_line_number();
}
break;
default:
cerr << "LibOFX UNKNOWN ERROR CLASS, This is a bug in LibOFX\n";
show_line_number();
}
return 0;
}
ofx_DEBUG_msg
int ofx_DEBUG_msg
Definition: messages.cpp:31
ofx_DEBUG5_msg
int ofx_DEBUG5_msg
Definition: messages.cpp:36
position
SGMLApplication::Position position
Definition: messages.cpp:28
INFO
Definition: messages.hh:32
DEBUG3
Definition: messages.hh:28
STATUS
Definition: messages.hh:31
ofx_STATUS_msg
int ofx_STATUS_msg
Definition: messages.cpp:37
DEBUG2
Definition: messages.hh:27
ofx_WARNING_msg
int ofx_WARNING_msg
Definition: messages.cpp:39
ofx_INFO_msg
int ofx_INFO_msg
Definition: messages.cpp:38
ofx_DEBUG2_msg
int ofx_DEBUG2_msg
Definition: messages.cpp:33
WARNING
Definition: messages.hh:33
DEBUG4
Definition: messages.hh:29
message_out
int message_out(OfxMsgType error_type, const string message)
Message output function.
Definition: messages.cpp:60
PARSER
Definition: messages.hh:35
entity_ptr
SGMLApplication::OpenEntityPtr entity_ptr
Definition: messages.cpp:27
DEBUG
Definition: messages.hh:25
OfxMsgType
OfxMsgType
Definition: messages.hh:23
ofx_DEBUG3_msg
int ofx_DEBUG3_msg
Definition: messages.cpp:34
ofx_show_position
int ofx_show_position
Definition: messages.cpp:41
DEBUG5
Definition: messages.hh:30
ofx_utilities.hh
Various simple functions for type conversion & al.
ERROR
Definition: messages.hh:34
ofx_DEBUG4_msg
int ofx_DEBUG4_msg
Definition: messages.cpp:35
DEBUG1
Definition: messages.hh:26
ofx_PARSER_msg
int ofx_PARSER_msg
Definition: messages.cpp:30
ofx_DEBUG1_msg
int ofx_DEBUG1_msg
Definition: messages.cpp:32
ofx_ERROR_msg
int ofx_ERROR_msg
Definition: messages.cpp:40
messages.hh
Message IO functionality.