Sophie

Sophie

distrib > Mandriva > 2010.0 > x86_64 > by-pkgid > 7f3e5f74d754b480ec33648905c4afae > files > 510

glibmm2.4-doc-2.22.1-1mdv2010.0.x86_64.rpm

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/xhtml;charset=UTF-8"/>
<title>glibmm: Shell-related Utilities</title>
<link href="tabs.css" rel="stylesheet" type="text/css"/>
<link href="doxygen.css" rel="stylesheet" type="text/css"/>
</head>
<body>
<!-- Generated by Doxygen 1.6.1 -->
<div class="navigation" id="top">
  <div class="tabs">
    <ul>
      <li><a href="index.html"><span>Main&#160;Page</span></a></li>
      <li><a href="pages.html"><span>Related&#160;Pages</span></a></li>
      <li><a href="modules.html"><span>Modules</span></a></li>
      <li><a href="namespaces.html"><span>Namespaces</span></a></li>
      <li><a href="annotated.html"><span>Classes</span></a></li>
      <li><a href="examples.html"><span>Examples</span></a></li>
    </ul>
  </div>
</div>
<div class="contents">
<h1>Shell-related Utilities</h1>
<p>Shell-like command line handling. <a href="#_details">More...</a></p>
<table border="0" cellpadding="0" cellspacing="0">
<tr><td colspan="2"><h2>Classes</h2></td></tr>
<tr><td class="memItemLeft" align="right" valign="top">class&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="classGlib_1_1ShellError.html">Glib::ShellError</a></td></tr>
<tr><td class="mdescLeft">&#160;</td><td class="mdescRight"><a class="el" href="classGlib_1_1Exception.html">Exception</a> class for shell utility errors. <a href="classGlib_1_1ShellError.html#_details">More...</a><br/></td></tr>
<tr><td colspan="2"><h2>Functions</h2></td></tr>
<tr><td class="memItemLeft" align="right" valign="top"><a class="el" href="classGlib_1_1ArrayHandle.html">Glib::ArrayHandle</a>&lt; <a class="elRef" href="http://gcc.gnu.org/onlinedocs/libstdc++/latest-doxygen/a00971.html#a32db3d9898c44d3b3a578b560f7758cc">std::string</a> &gt;&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="group__ShellUtils.html#gabc52fcb14cfc7a5ba37ca821cc837818">Glib::shell_parse_argv</a> (const <a class="elRef" href="http://gcc.gnu.org/onlinedocs/libstdc++/latest-doxygen/a00971.html#a32db3d9898c44d3b3a578b560f7758cc">std::string</a>&amp; command_line)</td></tr>
<tr><td class="mdescLeft">&#160;</td><td class="mdescRight">Parses a command line into an argument vector, in much the same way the shell would, but without many of the expansions the shell would perform (variable expansion, globs, operators, filename expansion, etc. are not supported). <a href="#gabc52fcb14cfc7a5ba37ca821cc837818"></a><br/></td></tr>
<tr><td class="memItemLeft" align="right" valign="top"><a class="elRef" href="http://gcc.gnu.org/onlinedocs/libstdc++/latest-doxygen/a00971.html#a32db3d9898c44d3b3a578b560f7758cc">std::string</a>&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="group__ShellUtils.html#ga55ebfb935f2131b2ae40d339568f568c">Glib::shell_quote</a> (const <a class="elRef" href="http://gcc.gnu.org/onlinedocs/libstdc++/latest-doxygen/a00971.html#a32db3d9898c44d3b3a578b560f7758cc">std::string</a>&amp; unquoted_string)</td></tr>
<tr><td class="mdescLeft">&#160;</td><td class="mdescRight">Quotes a string so that the shell (/bin/sh) will interpret the quoted string to mean <em>unquoted_string</em>. <a href="#ga55ebfb935f2131b2ae40d339568f568c"></a><br/></td></tr>
<tr><td class="memItemLeft" align="right" valign="top"><a class="elRef" href="http://gcc.gnu.org/onlinedocs/libstdc++/latest-doxygen/a00971.html#a32db3d9898c44d3b3a578b560f7758cc">std::string</a>&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="group__ShellUtils.html#ga449dc37c6ea7e7563740df86e31c263c">Glib::shell_unquote</a> (const <a class="elRef" href="http://gcc.gnu.org/onlinedocs/libstdc++/latest-doxygen/a00971.html#a32db3d9898c44d3b3a578b560f7758cc">std::string</a>&amp; quoted_string)</td></tr>
<tr><td class="mdescLeft">&#160;</td><td class="mdescRight">Unquotes a string as the shell (/bin/sh) would. <a href="#ga449dc37c6ea7e7563740df86e31c263c"></a><br/></td></tr>
</table>
<hr/><a name="_details"></a><h2>Detailed Description</h2>
<p>Shell-like command line handling. </p>
<hr/><h2>Function Documentation</h2>
<a class="anchor" id="gabc52fcb14cfc7a5ba37ca821cc837818"></a><!-- doxytag: member="Glib::shell_parse_argv" ref="gabc52fcb14cfc7a5ba37ca821cc837818" args="(const std::string &amp;command_line)" -->
<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname"><a class="el" href="classGlib_1_1ArrayHandle.html">Glib::ArrayHandle</a>&lt;<a class="elRef" href="http://gcc.gnu.org/onlinedocs/libstdc++/latest-doxygen/a00971.html#a32db3d9898c44d3b3a578b560f7758cc">std::string</a>&gt; Glib::shell_parse_argv </td>
          <td>(</td>
          <td class="paramtype">const <a class="elRef" href="http://gcc.gnu.org/onlinedocs/libstdc++/latest-doxygen/a00971.html#a32db3d9898c44d3b3a578b560f7758cc">std::string</a> &amp;&#160;</td>
          <td class="paramname"> <em>command_line</em></td>
          <td>&#160;)&#160;</td>
          <td></td>
        </tr>
      </table>
</div>
<div class="memdoc">

<p>Parses a command line into an argument vector, in much the same way the shell would, but without many of the expansions the shell would perform (variable expansion, globs, operators, filename expansion, etc. are not supported). </p>
<p>The results are defined to be the same as those you would get from a UNIX98 /bin/sh, as long as the input contains none of the unsupported shell expansions. If the input does contain such expansions, they are passed through literally. </p>
<dl><dt><b>Parameters:</b></dt><dd>
  <table border="0" cellspacing="2" cellpadding="0">
    <tr><td valign="top"></td><td valign="top"><em>command_line</em>&#160;</td><td>Command line to parse. </td></tr>
  </table>
  </dd>
</dl>
<dl class="return"><dt><b>Returns:</b></dt><dd>Array of args (The generic <a class="el" href="classGlib_1_1ArrayHandle.html" title="If a method takes this as an argument, or has this as a return type, then you can...">ArrayHandle</a> will be implicitly converted to any STL compatible container type). </dd></dl>
<dl><dt><b>Exceptions:</b></dt><dd>
  <table border="0" cellspacing="2" cellpadding="0">
    <tr><td valign="top"></td><td valign="top"><em><a class="el" href="classGlib_1_1ShellError.html" title="Exception class for shell utility errors.">Glib::ShellError</a></em>&#160;</td><td></td></tr>
  </table>
  </dd>
</dl>

</div>
</div>
<a class="anchor" id="ga55ebfb935f2131b2ae40d339568f568c"></a><!-- doxytag: member="Glib::shell_quote" ref="ga55ebfb935f2131b2ae40d339568f568c" args="(const std::string &amp;unquoted_string)" -->
<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname"><a class="elRef" href="http://gcc.gnu.org/onlinedocs/libstdc++/latest-doxygen/a00971.html#a32db3d9898c44d3b3a578b560f7758cc">std::string</a> Glib::shell_quote </td>
          <td>(</td>
          <td class="paramtype">const <a class="elRef" href="http://gcc.gnu.org/onlinedocs/libstdc++/latest-doxygen/a00971.html#a32db3d9898c44d3b3a578b560f7758cc">std::string</a> &amp;&#160;</td>
          <td class="paramname"> <em>unquoted_string</em></td>
          <td>&#160;)&#160;</td>
          <td></td>
        </tr>
      </table>
</div>
<div class="memdoc">

<p>Quotes a string so that the shell (/bin/sh) will interpret the quoted string to mean <em>unquoted_string</em>. </p>
<p>If you pass a filename to the shell, for example, you should first quote it with this function. The quoting style used is undefined (single or double quotes may be used). </p>
<dl><dt><b>Parameters:</b></dt><dd>
  <table border="0" cellspacing="2" cellpadding="0">
    <tr><td valign="top"></td><td valign="top"><em>unquoted_string</em>&#160;</td><td>A literal string. </td></tr>
  </table>
  </dd>
</dl>
<dl class="return"><dt><b>Returns:</b></dt><dd>A quoted string. </dd></dl>

</div>
</div>
<a class="anchor" id="ga449dc37c6ea7e7563740df86e31c263c"></a><!-- doxytag: member="Glib::shell_unquote" ref="ga449dc37c6ea7e7563740df86e31c263c" args="(const std::string &amp;quoted_string)" -->
<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname"><a class="elRef" href="http://gcc.gnu.org/onlinedocs/libstdc++/latest-doxygen/a00971.html#a32db3d9898c44d3b3a578b560f7758cc">std::string</a> Glib::shell_unquote </td>
          <td>(</td>
          <td class="paramtype">const <a class="elRef" href="http://gcc.gnu.org/onlinedocs/libstdc++/latest-doxygen/a00971.html#a32db3d9898c44d3b3a578b560f7758cc">std::string</a> &amp;&#160;</td>
          <td class="paramname"> <em>quoted_string</em></td>
          <td>&#160;)&#160;</td>
          <td></td>
        </tr>
      </table>
</div>
<div class="memdoc">

<p>Unquotes a string as the shell (/bin/sh) would. </p>
<p>Only handles quotes; if a string contains file globs, arithmetic operators, variables, backticks, redirections, or other special-to-the-shell features, the result will be different from the result a real shell would produce (the variables, backticks, etc. will be passed through literally instead of being expanded). This function is guaranteed to succeed if applied to the result of <a class="el" href="group__ShellUtils.html#ga55ebfb935f2131b2ae40d339568f568c" title="Quotes a string so that the shell (/bin/sh) will interpret the quoted string to mean...">shell_quote()</a>. If it fails, it throws a <a class="el" href="classGlib_1_1ShellError.html" title="Exception class for shell utility errors.">Glib::ShellError</a> exception. The <em>quoted_string</em> need not actually contain quoted or escaped text; <a class="el" href="group__ShellUtils.html#ga449dc37c6ea7e7563740df86e31c263c" title="Unquotes a string as the shell (/bin/sh) would.">shell_unquote()</a> simply goes through the string and unquotes/unescapes anything that the shell would. Both single and double quotes are handled, as are escapes including escaped newlines.</p>
<p>Shell quoting rules are a bit strange. Single quotes preserve the literal string exactly. Escape sequences are not allowed; not even <code>\'</code> -- if you want a <code>'</code> in the quoted text, you have to do something like <code>'foo'\''bar'</code>. Double quotes allow <code>$</code>, <code>`</code>, <code></code>, <code>\</code>, and newline to be escaped with backslash. Otherwise double quotes preserve things literally.</p>
<dl><dt><b>Parameters:</b></dt><dd>
  <table border="0" cellspacing="2" cellpadding="0">
    <tr><td valign="top"></td><td valign="top"><em>quoted_string</em>&#160;</td><td>Shell-quoted string. </td></tr>
  </table>
  </dd>
</dl>
<dl class="return"><dt><b>Returns:</b></dt><dd>An unquoted string. </dd></dl>
<dl><dt><b>Exceptions:</b></dt><dd>
  <table border="0" cellspacing="2" cellpadding="0">
    <tr><td valign="top"></td><td valign="top"><em><a class="el" href="classGlib_1_1ShellError.html" title="Exception class for shell utility errors.">Glib::ShellError</a></em>&#160;</td><td></td></tr>
  </table>
  </dd>
</dl>

</div>
</div>
</div>
<hr size="1"/><address style="text-align: right;"><small>Generated on Mon Sep 21 11:07:19 2009 for glibmm by&#160;
<a href="http://www.doxygen.org/index.html">
<img class="footer" src="doxygen.png" alt="doxygen"/></a> 1.6.1 </small></address>
</body>
</html>