build/libofx-0.10.0/lib/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 = true;
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);
if (location->lineNumber < LONG_MAX)
cerr << "(Above message occurred 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_WARNING_msg
int ofx_WARNING_msg
Definition: build/libofx-0.10.0/lib/messages.cpp:39
DEBUG4
Definition: build/libofx-0.10.0/lib/messages.hh:29
ofx_DEBUG4_msg
int ofx_DEBUG4_msg
Definition: build/libofx-0.10.0/lib/messages.cpp:35
position
SGMLApplication::Position position
Definition: build/libofx-0.10.0/lib/messages.cpp:28
INFO
Definition: build/libofx-0.10.0/lib/messages.hh:32
ofx_utilities.hh
Various simple functions for type conversion & al.
ofx_DEBUG2_msg
int ofx_DEBUG2_msg
Definition: build/libofx-0.10.0/lib/messages.cpp:33
ofx_DEBUG1_msg
int ofx_DEBUG1_msg
Definition: build/libofx-0.10.0/lib/messages.cpp:32
ofx_STATUS_msg
int ofx_STATUS_msg
Definition: build/libofx-0.10.0/lib/messages.cpp:37
ofx_DEBUG5_msg
int ofx_DEBUG5_msg
Definition: build/libofx-0.10.0/lib/messages.cpp:36
DEBUG1
Definition: build/libofx-0.10.0/lib/messages.hh:26
ofx_INFO_msg
int ofx_INFO_msg
Definition: build/libofx-0.10.0/lib/messages.cpp:38
OfxMsgType
OfxMsgType
Definition: build/libofx-0.10.0/lib/messages.hh:23
message_out
int message_out(OfxMsgType error_type, const string message)
Message output function.
Definition: build/libofx-0.10.0/lib/messages.cpp:61
entity_ptr
SGMLApplication::OpenEntityPtr entity_ptr
Definition: build/libofx-0.10.0/lib/messages.cpp:27
ofx_PARSER_msg
int ofx_PARSER_msg
Definition: build/libofx-0.10.0/lib/messages.cpp:30
WARNING
Definition: build/libofx-0.10.0/lib/messages.hh:33
ofx_DEBUG3_msg
int ofx_DEBUG3_msg
Definition: build/libofx-0.10.0/lib/messages.cpp:34
ofx_show_position
int ofx_show_position
Definition: build/libofx-0.10.0/lib/messages.cpp:41
PARSER
Definition: build/libofx-0.10.0/lib/messages.hh:35
STATUS
Definition: build/libofx-0.10.0/lib/messages.hh:31
messages.hh
Message IO functionality.
DEBUG
Definition: build/libofx-0.10.0/lib/messages.hh:25
DEBUG2
Definition: build/libofx-0.10.0/lib/messages.hh:27
ofx_ERROR_msg
int ofx_ERROR_msg
Definition: build/libofx-0.10.0/lib/messages.cpp:40
ERROR
Definition: build/libofx-0.10.0/lib/messages.hh:34
DEBUG3
Definition: build/libofx-0.10.0/lib/messages.hh:28
DEBUG5
Definition: build/libofx-0.10.0/lib/messages.hh:30
ofx_DEBUG_msg
int ofx_DEBUG_msg
Definition: build/libofx-0.10.0/lib/messages.cpp:31