Debian Codegraph @

src/gengine/ExInfo.cpp

raw
1 /*
2 * Copyright (C) 2004 Ivo Danihelka ([email protected])
3 *
4 * This program is free software; you can redistribute it and/or modify
5 * it under the terms of the GNU General Public License as published by
6 * the Free Software Foundation; either version 2 of the License, or
7 * (at your option) any later version.
8 */
9 #include "ExInfo.h"
10
11 #include "StringTool.h"
12
13 //-----------------------------------------------------------------
14 /**
15 * Info about problem.
16 * @param problem short info
17 */
18 ExInfo::ExInfo(const std::string &problem) throw()
19 : m_what(problem)
20 {
21 /* empty */
22 }
23 //-----------------------------------------------------------------
24 /**
25 * Return info about problem.
26 * @return pointer to info which is valid only with this ExInfo
27 */
28 const char *
29 ExInfo::what() const throw()
30 {
31 return m_what.c_str();
32 }
33 //-----------------------------------------------------------------
34 /**
35 * Add more info.
36 * @param name description
37 * @param value value
38 * @return *this
39 */
40 ExInfo &
41 ExInfo::addInfo(const std::string &name,
42 const std::string &value) throw()
43 {
44 m_what.append("; ");
45 m_what.append(name);
46 m_what.append("='");
47 m_what.append(value);
48 m_what.append("'");
49 return *this;
50 }
51 //-----------------------------------------------------------------
52 /**
53 * Add more info, numeric value.
54 * @param name description
55 * @param value value
56 * @return *this
57 */
58 ExInfo &
59 ExInfo::addInfo(const std::string &name, long value) throw()
60 {
61 m_what.append("; ");
62 m_what.append(name);
63 m_what.append("=");
64 m_what.append(StringTool::toString(value));
65 return *this;
66 }
67