1 #ifndef _GLIBMM_BASE64_H
2 #define _GLIBMM_BASE64_H
3 
4 /*
5  * Copyright (C) 2012-2013 The gtkmm Development Team
6  *
7  * This library is free software; you can redistribute it and/or
8  * modify it under the terms of the GNU Lesser General Public
9  * License as published by the Free Software Foundation; either
10  * version 2.1 of the License, or (at your option) any later version.
11  *
12  * This library is distributed in the hope that it will be useful,
13  * but WITHOUT ANY WARRANTY; without even the implied warranty of
14  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
15  * Lesser General Public License for more details.
16  *
17  * You should have received a copy of the GNU Lesser General Public
18  * License along with this library.  If not, see <http://www.gnu.org/licenses/>.
19  */
20 
21 #include <glibmmconfig.h>
22 
23 #include <string>
24 #include <glib.h>
25 
26 namespace Glib
27 {
28 
29 /** @defgroup Base64 Base64 routines
30  * Base64 encoding/decoding routines.
31  * @{
32  */
33 
34 namespace Base64
35 {
36 
37 /** Encode the given string in base64 encoding.
38  *  You can pass <tt>true</tt> as the @a break_lines parameter to enable
39  *  line breaking, that is usually used in mail systems. The new line
40  *  character will appear for every 72 bytes.
41  * @param source A string to encode.
42  * @param break_lines Enables/disables line breaking.
43  * @return The string encoded in Base-64.
44  */
45 GLIBMM_API
46 std::string encode(const std::string& source, bool break_lines = false);
47 
48 /** Decode the given base64 encoded string.
49  * @param source A string to decode.
50  * @return The resulting decode string
51  */
52 GLIBMM_API
53 std::string decode(const std::string& source);
54 }
55 
56 /** @} group Base64 */
57 
58 } // namespace Glib
59 
60 #endif /* _GLIBMM_BASE64_H */
61