LibOFX: messages.cpp Source File

LibOFX

- Main Page
- Related Pages
- Namespaces
- Data Structures
- Files

- File List
- Globals

messages.cpp
Go to the documentation of this file.
1 /***************************************************************************
2 ofx_messages.cpp
3 -------------------
4 copyright : (C) 2002 by Benoit Gr�goire
5 email : benoitg@coeus.ca
6 ***************************************************************************/
10 /***************************************************************************
11 * *
12 * This program is free software; you can redistribute it and/or modify *
13 * it under the terms of the GNU General Public License as published by *
14 * the Free Software Foundation; either version 2 of the License, or *
15 * (at your option) any later version. *
16 * *
17 ***************************************************************************/
18 #include <iostream>
19 #include <stdlib.h>
20 #include <string>
21 #include "ParserEventGeneratorKit.h"
22 #include "ofx_utilities.hh"
23 #include "messages.hh"
24 #include "config.h"
25 #include "libofx.h"
26
27 SGMLApplication::OpenEntityPtr entity_ptr;
28 SGMLApplication::Position position;
30 int ofx_PARSER_msg = false;
31 int ofx_DEBUG_msg = false;
32 int ofx_DEBUG1_msg = false;
33 int ofx_DEBUG2_msg = false;
34 int ofx_DEBUG3_msg = false;
35 int ofx_DEBUG4_msg = false;
36 int ofx_DEBUG5_msg = false;
37 int ofx_STATUS_msg = false;
38 int ofx_INFO_msg = false;
39 int ofx_WARNING_msg = false;
40 int ofx_ERROR_msg = false;
41 int ofx_show_position = true;
43 void show_line_number()
44 {
45 extern SGMLApplication::OpenEntityPtr entity_ptr;
46 extern SGMLApplication::Position position;
47
48
49 if (ofx_show_position == true)
50 {
51 SGMLApplication::Location *location = new SGMLApplication::Location(entity_ptr, position);
52 cerr << "(Above message occured on Line " << location->lineNumber << ", Column " << location->columnNumber << ")" << endl;
53 delete location;
54 }
55 }
56
60 int message_out(OfxMsgType error_type, const string message)
61 {
62
63
64 switch (error_type)
65 {
66 case DEBUG :
67 if (ofx_DEBUG_msg == true)
68 {
69 cerr << "LibOFX DEBUG: " << message << "\n";
70 show_line_number();
71 }
72 break;
73 case DEBUG1 :
74 if (ofx_DEBUG1_msg == true)
75 {
76 cerr << "LibOFX DEBUG1: " << message << "\n";
77 show_line_number();
78 }
79 break;
80 case DEBUG2 :
81 if (ofx_DEBUG2_msg == true)
82 {
83 cerr << "LibOFX DEBUG2: " << message << "\n";
84 show_line_number();
85 }
86 break;
87 case DEBUG3 :
88 if (ofx_DEBUG3_msg == true)
89 {
90 cerr << "LibOFX DEBUG3: " << message << "\n";
91 show_line_number();
92 }
93 break;
94 case DEBUG4 :
95 if (ofx_DEBUG4_msg == true)
96 {
97 cerr << "LibOFX DEBUG4: " << message << "\n";
98 show_line_number();
99 }
100 break;
101 case DEBUG5 :
102 if (ofx_DEBUG5_msg == true)
103 {
104 cerr << "LibOFX DEBUG5: " << message << "\n";
105 show_line_number();
106 }
107 break;
108 case STATUS :
109 if (ofx_STATUS_msg == true)
110 {
111 cerr << "LibOFX STATUS: " << message << "\n";
112 show_line_number();
113 }
114 break;
115 case INFO :
116 if (ofx_INFO_msg == true)
117 {
118 cerr << "LibOFX INFO: " << message << "\n";
119 show_line_number();
120 }
121 break;
122 case WARNING :
123 if (ofx_WARNING_msg == true)
124 {
125 cerr << "LibOFX WARNING: " << message << "\n";
126 show_line_number();
127 }
128 break;
129 case ERROR :
130 if (ofx_ERROR_msg == true)
131 {
132 cerr << "LibOFX ERROR: " << message << "\n";
133 show_line_number();
134 }
135 break;
136 case PARSER :
137 if (ofx_PARSER_msg == true)
138 {
139 cerr << "LibOFX PARSER: " << message << "\n";
140 show_line_number();
141 }
142 break;
143 default:
144 cerr << "LibOFX UNKNOWN ERROR CLASS, This is a bug in LibOFX\n";
145 show_line_number();
146 }
147
148 return 0;
149 }
150
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.