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