blob: d46bf179d74334e9da669cd2ff194373dfbfbaf7 [file] [log] [blame]
<!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"/>
<meta http-equiv="X-UA-Compatible" content="IE=9"/>
<title>Boost.Locale: boost/locale/hold_ptr.hpp Source File</title>
<link href="tabs.css" rel="stylesheet" type="text/css"/>
<link href="doxygen.css" rel="stylesheet" type="text/css" />
<link href="navtree.css" rel="stylesheet" type="text/css"/>
<script type="text/javascript" src="jquery.js"></script>
<script type="text/javascript" src="resize.js"></script>
<script type="text/javascript" src="navtree.js"></script>
<script type="text/javascript">
$(document).ready(initResizable);
</script>
</head>
<body>
<div id="top"><!-- do not remove this div! -->
<div id="titlearea">
<table cellspacing="0" cellpadding="0">
<tbody>
<tr style="height: 56px;">
<td id="projectlogo"><img alt="Logo" src="boost-small.png"/></td>
<td style="padding-left: 0.5em;">
<div id="projectname">Boost.Locale
</div>
</td>
</tr>
</tbody>
</table>
</div>
<!-- Generated by Doxygen 1.7.6.1 -->
<div id="navrow1" class="tabs">
<ul class="tablist">
<li><a href="index.html"><span>Main&#160;Page</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 class="current"><a href="files.html"><span>Files</span></a></li>
<li><a href="examples.html"><span>Examples</span></a></li>
</ul>
</div>
<div id="navrow2" class="tabs2">
<ul class="tablist">
<li><a href="files.html"><span>File&#160;List</span></a></li>
</ul>
</div>
</div>
<div id="side-nav" class="ui-resizable side-nav-resizable">
<div id="nav-tree">
<div id="nav-tree-contents">
</div>
</div>
<div id="splitbar" style="-moz-user-select:none;"
class="ui-resizable-handle">
</div>
</div>
<script type="text/javascript">
initNavTree('hold__ptr_8hpp.html','');
</script>
<div id="doc-content">
<div class="header">
<div class="headertitle">
<div class="title">boost/locale/hold_ptr.hpp</div> </div>
</div><!--header-->
<div class="contents">
<div class="fragment"><pre class="fragment"><a name="l00001"></a>00001 <span class="comment">//</span>
<a name="l00002"></a>00002 <span class="comment">// Copyright (c) 2010 Artyom Beilis (Tonkikh)</span>
<a name="l00003"></a>00003 <span class="comment">//</span>
<a name="l00004"></a>00004 <span class="comment">// Distributed under the Boost Software License, Version 1.0. (See</span>
<a name="l00005"></a>00005 <span class="comment">// accompanying file LICENSE_1_0.txt or copy at</span>
<a name="l00006"></a>00006 <span class="comment">// http://www.boost.org/LICENSE_1_0.txt)</span>
<a name="l00007"></a>00007 <span class="comment">//</span>
<a name="l00008"></a>00008 <span class="preprocessor">#ifndef BOOST_LOCALE_HOLD_PTR_H</span>
<a name="l00009"></a>00009 <span class="preprocessor"></span><span class="preprocessor">#define BOOST_LOCALE_HOLD_PTR_H</span>
<a name="l00010"></a>00010 <span class="preprocessor"></span>
<a name="l00011"></a>00011 <span class="keyword">namespace </span>boost {
<a name="l00012"></a>00012 <span class="keyword">namespace </span>locale {
<a name="l00017"></a>00017 <span class="keyword">template</span>&lt;<span class="keyword">typename</span> T&gt;
<a name="l00018"></a><a class="code" href="classboost_1_1locale_1_1hold__ptr.html">00018</a> <span class="keyword">class </span><a class="code" href="classboost_1_1locale_1_1hold__ptr.html" title="a smart pointer similar to std::auto_ptr but it is non-copyable and the underlying object has the sam...">hold_ptr</a> {
<a name="l00019"></a>00019 <a class="code" href="classboost_1_1locale_1_1hold__ptr.html#a681ee3d579435f9f2f171b830c402072">hold_ptr</a>(<a class="code" href="classboost_1_1locale_1_1hold__ptr.html" title="a smart pointer similar to std::auto_ptr but it is non-copyable and the underlying object has the sam...">hold_ptr</a> <span class="keyword">const</span> &amp;other); <span class="comment">// non copyable </span>
<a name="l00020"></a>00020 <a class="code" href="classboost_1_1locale_1_1hold__ptr.html" title="a smart pointer similar to std::auto_ptr but it is non-copyable and the underlying object has the sam...">hold_ptr</a> <span class="keyword">const</span> &amp;operator=(<a class="code" href="classboost_1_1locale_1_1hold__ptr.html" title="a smart pointer similar to std::auto_ptr but it is non-copyable and the underlying object has the sam...">hold_ptr</a> <span class="keyword">const</span> &amp;other); <span class="comment">// non assignable</span>
<a name="l00021"></a>00021 <span class="keyword">public</span>:
<a name="l00025"></a><a class="code" href="classboost_1_1locale_1_1hold__ptr.html#a681ee3d579435f9f2f171b830c402072">00025</a> <a class="code" href="classboost_1_1locale_1_1hold__ptr.html#a681ee3d579435f9f2f171b830c402072">hold_ptr</a>() : ptr_(0) {}
<a name="l00029"></a><a class="code" href="classboost_1_1locale_1_1hold__ptr.html#a0007514dc0410ccb16adf01c56874f52">00029</a> <span class="keyword">explicit</span> <a class="code" href="classboost_1_1locale_1_1hold__ptr.html#a0007514dc0410ccb16adf01c56874f52">hold_ptr</a>(T *v) : ptr_(v) {}
<a name="l00030"></a>00030
<a name="l00034"></a><a class="code" href="classboost_1_1locale_1_1hold__ptr.html#aace934e7a8b3f1880d1a06fa85795a48">00034</a> <a class="code" href="classboost_1_1locale_1_1hold__ptr.html#aace934e7a8b3f1880d1a06fa85795a48">~hold_ptr</a>()
<a name="l00035"></a>00035 {
<a name="l00036"></a>00036 <span class="keyword">delete</span> ptr_;
<a name="l00037"></a>00037 }
<a name="l00038"></a>00038
<a name="l00042"></a><a class="code" href="classboost_1_1locale_1_1hold__ptr.html#a907a9385c1a15dab07aade7466620bf6">00042</a> T <span class="keyword">const</span> *<span class="keyword">get</span>() <span class="keyword">const</span> { <span class="keywordflow">return</span> ptr_; }
<a name="l00046"></a><a class="code" href="classboost_1_1locale_1_1hold__ptr.html#a30dbc88eb9fde35198774f3ace282712">00046</a> T *<span class="keyword">get</span>() { <span class="keywordflow">return</span> ptr_; }
<a name="l00047"></a>00047
<a name="l00051"></a><a class="code" href="classboost_1_1locale_1_1hold__ptr.html#a2c8a19e35ff3c57100b24371854f31b7">00051</a> T <span class="keyword">const</span> &amp;<a class="code" href="classboost_1_1locale_1_1hold__ptr.html#a2c8a19e35ff3c57100b24371854f31b7">operator *</a>()<span class="keyword"> const </span>{ <span class="keywordflow">return</span> *ptr_; }
<a name="l00055"></a><a class="code" href="classboost_1_1locale_1_1hold__ptr.html#af99f3719b755b787b022253aa6f8d1c0">00055</a> T &amp;<a class="code" href="classboost_1_1locale_1_1hold__ptr.html#a2c8a19e35ff3c57100b24371854f31b7">operator *</a>() { <span class="keywordflow">return</span> *ptr_; }
<a name="l00059"></a><a class="code" href="classboost_1_1locale_1_1hold__ptr.html#a7ae6b54ed5471dd9560904c7ff8a7971">00059</a> T <span class="keyword">const</span> *<a class="code" href="classboost_1_1locale_1_1hold__ptr.html#a7ae6b54ed5471dd9560904c7ff8a7971">operator-&gt;</a>()<span class="keyword"> const </span>{ <span class="keywordflow">return</span> ptr_; }
<a name="l00063"></a><a class="code" href="classboost_1_1locale_1_1hold__ptr.html#a474f2619452b63408e1e761f414328f4">00063</a> T *<a class="code" href="classboost_1_1locale_1_1hold__ptr.html#a474f2619452b63408e1e761f414328f4">operator-&gt;</a>() { <span class="keywordflow">return</span> ptr_; }
<a name="l00064"></a>00064
<a name="l00068"></a><a class="code" href="classboost_1_1locale_1_1hold__ptr.html#a2d7b2957c037589b65b2cdd4f61ebe03">00068</a> T *<a class="code" href="classboost_1_1locale_1_1hold__ptr.html#a2d7b2957c037589b65b2cdd4f61ebe03">release</a>() { T *tmp=ptr_; ptr_=0; <span class="keywordflow">return</span> tmp; }
<a name="l00069"></a>00069
<a name="l00073"></a><a class="code" href="classboost_1_1locale_1_1hold__ptr.html#acb84b86bb220d663ffe13e5be9cfd72e">00073</a> <span class="keywordtype">void</span> <a class="code" href="classboost_1_1locale_1_1hold__ptr.html#acb84b86bb220d663ffe13e5be9cfd72e">reset</a>(T *p=0)
<a name="l00074"></a>00074 {
<a name="l00075"></a>00075 <span class="keywordflow">if</span>(ptr_) <span class="keyword">delete</span> ptr_;
<a name="l00076"></a>00076 ptr_=p;
<a name="l00077"></a>00077 }
<a name="l00079"></a><a class="code" href="classboost_1_1locale_1_1hold__ptr.html#a3e2640b5df80f86aeb68a6ee78dfd6f9">00079</a> <span class="keywordtype">void</span> <a class="code" href="classboost_1_1locale_1_1hold__ptr.html#a3e2640b5df80f86aeb68a6ee78dfd6f9" title="Swap two pointers.">swap</a>(<a class="code" href="classboost_1_1locale_1_1hold__ptr.html" title="a smart pointer similar to std::auto_ptr but it is non-copyable and the underlying object has the sam...">hold_ptr</a> &amp;other)
<a name="l00080"></a>00080 {
<a name="l00081"></a>00081 T *tmp=other.ptr_;
<a name="l00082"></a>00082 other.ptr_=ptr_;
<a name="l00083"></a>00083 ptr_=tmp;
<a name="l00084"></a>00084 }
<a name="l00085"></a>00085 <span class="keyword">private</span>:
<a name="l00086"></a>00086 T *ptr_;
<a name="l00087"></a>00087 };
<a name="l00088"></a>00088
<a name="l00089"></a>00089 } <span class="comment">// locale</span>
<a name="l00090"></a>00090 } <span class="comment">// boost</span>
<a name="l00091"></a>00091
<a name="l00092"></a>00092 <span class="preprocessor">#endif</span>
<a name="l00093"></a>00093 <span class="preprocessor"></span><span class="comment">// vim: tabstop=4 expandtab shiftwidth=4 softtabstop=4</span>
</pre></div></div><!-- contents -->
</div>
<div id="nav-path" class="navpath">
<ul>
<li class="navelem"><b>hold_ptr.hpp</b> </li>
<li class="footer">
&copy; Copyright 2009-2012 Artyom Beilis, Distributed under the <a href="http://www.boost.org/LICENSE_1_0.txt">Boost Software License</a>, Version 1.0.
</li>
</ul>
</div>
</body>
</html>