/usr/share/doc/gtkmm-documentation/tutorial/html/sec-refptr-casting.html is in gtkmm-documentation 3.18.0-1.
This file is owned by root:root, with mode 0o644.
The actual contents of the file can be viewed below.
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 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 | <html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<title>Casting</title>
<link rel="stylesheet" type="text/css" href="style.css">
<meta name="generator" content="DocBook XSL Stylesheets V1.78.1">
<link rel="home" href="index.html" title="Programming with gtkmm 3">
<link rel="up" href="chapter-refptr.html" title="Appendix A. The RefPtr smartpointer">
<link rel="prev" href="sec-refptr-dereferencing.html" title="Dereferencing">
<link rel="next" href="sec-refptr-checking-for-null.html" title="Checking for null">
</head>
<body bgcolor="white" text="black" link="#0000FF" vlink="#840084" alink="#0000FF">
<div class="navheader">
<table width="100%" summary="Navigation header">
<tr><th colspan="3" align="center">Casting</th></tr>
<tr>
<td width="20%" align="left">
<a accesskey="p" href="sec-refptr-dereferencing.html"><img src="icons/prev.png" alt="Prev"></a> </td>
<th width="60%" align="center">Appendix A. The RefPtr smartpointer</th>
<td width="20%" align="right"> <a accesskey="n" href="sec-refptr-checking-for-null.html"><img src="icons/next.png" alt="Next"></a>
</td>
</tr>
</table>
<hr>
</div>
<div class="sect1">
<div class="titlepage"><div><div><h2 class="title" style="clear: both">
<a name="sec-refptr-casting"></a>Casting</h2></div></div></div>
<p>
You can cast <code class="classname">RefPtr</code>s to base types, just like normal
pointers.
</p>
<p>
</p>
<pre class="programlisting">
Glib::RefPtr<Gtk::TreeStore> refStore = Gtk::TreeStore::create(columns);
Glib::RefPtr<Gtk::TreeModel> refModel = refStore;
</pre>
<p>
</p>
<p>This means that any method which takes a <span class="type">const
Glib::RefPtr<BaseType></span> argument can also take a
<span class="type">const Glib::RefPtr<DerivedType></span>. The cast is
implicit, just as it would be for a normal pointer.</p>
<p>You can also cast to a derived type, but the syntax is
a little different than with a normal pointer.
</p>
<p>
</p>
<pre class="programlisting">
Glib::RefPtr<Gtk::TreeStore> refStore =
Glib::RefPtr<Gtk::TreeStore>::cast_dynamic(refModel);
Glib::RefPtr<Gtk::TreeStore> refStore2 =
Glib::RefPtr<Gtk::TreeStore>::cast_static(refModel);
</pre>
<p>
</p>
</div>
<div class="navfooter">
<hr>
<table width="100%" summary="Navigation footer">
<tr>
<td width="40%" align="left">
<a accesskey="p" href="sec-refptr-dereferencing.html"><img src="icons/prev.png" alt="Prev"></a> </td>
<td width="20%" align="center"><a accesskey="u" href="chapter-refptr.html"><img src="icons/up.png" alt="Up"></a></td>
<td width="40%" align="right"> <a accesskey="n" href="sec-refptr-checking-for-null.html"><img src="icons/next.png" alt="Next"></a>
</td>
</tr>
<tr>
<td width="40%" align="left" valign="top">Dereferencing </td>
<td width="20%" align="center"><a accesskey="h" href="index.html"><img src="icons/home.png" alt="Home"></a></td>
<td width="40%" align="right" valign="top"> Checking for null</td>
</tr>
</table>
</div>
</body>
</html>
|