E-MailRelay

gexception.cpp
Go to the documentation of this file.
1//
2// Copyright (C) 2001-2021 Graeme Walker <graeme_walker@users.sourceforge.net>
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 3 of the License, or
7// (at your option) any later version.
8//
9// This program is distributed in the hope that it will be useful,
10// but WITHOUT ANY WARRANTY; without even the implied warranty of
11// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12// GNU General Public License for more details.
13//
14// You should have received a copy of the GNU General Public License
15// along with this program. If not, see <http://www.gnu.org/licenses/>.
16// ===
17///
18/// \file gexception.cpp
19///
20
21#include "gdef.h"
22#include "gexception.h"
23#include "gstr.h"
24#include "ggettext.h"
25
26 namespace G
27{
28 namespace ExceptionImp
29 {
30 std::string join( std::string s1 , const std::string & s2 )
31 {
32 if( !s2.empty() ) s1.append(": ").append(s2) ;
33 return s1 ;
34 }
35 std::string join( std::string s1 , const std::string & s2 , const std::string & s3 )
36 {
37 if( !s2.empty() ) s1.append(": ").append(s2) ;
38 if( !s3.empty() ) s1.append(": ").append(s3) ;
39 return s1 ;
40 }
41 std::string join( std::string s1 , const std::string & s2 , const std::string & s3 ,
42 const std::string & s4 )
43 {
44 if( !s2.empty() ) s1.append(": ").append(s2) ;
45 if( !s3.empty() ) s1.append(": ").append(s3) ;
46 if( !s4.empty() ) s1.append(": ").append(s4) ;
47 return s1 ;
48 }
49 std::string join( std::string s1 , const std::string & s2 , const std::string & s3 ,
50 const std::string & s4 , const std::string & s5 )
51 {
52 if( !s2.empty() ) s1.append(": ").append(s2) ;
53 if( !s3.empty() ) s1.append(": ").append(s3) ;
54 if( !s4.empty() ) s1.append(": ").append(s4) ;
55 if( !s5.empty() ) s1.append(": ").append(s5) ;
56 return s1 ;
57 }
58 }
59}
60
61 G::Exception::Exception( const char * what ) :
62 std::runtime_error(what?what:"")
63{
64}
65
66 G::Exception::Exception( const std::string & what ) :
67 std::runtime_error(what)
68{
69}
70
71 G::Exception::Exception( const char * what , const std::string & more ) :
72 std::runtime_error(ExceptionImp::join(what,more))
73{
74}
75
76 G::Exception::Exception( const std::string & what , const std::string & more ) :
77 std::runtime_error(ExceptionImp::join(what,more))
78{
79}
80
81 G::Exception::Exception( const char * what , const std::string & more1 , const std::string & more2 ) :
82 std::runtime_error(ExceptionImp::join(what,more1,more2))
83{
84}
85
86 G::Exception::Exception( const std::string & what , const std::string & more1 , const std::string & more2 ) :
87 std::runtime_error(ExceptionImp::join(what,more1,more2))
88{
89}
90
91 G::Exception::Exception( const char * what , const std::string & more1 , const std::string & more2 ,
92 const std::string & more3 ) :
93 std::runtime_error(ExceptionImp::join(what,more1,more2,more3))
94{
95}
96
97 G::Exception::Exception( const std::string & what , const std::string & more1 , const std::string & more2 ,
98 const std::string & more3 ) :
99 std::runtime_error(ExceptionImp::join(what,more1,more2,more3))
100{
101}
102
G::Exception::Exception
Exception(const char *what)
Constructor.
Definition: gexception.cpp:61
gexception.h
ggettext.h
gstr.h
G
Low-level classes.
Definition: galign.h:28