1 /* Copyright (C) 2004 J.F.Dockes
2  *   This program is free software; you can redistribute it and/or modify
3  *   it under the terms of the GNU General Public License as published by
4  *   the Free Software Foundation; either version 2 of the License, or
5  *   (at your option) any later version.
6  *
7  *   This program is distributed in the hope that it will be useful,
8  *   but WITHOUT ANY WARRANTY; without even the implied warranty of
9  *   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
10  *   GNU General Public License for more details.
11  *
12  *   You should have received a copy of the GNU General Public License
13  *   along with this program; if not, write to the
14  *   Free Software Foundation, Inc.,
15  * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
16  */
17 #ifndef _BASE64_H_INCLUDED_
18 #define _BASE64_H_INCLUDED_
19 #include <string>
20 
21 void base64_encode(const std::string& in, std::string& out);
22 bool base64_decode(const std::string& in, std::string& out);
base64_encode(const std::string & in)23 inline std::string base64_encode(const std::string& in)
24 {
25     std::string o;
26     base64_encode(in, o);
27     return o;
28 }
base64_decode(const std::string & in)29 inline std::string base64_decode(const std::string& in)
30 {
31     std::string o;
32     if (base64_decode(in, o))
33     return o;
34     return std::string();
35 }
36 
37 #endif /* _BASE64_H_INCLUDED_ */
38