1 // Generated by gmmproc 2.64.2 -- DO NOT MODIFY!
2
3
4 #include <glibmm.h>
5
6 #include <glibmm/shell.h>
7 #include <glibmm/private/shell_p.h>
8
9
10 /* Copyright (C) 2002 The gtkmm Development Team
11 *
12 * This library is free software; you can redistribute it and/or
13 * modify it under the terms of the GNU Lesser General Public
14 * License as published by the Free Software Foundation; either
15 * version 2.1 of the License, or (at your option) any later version.
16 *
17 * This library is distributed in the hope that it will be useful,
18 * but WITHOUT ANY WARRANTY; without even the implied warranty of
19 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
20 * Lesser General Public License for more details.
21 *
22 * You should have received a copy of the GNU Lesser General Public
23 * License along with this library. If not, see <http://www.gnu.org/licenses/>.
24 */
25
26 #include <glibmm/utility.h>
27
28 namespace Glib
29 {
30
31 /**** shell utility functions **********************************************/
32
33 Glib::ArrayHandle<std::string>
shell_parse_argv(const std::string & command_line)34 shell_parse_argv(const std::string& command_line)
35 {
36 char** argv = nullptr;
37 int argc = 0;
38 GError* error = nullptr;
39
40 g_shell_parse_argv(command_line.c_str(), &argc, &argv, &error);
41
42 if (error)
43 Glib::Error::throw_exception(error);
44
45 return Glib::ArrayHandle<std::string>(argv, argc, Glib::OWNERSHIP_DEEP);
46 }
47
48 std::string
shell_quote(const std::string & unquoted_string)49 shell_quote(const std::string& unquoted_string)
50 {
51 const auto buf = make_unique_ptr_gfree(g_shell_quote(unquoted_string.c_str()));
52 return std::string(buf.get());
53 }
54
55 std::string
shell_unquote(const std::string & quoted_string)56 shell_unquote(const std::string& quoted_string)
57 {
58 GError* error = nullptr;
59 char* const buf = g_shell_unquote(quoted_string.c_str(), &error);
60
61 if (error)
62 Glib::Error::throw_exception(error);
63
64 return std::string(make_unique_ptr_gfree(buf).get());
65 }
66
67 } // namespace Glib
68
69 namespace
70 {
71 } // anonymous namespace
72
73
ShellError(Glib::ShellError::Code error_code,const Glib::ustring & error_message)74 Glib::ShellError::ShellError(Glib::ShellError::Code error_code, const Glib::ustring& error_message)
75 :
76 Glib::Error (G_SHELL_ERROR, error_code, error_message)
77 {}
78
ShellError(GError * gobject)79 Glib::ShellError::ShellError(GError* gobject)
80 :
81 Glib::Error (gobject)
82 {}
83
code() const84 Glib::ShellError::Code Glib::ShellError::code() const
85 {
86 return static_cast<Code>(Glib::Error::code());
87 }
88
throw_func(GError * gobject)89 void Glib::ShellError::throw_func(GError* gobject)
90 {
91 throw Glib::ShellError(gobject);
92 }
93
94
95