summaryrefslogtreecommitdiffabout
Unidiff
Diffstat (more/less context) (ignore whitespace changes)
-rw-r--r--lib/exception.cc1
1 files changed, 1 insertions, 0 deletions
diff --git a/lib/exception.cc b/lib/exception.cc
index 65302bf..e03f818 100644
--- a/lib/exception.cc
+++ b/lib/exception.cc
@@ -1,48 +1,49 @@
1#include <stdio.h>
1#include <string.h> 2#include <string.h>
2#include <errno.h> 3#include <errno.h>
3#include "konforka/exception.h" 4#include "konforka/exception.h"
4 5
5namespace konforka { 6namespace konforka {
6 7
7 /* 8 /*
8 * code_point 9 * code_point
9 */ 10 */
10 11
11 code_point::code_point(const string& w) 12 code_point::code_point(const string& w)
12 : where(w), line(-1) { } 13 : where(w), line(-1) { }
13 code_point::code_point(const string& fi,const string& fu,int l) 14 code_point::code_point(const string& fi,const string& fu,int l)
14 : file(fi), function(fu), line(l) { 15 : file(fi), function(fu), line(l) {
15 make_where(); 16 make_where();
16 } 17 }
17 18
18 const char *code_point::c_str() const throw() { 19 const char *code_point::c_str() const throw() {
19 return where.c_str(); 20 return where.c_str();
20 } 21 }
21 22
22 void code_point::make_where() { 23 void code_point::make_where() {
23 static char tmp[8]; 24 static char tmp[8];
24 snprintf(tmp,sizeof(tmp),"%d",line); 25 snprintf(tmp,sizeof(tmp),"%d",line);
25 where = file + ":" + tmp + " [" + function + "]"; 26 where = file + ":" + tmp + " [" + function + "]";
26 } 27 }
27 28
28 /* 29 /*
29 * exception 30 * exception
30 */ 31 */
31 32
32 exception::exception(const string& whe,const string& wha) 33 exception::exception(const string& whe,const string& wha)
33 : _where(whe), _what(wha) { } 34 : _where(whe), _what(wha) { }
34 exception::exception(const string& fi,const string& fu,int l,const string& w) 35 exception::exception(const string& fi,const string& fu,int l,const string& w)
35 : _where(fi,fu,l), _what(w) { } 36 : _where(fi,fu,l), _what(w) { }
36 exception::~exception() throw() { } 37 exception::~exception() throw() { }
37 38
38 const char *exception::where() const throw() { 39 const char *exception::where() const throw() {
39 return _where.c_str(); 40 return _where.c_str();
40 } 41 }
41 const char *exception::what() const throw() { 42 const char *exception::what() const throw() {
42 return _what.c_str(); 43 return _what.c_str();
43 } 44 }
44 45
45 void exception::see(const string& w) { 46 void exception::see(const string& w) {
46 _seen.push_back(code_point(w)); 47 _seen.push_back(code_point(w));
47 } 48 }
48 void exception::see(const string& fi,const string& fu,int l) { 49 void exception::see(const string& fi,const string& fu,int l) {