Imported Upstream version 0.60.8
[platform/upstream/aspell.git] / manual / aspell-dev.html / Smart-Pointers.html
1 <!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
2 <html>
3 <!-- This is the developer's manual for Aspell.
4
5 Copyright © 2002, 2003, 2004, 2006 Kevin Atkinson.
6
7 Permission is granted to copy, distribute and/or modify this document
8 under the terms of the GNU Free Documentation License, Version 1.1 or
9 any later version published by the Free Software Foundation; with no
10 Invariant Sections, no Front-Cover Texts and no Back-Cover Texts.  A
11 copy of the license is included in the section entitled "GNU Free
12 Documentation License". -->
13 <!-- Created by GNU Texinfo 5.2, http://www.gnu.org/software/texinfo/ -->
14 <head>
15 <title>Aspell Developer&rsquo;s Manual: Smart Pointers</title>
16
17 <meta name="description" content="Aspell spell checker developer&rsquo;s manual.">
18 <meta name="keywords" content="Aspell Developer&rsquo;s Manual: Smart Pointers">
19 <meta name="resource-type" content="document">
20 <meta name="distribution" content="global">
21 <meta name="Generator" content="makeinfo">
22 <meta http-equiv="Content-Type" content="text/html; charset=utf-8">
23 <link href="index.html#Top" rel="start" title="Top">
24 <link href="index.html#SEC_Contents" rel="contents" title="Table of Contents">
25 <link href="index.html#Top" rel="up" title="Top">
26 <link href="I_002fO.html#I_002fO" rel="next" title="I/O">
27 <link href="Strings.html#Strings" rel="prev" title="Strings">
28 <style type="text/css">
29 <!--
30 a.summary-letter {text-decoration: none}
31 blockquote.smallquotation {font-size: smaller}
32 div.display {margin-left: 3.2em}
33 div.example {margin-left: 3.2em}
34 div.indentedblock {margin-left: 3.2em}
35 div.lisp {margin-left: 3.2em}
36 div.smalldisplay {margin-left: 3.2em}
37 div.smallexample {margin-left: 3.2em}
38 div.smallindentedblock {margin-left: 3.2em; font-size: smaller}
39 div.smalllisp {margin-left: 3.2em}
40 kbd {font-style:oblique}
41 pre.display {font-family: inherit}
42 pre.format {font-family: inherit}
43 pre.menu-comment {font-family: serif}
44 pre.menu-preformatted {font-family: serif}
45 pre.smalldisplay {font-family: inherit; font-size: smaller}
46 pre.smallexample {font-size: smaller}
47 pre.smallformat {font-family: inherit; font-size: smaller}
48 pre.smalllisp {font-size: smaller}
49 span.nocodebreak {white-space:nowrap}
50 span.nolinebreak {white-space:nowrap}
51 span.roman {font-family:serif; font-weight:normal}
52 span.sansserif {font-family:sans-serif; font-weight:normal}
53 ul.no-bullet {list-style: none}
54 table:not([class]), table:not([class]) th, table:not([class]) td {
55     padding: 2px 0.3em 2px 0.3em;
56     border: thin solid #D0D0D0;
57     border-collapse: collapse;
58 }
59
60 -->
61 </style>
62
63 <meta name=viewport content="width=device-width, initial-scale=1">
64 </head>
65
66 <body lang="en" bgcolor="#FFFFFF" text="#000000" link="#0000FF" vlink="#800080" alink="#FF0000">
67 <a name="Smart-Pointers"></a>
68 <div class="header">
69 <p>
70 Next: <a href="I_002fO.html#I_002fO" accesskey="n" rel="next">I/O</a>, Previous: <a href="Strings.html#Strings" accesskey="p" rel="prev">Strings</a>, Up: <a href="index.html#Top" accesskey="u" rel="up">Top</a> &nbsp; [<a href="index.html#SEC_Contents" title="Table of contents" rel="contents">Contents</a>]</p>
71 </div>
72 <hr>
73 <a name="Smart-Pointers-1"></a>
74 <h2 class="chapter">8 Smart Pointers</h2>
75
76 <p>Smart pointers are used extensively in Aspell to
77 simplify memory management tasks and to avoid memory leaks. 
78 </p>
79 <a name="CopyPtr"></a>
80 <h3 class="section">8.1 CopyPtr</h3>
81
82 <p>The <code>CopyPtr</code> class makes a deep copy of an object whenever it is
83 copied.  The <code>CopyPtr</code> class is defined in <samp>copy_ptr.hpp</samp>.
84 This header should be included wherever <code>CopyPtr</code> is used.  The
85 complete definition of the object <code>CopyPtr</code> is pointing to does
86 not need to be defined at this point.  The implementation is defined
87 in <samp>copy_ptr-t.hpp</samp>.  The implementation header file should be
88 included at a point in your code where the class <code>CopyPtr</code> is
89 pointing to is completely defined.
90 </p>
91 <a name="ClonePtr"></a>
92 <h3 class="section">8.2 ClonePtr</h3>
93
94 <p><code>ClonePtr</code> is like copy pointer except the <code>clone()</code> method
95 is used instead of the copy constructor to make copies of an object.
96 If is defined in <samp>clone_ptr.hpp</samp> and implemented in
97 <samp>clone_ptr-t.hpp</samp>.
98 </p>
99 <a name="StackPtr"></a>
100 <h3 class="section">8.3 StackPtr</h3>
101
102 <p>A <code>StackPtr</code> is designed to be used whenever the only pointer to
103 a new object allocated with <code>new</code> is on the stack.  It is
104 similar to the standard C++ <code>auto_ptr</code> but the semantics are a
105 bit different.  It is defined in <samp>stack_ptr.hpp</samp> &mdash; unlike
106 <code>CopyPtr</code> or <code>ClonePtr</code> it is defined and implemented in
107 this header file.
108 </p>
109 <a name="GenericCopyPtr"></a>
110 <h3 class="section">8.4 GenericCopyPtr</h3>
111
112 <p>A generalized version of <code>CopyPtr</code> and <code>ClonePtr</code> which the
113 two are based on.  It is defined in <samp>generic_copy_ptr.hpp</samp> and
114 implemented in <samp>generic_copy_ptr-t.hpp</samp>.
115 </p>
116
117
118
119 </body>
120 </html>