summaryrefslogtreecommitdiff
path: root/glib/src/uriutils.ccg
blob: 4650c0ccacdd04e528edb71ed3bcc7ef8ad496c3 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
/* Copyright (C) 2002 The gtkmm Development Team
 *
 * This library is free software; you can redistribute it and/or
 * modify it under the terms of the GNU Lesser General Public
 * License as published by the Free Software Foundation; either
 * version 2.1 of the License, or (at your option) any later version.
 *
 * This library is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
 * Lesser General Public License for more details.
 *
 * You should have received a copy of the GNU Lesser General Public
 * License along with this library.  If not, see <http://www.gnu.org/licenses/>.
 */

#include <glib.h>
#include <glibmm/utility.h>

namespace Glib
{

std::string
uri_unescape_string(const std::string& escaped_string, const std::string& illegal_characters)
{
  gchar* cresult = g_uri_unescape_string(escaped_string.c_str(), illegal_characters.c_str());
  return Glib::convert_return_gchar_ptr_to_stdstring(cresult);
}

std::string
uri_parse_scheme(const std::string& uri)
{
  return Glib::convert_return_gchar_ptr_to_stdstring(g_uri_parse_scheme(uri.c_str()));
}

std::string
uri_escape_string(
  const std::string& unescaped, const std::string& reserved_chars_allowed, bool allow_utf8)
{
  gchar* cresult =
    g_uri_escape_string(unescaped.c_str(), reserved_chars_allowed.c_str(), allow_utf8);
  return Glib::convert_return_gchar_ptr_to_stdstring(cresult);
}

} // namespace Glib