5
|
1 |
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 3.2 Final//EN">
|
|
2 |
<html lang="en">
|
|
3 |
|
|
4 |
<head>
|
|
5 |
<meta http-equiv="Content-Language" content="en-us">
|
|
6 |
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
|
|
7 |
<title>C/C++ search</title>
|
|
8 |
<link rel="stylesheet" type="text/css" href="../help.css">
|
|
9 |
</head>
|
|
10 |
|
|
11 |
<body>
|
|
12 |
|
|
13 |
<h1>C/C++ search</h1>
|
|
14 |
|
|
15 |
<p>You can conduct a fully or partially qualified name search. Further
|
|
16 |
qualifying a search increases the accuracy and relevance of search results. The
|
|
17 |
sections below provide guidance on how to control the scope of your search
|
|
18 |
through the use of search delimiters, correct syntax, and wildcards.</p>
|
|
19 |
|
|
20 |
<p>You can search for:<br>
|
|
21 |
<ul>
|
|
22 |
<li>language constructs within:
|
|
23 |
<ul>
|
|
24 |
<li>projects in your workspace</li>
|
|
25 |
<li>selected resources from various views</li>
|
|
26 |
<li>working sets</li>
|
|
27 |
</ul></li>
|
|
28 |
<li>a working set for references to particular elements</li>
|
|
29 |
<li>declarations of particular elements</li>
|
|
30 |
<li>definitions of particular elements</li>
|
|
31 |
<li>references of particular elements</li>
|
|
32 |
</ul>
|
|
33 |
</p>
|
|
34 |
|
|
35 |
For information on working sets, see <b>Workbench User Guide > Concepts > Workbench > Working sets</b><br>
|
|
36 |
|
|
37 |
|
|
38 |
<h2>What you can search for</h2>
|
|
39 |
<p>The table below lists the element types that you can search for and special
|
|
40 |
considerations to note when searching for a given element type. You can search
|
|
41 |
for some or all of the element types matching a search string that you
|
|
42 |
specify. If you choose to search for matching elements, all types, macros, and typdefs are included in the search.</p>
|
|
43 |
<table border="1" cellpadding="0" cellspacing="0" style="border-collapse: collapse" bordercolor="#111111" width="60%">
|
|
44 |
<tr>
|
|
45 |
<td width="19%"><b>Element</b></td>
|
|
46 |
<td width="81%"><b>Note</b></td>
|
|
47 |
</tr>
|
|
48 |
<tr>
|
|
49 |
<td width="19%"> Class/Struct</td>
|
|
50 |
<td width="81%">Searches for classes and structs.<p>You can further qualify
|
|
51 |
the search by specifying "class" or "struct" in front of the name
|
|
52 |
that you are
|
|
53 |
searching for. Specifying "class" or "struct" also allows you to
|
|
54 |
search for anonymous classes and structures.</td>
|
|
55 |
</tr>
|
|
56 |
<tr>
|
|
57 |
<td width="19%"> Function</td>
|
|
58 |
<td width="81%">Searches for global functions or functions in a namespace
|
|
59 |
(functions that are not members of a class, struct, or union).<p>You can
|
|
60 |
specify parameters to further qualify your search. When specifying a
|
|
61 |
parameter list, everything between the parentheses should be valid C/C++
|
|
62 |
syntax.</p>
|
|
63 |
<p>Do not specify the return type of the function.</td>
|
|
64 |
</tr>
|
|
65 |
<tr>
|
|
66 |
<td width="19%"> Variable</td>
|
|
67 |
<td width="81%">Searches for variables that are not members of a class,
|
|
68 |
struct, or union.</td>
|
|
69 |
</tr>
|
|
70 |
<tr>
|
|
71 |
<td width="19%"> Union</td>
|
|
72 |
<td width="81%">Searches for unions.<p>Anonymous unions can be searched for by
|
|
73 |
specifying "union" as the search pattern.</td>
|
|
74 |
</tr>
|
|
75 |
<tr>
|
|
76 |
<td width="19%"> Method</td>
|
|
77 |
<td width="81%">Searches for methods that are members of a class, struct, or
|
|
78 |
union.<p>Searching for methods also finds constructors and destructors. See
|
|
79 |
above note for functions.</td>
|
|
80 |
</tr>
|
|
81 |
<tr>
|
|
82 |
<td width="19%"> Field </td>
|
|
83 |
<td width="81%">Searches for fields that are members of a class, struct, or
|
|
84 |
union.
|
|
85 |
</tr>
|
|
86 |
<tr>
|
|
87 |
<td width="19%"> Enumeration</td>
|
|
88 |
<td width="81%">Searches for enumerations.</td>
|
|
89 |
</tr>
|
|
90 |
<tr>
|
|
91 |
<td width="19%"> Enumerator</td>
|
|
92 |
<td width="81%">Searches for enumerators.</td>
|
|
93 |
</tr>
|
|
94 |
<tr>
|
|
95 |
<td width="19%"> Namespace</td>
|
|
96 |
<td width="81%">Searches for namespaces.</td>
|
|
97 |
</tr>
|
|
98 |
</table>
|
|
99 |
|
|
100 |
<h2>How you can limit your search</h2>
|
|
101 |
|
|
102 |
<p>You can limit your search to one or all of the following:</p>
|
|
103 |
|
|
104 |
<ul>
|
|
105 |
<li>Declarations</li>
|
|
106 |
<li>References</li>
|
|
107 |
<li>Definitions (for functions, methods, variables and fields)</li>
|
|
108 |
</ul>
|
|
109 |
|
|
110 |
<p>You can control the scope of the search by specifying which of the following
|
|
111 |
is to be searched:</p>
|
|
112 |
<ul>
|
|
113 |
<li>Workspace</li>
|
|
114 |
<li>Working Set</li>
|
|
115 |
<li>Selected Resources</li>
|
|
116 |
</ul>
|
|
117 |
|
|
118 |
<h2>Wildcard characters</h2>
|
|
119 |
<p>You can use wildcard characters to further refine your search.</p>
|
|
120 |
<table border="1" cellpadding="0" cellspacing="0" style="border-collapse: collapse" bordercolor="#111111" width="60%">
|
|
121 |
<tr>
|
|
122 |
<td width="49%"><b>Use this wildcard character</b></td>
|
|
123 |
<td width="51%"><b>To search for this</b></td>
|
|
124 |
</tr>
|
|
125 |
<tr>
|
|
126 |
<td width="49%"> <samp>*</samp></td>
|
|
127 |
<td width="51%">Any string<p><b>Tip:<br>
|
|
128 |
</b> Use the character <samp>*</samp> to search for
|
|
129 |
operators that begin with *. See syntax examples in the table below.</td>
|
|
130 |
</tr>
|
|
131 |
<tr>
|
|
132 |
<td width="49%"> <samp>?</samp></td>
|
|
133 |
<td width="51%">A single character</td>
|
|
134 |
</tr>
|
|
135 |
<tr>
|
|
136 |
<td width="49%"> <samp>::</samp></td>
|
|
137 |
<td width="51%">Nested elements</td>
|
|
138 |
</tr>
|
|
139 |
</table>
|
|
140 |
<p><b>Tip: </b>Do not use wild cards between the brackets of a function or
|
|
141 |
method pattern. For example, the search
|
|
142 |
string <samp>f( * )</samp> is an invalid search that results in a search for any function <samp>f</samp>
|
|
143 |
because
|
|
144 |
the asterisk is interpreted as a pointer rather than a wild card.</p>
|
|
145 |
<h2>Syntax examples</h2>
|
|
146 |
<p>The table below provides syntax examples and an explanation for each example
|
|
147 |
to help you conduct an effective search.</p>
|
|
148 |
<table border="1" cellpadding="0" cellspacing="0" style="border-collapse: collapse" bordercolor="#111111" width="60%" height="400">
|
|
149 |
<tr>
|
|
150 |
<td width="64%" height="16"><b>Syntax</b></td>
|
|
151 |
<td width="36%" height="16"><b>Searches for this</b></td>
|
|
152 |
</tr>
|
|
153 |
<tr>
|
|
154 |
<td width="64%" height="17"> <samp>::*::*::A</samp></td>
|
|
155 |
<td width="36%" height="17">A nested element two levels deep</td>
|
|
156 |
</tr>
|
|
157 |
<tr>
|
|
158 |
<td width="64%" height="32"> <samp>::*::*::A?</samp></td>
|
|
159 |
<td width="36%" height="32">Any two-letter name that begins with A and is two levels
|
|
160 |
deep</td>
|
|
161 |
</tr>
|
|
162 |
<tr>
|
|
163 |
<td width="64%" height="32"> <samp>::A</samp> </td>
|
|
164 |
<td width="36%" height="32">Searches for A not nested in anything</td>
|
|
165 |
</tr>
|
|
166 |
<tr>
|
|
167 |
<td width="64%" height="17"> <samp>*()</samp></td>
|
|
168 |
<td width="36%" height="17">Any function taking no parameters</td>
|
|
169 |
</tr>
|
|
170 |
<tr>
|
|
171 |
<td width="64%" height="32"> <samp>*( A * )</samp> </td>
|
|
172 |
<td width="36%" height="32">Any function taking 1 parameter that is a pointer to type
|
|
173 |
A</td>
|
|
174 |
</tr>
|
|
175 |
<tr>
|
|
176 |
<td width="64%" height="33"> <samp>f( int * )</samp></td>
|
|
177 |
<td width="36%" height="33">Will search for function f taking 1 parameter that is an
|
|
178 |
int *</td>
|
|
179 |
</tr>
|
|
180 |
<tr>
|
|
181 |
<td width="64%" height="64"> <samp>f( const char [
|
|
182 |
], A & )</samp></td>
|
|
183 |
<td width="36%" height="64">Will search for a function f, taking 2 parameters; one is a
|
|
184 |
const char array, the other is a reference to type A</td>
|
|
185 |
</tr>
|
|
186 |
<tr>
|
|
187 |
<td width="64%" height="32"> <samp>operator \*</samp></td>
|
|
188 |
<td width="36%" height="32">Finds only operator *</td>
|
|
189 |
</tr>
|
|
190 |
<tr>
|
|
191 |
<td width="64%" height="32"> <samp>operator \*=</samp></td>
|
|
192 |
<td width="36%" height="32">Finds only operator *=</td>
|
|
193 |
</tr>
|
|
194 |
<tr>
|
|
195 |
<td width="64%" height="16"> <samp>operator *</samp></td>
|
|
196 |
<td width="36%" height="16">Finds all operators</td>
|
|
197 |
</tr>
|
|
198 |
<tr>
|
|
199 |
<td width="64%" height="15"> <samp>class</samp></td>
|
|
200 |
<td width="36%" height="15">Searches for anonymous classes</td>
|
|
201 |
</tr>
|
|
202 |
<tr>
|
|
203 |
<td width="64%" height="16"> <samp>struct</samp></td>
|
|
204 |
<td width="36%" height="16">Searches for anonymous structs</td>
|
|
205 |
</tr>
|
|
206 |
<tr>
|
|
207 |
<td width="64%" height="16"> <samp>union</samp></td>
|
|
208 |
<td width="36%" height="16">Searches for anonymous unions</td>
|
|
209 |
</tr>
|
|
210 |
</table>
|
|
211 |
<h2>Search results</h2>
|
|
212 |
<p>Search results are displayed in the Search view. You can sort your search by Name, Parent Name and Path. You can also repeat
|
|
213 |
your last search.</p>
|
|
214 |
|
|
215 |
<h2>Search Concepts</h2>
|
|
216 |
|
|
217 |
<h3>Declarations</h3>
|
|
218 |
<p>According to the ANSI C++ Spec, a declaration is a statement that “introduces a name into a translation unit or re-declares a name that has been previously introduced by a previous declaration.</p>
|
|
219 |
<p>All C/C++ search elements can be searched for declarations.</p>
|
|
220 |
|
|
221 |
<h3>Definitions</h3>
|
|
222 |
<p>Most declarations are also definitions; in other words, they also define the entity for they declare the name for. However there are some elements that can have separate definitions from their declarations.</p>
|
|
223 |
<p>For C/C++ search the following elements can be searched for definitions:
|
|
224 |
<ul>
|
|
225 |
<li>Functions/Methods – the definition is where the code implementation resides</li>
|
|
226 |
<li>Variable:
|
|
227 |
<ol>
|
|
228 |
<li>Extern – the definition is where the variable is initialized</li>
|
|
229 |
<li>Non extern - the definition of a variable is where it is declared </li>
|
|
230 |
</ol></li>
|
|
231 |
<li>Field:
|
|
232 |
<ol>
|
|
233 |
<li>Static fields - the definition of a static field is where it gets initialized</li>
|
|
234 |
<li>Non static fields - the definition corresponds to the fields declaration</li>
|
|
235 |
</ol></li>
|
|
236 |
<li>Namespace – the definition of a namespace is the same as its declaration</li>
|
|
237 |
</ul></p>
|
|
238 |
|
|
239 |
<h3>References</h3>
|
|
240 |
<p>By selecting references, C/C++ search will return all of the places the selected element is used.</p>
|
|
241 |
|
|
242 |
<h3>All Occurrences</h3>
|
|
243 |
<p>Selecting ‘All Occurrences’ in the Limit To section will result in a search for declarations, definitions (if applicable) and references for whatever element or elements have been selected.</p>
|
|
244 |
|
|
245 |
<h3>Any Element</h3>
|
|
246 |
<p>Selecting ‘Any Element’ in the Search For section will result in a search for all of the listed elements plus macros and typedefs.</p>
|
|
247 |
|
|
248 |
|
|
249 |
<p>For more information, see:<ul>
|
|
250 |
<li> <b>Workbench User Guide > Concepts > Views > Search view</b></li>
|
|
251 |
<li> <b>Workbench User Guide > Tasks > Navigating and finding resources</b></li>
|
|
252 |
</ul>
|
|
253 |
<p><img border="0" src="../images/ngconcepts.gif" ALT="Related concepts" width="143" height="21"><br>
|
|
254 |
<a href="../concepts/cdt_c_indexer.htm">C/C++ Indexer</a><br>
|
|
255 |
<a href="cdt_c_projects.htm">CDT Projects</a><br>
|
|
256 |
<a href="cdt_c_open_declarations.htm">Open Declaration</a><br>
|
|
257 |
</p>
|
|
258 |
<p><img border="0" src="../images/ngtasks.gif" ALT="Related tasks" width="143" height="21">
|
|
259 |
<br>
|
|
260 |
<a href="../tasks/cdt_t_search.htm">Searching for C/C++ elements</a><br>
|
|
261 |
<a href="../tasks/cdt_t_open_declarations.htm">Navigating to C/C++ declarations</a><br>
|
|
262 |
</p>
|
|
263 |
<p><img border="0" src="../images/ngref.gif" ALT="Related reference" width="143" height="21"> <br>
|
|
264 |
<a href="../reference/cdt_u_search.htm">C/C++ search page, Search dialog box</a><br>
|
|
265 |
<a href="../reference/cdt_u_icons.htm">C/C++ perspective icons</a></p><p>
|
|
266 |
|
|
267 |
<img src="../images/ng00_07.gif" ALT="IBM Copyright Statement" ></p>
|
|
268 |
|
|
269 |
</body>
|
|
270 |
|
|
271 |
</html> |