193 lines
9.0 KiB
HTML
193 lines
9.0 KiB
HTML
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "https://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"/>
|
|
<meta http-equiv="X-UA-Compatible" content="IE=9"/>
|
|
<meta name="generator" content="Doxygen 1.8.15"/>
|
|
<meta name="viewport" content="width=device-width, initial-scale=1"/>
|
|
<title>Boost.Nowide: boost::nowide::args Class Reference</title>
|
|
<link href="tabs.css" rel="stylesheet" type="text/css"/>
|
|
<script type="text/javascript" src="jquery.js"></script>
|
|
<script type="text/javascript" src="dynsections.js"></script>
|
|
<link href="doxygen.css" rel="stylesheet" type="text/css" />
|
|
</head>
|
|
<body>
|
|
<div id="top"><!-- do not remove this div, it is closed by doxygen! -->
|
|
<div id="titlearea">
|
|
<table cellspacing="0" cellpadding="0">
|
|
<tbody>
|
|
<tr style="height: 56px;">
|
|
<td id="projectalign" style="padding-left: 0.5em;">
|
|
<div id="projectname">Boost.Nowide
|
|
</div>
|
|
</td>
|
|
</tr>
|
|
</tbody>
|
|
</table>
|
|
</div>
|
|
<!-- end header part -->
|
|
<!-- Generated by Doxygen 1.8.15 -->
|
|
<script type="text/javascript" src="menudata.js"></script>
|
|
<script type="text/javascript" src="menu.js"></script>
|
|
<script type="text/javascript">
|
|
/* @license magnet:?xt=urn:btih:cf05388f2679ee054f2beb29a391d25f4e673ac3&dn=gpl-2.0.txt GPL-v2 */
|
|
$(function() {
|
|
initMenu('',false,false,'search.php','Search');
|
|
});
|
|
/* @license-end */</script>
|
|
<div id="main-nav"></div>
|
|
<div id="nav-path" class="navpath">
|
|
<ul>
|
|
<li class="navelem"><b>boost</b></li><li class="navelem"><a class="el" href="namespaceboost_1_1nowide.html">nowide</a></li><li class="navelem"><a class="el" href="classboost_1_1nowide_1_1args.html">args</a></li> </ul>
|
|
</div>
|
|
</div><!-- top -->
|
|
<div class="header">
|
|
<div class="summary">
|
|
<a href="#nested-classes">Classes</a> |
|
|
<a href="#pub-methods">Public Member Functions</a> |
|
|
<a href="classboost_1_1nowide_1_1args-members.html">List of all members</a> </div>
|
|
<div class="headertitle">
|
|
<div class="title">boost::nowide::args Class Reference</div> </div>
|
|
</div><!--header-->
|
|
<div class="contents">
|
|
|
|
<p><code>args</code> is a class that temporarily replaces standard main() function arguments with their equal, but UTF-8 encoded values under Microsoft Windows for the lifetime of the instance.
|
|
<a href="classboost_1_1nowide_1_1args.html#details">More...</a></p>
|
|
|
|
<p><code>#include <<a class="el" href="args_8hpp_source.html">boost/nowide/args.hpp</a>></code></p>
|
|
<table class="memberdecls">
|
|
<tr class="heading"><td colspan="2"><h2 class="groupheader"><a name="pub-methods"></a>
|
|
Public Member Functions</h2></td></tr>
|
|
<tr class="memitem:a3ff755fe4f03cc192f31121d5ea78d7d"><td class="memItemLeft" align="right" valign="top"> </td><td class="memItemRight" valign="bottom"><a class="el" href="classboost_1_1nowide_1_1args.html#a3ff755fe4f03cc192f31121d5ea78d7d">args</a> (int &argc, char **&argv)</td></tr>
|
|
<tr class="separator:a3ff755fe4f03cc192f31121d5ea78d7d"><td class="memSeparator" colspan="2"> </td></tr>
|
|
<tr class="memitem:ad0aa96990a0b1052c5820d74291e2f2d"><td class="memItemLeft" align="right" valign="top"> </td><td class="memItemRight" valign="bottom"><a class="el" href="classboost_1_1nowide_1_1args.html#ad0aa96990a0b1052c5820d74291e2f2d">args</a> (int &argc, char **&argv, char **&env)</td></tr>
|
|
<tr class="separator:ad0aa96990a0b1052c5820d74291e2f2d"><td class="memSeparator" colspan="2"> </td></tr>
|
|
<tr class="memitem:a78a61e8fe5bb40884f8b3038b98762b2"><td class="memItemLeft" align="right" valign="top"> </td><td class="memItemRight" valign="bottom"><a class="el" href="classboost_1_1nowide_1_1args.html#a78a61e8fe5bb40884f8b3038b98762b2">~args</a> ()</td></tr>
|
|
<tr class="separator:a78a61e8fe5bb40884f8b3038b98762b2"><td class="memSeparator" colspan="2"> </td></tr>
|
|
</table>
|
|
<a name="details" id="details"></a><h2 class="groupheader">Detailed Description</h2>
|
|
<div class="textblock"><p><code>args</code> is a class that temporarily replaces standard main() function arguments with their equal, but UTF-8 encoded values under Microsoft Windows for the lifetime of the instance. </p>
|
|
<p>The class uses <code>GetCommandLineW()</code>, <code>CommandLineToArgvW()</code> and <code>GetEnvironmentStringsW()</code> in order to obtain Unicode-encoded values. It does not relate to actual values of argc, argv and env under Windows.</p>
|
|
<p>It restores the original values in its destructor (usually at the end of the <code>main</code> function).</p>
|
|
<p>If any of the system calls fails, an exception of type std::runtime_error will be thrown and argc, argv, env remain unchanged.</p>
|
|
<dl class="section note"><dt>Note</dt><dd>The class owns the memory of the newly allocated strings. So you need to keep it alive as long as you use the values.</dd></dl>
|
|
<p>Usage: </p><div class="fragment"><div class="line"><span class="keywordtype">int</span> main(<span class="keywordtype">int</span> argc, <span class="keywordtype">char</span>** argv, <span class="keywordtype">char</span>** env) {</div><div class="line"> <a class="code" href="classboost_1_1nowide_1_1args.html">boost::nowide::args</a> _(argc, argv, env); <span class="comment">// Note the _ as a "don't care" name for the instance</span></div><div class="line"> <span class="comment">// Use argv and env as usual, they are now UTF-8 encoded on Windows</span></div><div class="line"> <span class="keywordflow">return</span> 0; <span class="comment">// Memory held by args is released</span></div><div class="line">}</div></div><!-- fragment --> </div><h2 class="groupheader">Constructor & Destructor Documentation</h2>
|
|
<a id="a3ff755fe4f03cc192f31121d5ea78d7d"></a>
|
|
<h2 class="memtitle"><span class="permalink"><a href="#a3ff755fe4f03cc192f31121d5ea78d7d">◆ </a></span>args() <span class="overload">[1/2]</span></h2>
|
|
|
|
<div class="memitem">
|
|
<div class="memproto">
|
|
<table class="mlabels">
|
|
<tr>
|
|
<td class="mlabels-left">
|
|
<table class="memname">
|
|
<tr>
|
|
<td class="memname">boost::nowide::args::args </td>
|
|
<td>(</td>
|
|
<td class="paramtype">int & </td>
|
|
<td class="paramname"><em>argc</em>, </td>
|
|
</tr>
|
|
<tr>
|
|
<td class="paramkey"></td>
|
|
<td></td>
|
|
<td class="paramtype">char **& </td>
|
|
<td class="paramname"><em>argv</em> </td>
|
|
</tr>
|
|
<tr>
|
|
<td></td>
|
|
<td>)</td>
|
|
<td></td><td></td>
|
|
</tr>
|
|
</table>
|
|
</td>
|
|
<td class="mlabels-right">
|
|
<span class="mlabels"><span class="mlabel">inline</span></span> </td>
|
|
</tr>
|
|
</table>
|
|
</div><div class="memdoc">
|
|
<p>Fix command line arguments </p>
|
|
|
|
</div>
|
|
</div>
|
|
<a id="ad0aa96990a0b1052c5820d74291e2f2d"></a>
|
|
<h2 class="memtitle"><span class="permalink"><a href="#ad0aa96990a0b1052c5820d74291e2f2d">◆ </a></span>args() <span class="overload">[2/2]</span></h2>
|
|
|
|
<div class="memitem">
|
|
<div class="memproto">
|
|
<table class="mlabels">
|
|
<tr>
|
|
<td class="mlabels-left">
|
|
<table class="memname">
|
|
<tr>
|
|
<td class="memname">boost::nowide::args::args </td>
|
|
<td>(</td>
|
|
<td class="paramtype">int & </td>
|
|
<td class="paramname"><em>argc</em>, </td>
|
|
</tr>
|
|
<tr>
|
|
<td class="paramkey"></td>
|
|
<td></td>
|
|
<td class="paramtype">char **& </td>
|
|
<td class="paramname"><em>argv</em>, </td>
|
|
</tr>
|
|
<tr>
|
|
<td class="paramkey"></td>
|
|
<td></td>
|
|
<td class="paramtype">char **& </td>
|
|
<td class="paramname"><em>env</em> </td>
|
|
</tr>
|
|
<tr>
|
|
<td></td>
|
|
<td>)</td>
|
|
<td></td><td></td>
|
|
</tr>
|
|
</table>
|
|
</td>
|
|
<td class="mlabels-right">
|
|
<span class="mlabels"><span class="mlabel">inline</span></span> </td>
|
|
</tr>
|
|
</table>
|
|
</div><div class="memdoc">
|
|
<p>Fix command line arguments and environment </p>
|
|
|
|
</div>
|
|
</div>
|
|
<a id="a78a61e8fe5bb40884f8b3038b98762b2"></a>
|
|
<h2 class="memtitle"><span class="permalink"><a href="#a78a61e8fe5bb40884f8b3038b98762b2">◆ </a></span>~args()</h2>
|
|
|
|
<div class="memitem">
|
|
<div class="memproto">
|
|
<table class="mlabels">
|
|
<tr>
|
|
<td class="mlabels-left">
|
|
<table class="memname">
|
|
<tr>
|
|
<td class="memname">boost::nowide::args::~args </td>
|
|
<td>(</td>
|
|
<td class="paramname"></td><td>)</td>
|
|
<td></td>
|
|
</tr>
|
|
</table>
|
|
</td>
|
|
<td class="mlabels-right">
|
|
<span class="mlabels"><span class="mlabel">inline</span></span> </td>
|
|
</tr>
|
|
</table>
|
|
</div><div class="memdoc">
|
|
<p>Restore original argc, argv, env values, if changed </p>
|
|
|
|
</div>
|
|
</div>
|
|
<hr/>The documentation for this class was generated from the following file:<ul>
|
|
<li>boost/nowide/<a class="el" href="args_8hpp_source.html">args.hpp</a></li>
|
|
</ul>
|
|
</div><!-- contents -->
|
|
<!-- start footer part -->
|
|
<hr class="footer"/><address class="footer"><small>
|
|
Generated by  <a href="http://www.doxygen.org/index.html">
|
|
<img class="footer" src="doxygen.png" alt="doxygen"/>
|
|
</a> 1.8.15
|
|
</small></address>
|
|
</body>
|
|
</html>
|