Renamed kpengine to jben_kpengine and made its data dir relocatable.
[jben.git] / errorlog.cpp
blobb987c8e1981c6d708c0f4ad86d0b0f302a5f1587
1 /*
2 Project: J-Ben
3 Author: Paul Goins
4 Website: http://www.vultaire.net/software/jben/
5 License: GNU General Public License (GPL) version 2
6 (http://www.gnu.org/licenses/old-licenses/gpl-2.0.txt)
8 File: errorlog.cpp
10 This program is free software; you can redistribute it and/or modify
11 it under the terms of the GNU General Public License as published by
12 the Free Software Foundation; either version 2 of the License, or
13 (at your option) any later version.
15 This program is distributed in the hope that it will be useful,
16 but WITHOUT ANY WARRANTY; without even the implied warranty of
17 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
18 GNU General Public License for more details.
20 You should have received a copy of the GNU General Public License
21 along with this program. If not, see <http://www.gnu.org/licenses/>
24 #include "errorlog.h"
26 ErrorLog el;
28 list<string>* ErrorLog::GetList(ELType t) {
29 switch(t) {
30 case EL_Error:
31 return &errors;
32 case EL_Warning:
33 return &warnings;
34 case EL_Info:
35 return &info;
37 return NULL;
40 int ErrorLog::Size() {
41 return errors.size() + warnings.size() + info.size();
44 int ErrorLog::Count(ELType t) {
45 list<string> *l = GetList(t);
46 if(!l) return -1;
47 return l->size();
50 string ErrorLog::PopFront(ELType t) {
51 string s;
52 list<string> *l = GetList(t);
53 if(l) {
54 s = l->front();
55 l->pop_front();
57 return s;
60 string ErrorLog::PopBack(ELType t) {
61 string s;
62 list<string> *l = GetList(t);
63 if(l) {
64 s = l->back();
65 l->pop_back();
67 return s;
70 void ErrorLog::Push(ELType t, string message) {
71 list<string> *l = GetList(t);
72 l->push_back(message);