Skip to main content
summaryrefslogtreecommitdiffstats
blob: 9c3cfe4675211c7121c83417e8393964a0ca31af (plain) (blame)
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
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 3.2 Final//EN">
<html lang="en">

<head>
<meta http-equiv="Content-Language" content="en-us">
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<title>C/C++ search</title>
<link rel="stylesheet" type="text/css" href="../help.css">
</head>

<body>

<h1>C/C++ search</h1>

<p>You can conduct a fully or partially qualified name search. Further 
qualifying a search increases the accuracy and relevance of search results. The 
sections below provide guidance on how to control the scope of your search 
through the use of search delimiters, correct syntax, and wildcards.</p>

<p>You can search for:<br>
<ul>
	<li>language constructs within:
		<ul>
			<li>projects in your workspace</li>
			<li>selected resources from various views</li>
			<li>working sets</li>
		</ul></li>
	<li>a working set for references to particular elements</li>
	<li>declarations of particular elements</li>
	<li>definitions of particular elements</li>
	<li>references of particular elements</li>
</ul>
</p>

For information on working sets, see <b>Workbench User Guide &gt; Concepts &gt; Workbench &gt; Working sets</b><br>


  <h2>What you can search for</h2>
  <p>The table below lists the element types that you can search for and special 
  considerations to note when searching for a given element type. You can search 
  for some or all of the element types matching a search string that you 
  specify. If you choose to search for matching elements, all types, macros, and typdefs are included in the search.</p>
<table border="1" cellpadding="0" cellspacing="0" style="border-collapse: collapse" bordercolor="#111111" width="60%">
  <tr>
    <td width="19%"><b>Element</b></td>
    <td width="81%"><b>Note</b></td>
  </tr>
  <tr>
    <td width="19%">&nbsp;Class/Struct</td>
    <td width="81%">Searches for classes and structs.<p>You can further qualify 
    the search by specifying &quot;class&quot; or &quot;struct&quot; in front of the name 
    that you are 
    searching for. Specifying &quot;class&quot; or &quot;struct&quot; also allows you to 
    search for anonymous classes and structures.</td>
  </tr>
  <tr>
    <td width="19%">&nbsp;Function</td>
    <td width="81%">Searches for global functions or functions in a namespace 
    (functions that are not members of a class, struct, or union).<p>You can 
    specify parameters to further qualify your search. When specifying a 
    parameter list, everything between the parentheses should be valid C/C++ 
    syntax.</p>
    <p>Do not specify the return type of the function.</td>
  </tr>
  <tr>
    <td width="19%">&nbsp;Variable</td>
    <td width="81%">Searches for variables that are not members of a class, 
    struct, or union.</td>
  </tr>
  <tr>
    <td width="19%">&nbsp;Union</td>
    <td width="81%">Searches for unions.<p>Anonymous unions can be searched for by 
    specifying &quot;union&quot; as the search pattern.</td>
  </tr>
  <tr>
    <td width="19%">&nbsp;Method</td>
    <td width="81%">Searches for methods that are members of a class, struct, or 
    union.<p>Searching for methods also finds constructors and destructors. See 
    above note for functions.</td>
  </tr>
  <tr>
    <td width="19%">&nbsp;Field </td>
    <td width="81%">Searches for fields that are members of a class, struct, or 
    union.
  </tr>
  <tr>
    <td width="19%">&nbsp;Enumeration</td>
    <td width="81%">Searches for enumerations.</td>
  </tr>
  <tr>
    <td width="19%">&nbsp;Enumerator</td>
    <td width="81%">Searches for enumerators.</td>
  </tr>
  <tr>
    <td width="19%">&nbsp;Namespace</td>
    <td width="81%">Searches for namespaces.</td>
  </tr>
</table>

<h2>How you can limit your search</h2>

<p>You can limit your search to one or all of the following:</p>

<ul>
  <li>Declarations</li>
  <li>References</li>
  <li>Definitions (for functions, methods, variables and fields)</li>
</ul>

<p>You can control the scope of the search by specifying which of the following 
is to be searched:</p>
<ul>
  <li>Workspace</li>
  <li>Working Set</li>
  <li>Selected Resources</li>
</ul>

<h2>Wildcard characters</h2>
<p>You can use wildcard characters to further refine your search.</p>
<table border="1" cellpadding="0" cellspacing="0" style="border-collapse: collapse" bordercolor="#111111" width="60%">
  <tr>
    <td width="49%"><b>Use this wildcard character</b></td>
    <td width="51%"><b>To search for this</b></td>
  </tr>
  <tr>
    <td width="49%">&nbsp;<samp>*</samp></td>
    <td width="51%">Any string<p><b>Tip:<br>
    </b> Use the character <samp>*</samp> to search for 
    operators that begin with *. See syntax examples in the table below.</td>
  </tr>
  <tr>
    <td width="49%">&nbsp;<samp>?</samp></td>
    <td width="51%">A single character</td>
  </tr>
  <tr>
    <td width="49%">&nbsp;<samp>::</samp></td>
    <td width="51%">Nested elements</td>
  </tr>
</table>
<p><b>Tip: </b>Do not use wild cards between the brackets of a function or 
method pattern.  For example, the search 
string <samp>f( * )</samp> is an invalid search that results in a search for any function <samp>f</samp> 
    because 
the asterisk is interpreted as a pointer rather than a wild card.</p>
<h2>Syntax examples</h2>
<p>The table below provides syntax examples and an explanation for each example 
to help you conduct an effective search.</p>
<table border="1" cellpadding="0" cellspacing="0" style="border-collapse: collapse" bordercolor="#111111" width="60%" height="400">
  <tr>
    <td width="64%" height="16"><b>Syntax</b></td>
    <td width="36%" height="16"><b>Searches for this</b></td>
  </tr>
  <tr>
    <td width="64%" height="17">&nbsp; <samp>::*::*::A</samp></td>
    <td width="36%" height="17">A nested element two levels deep</td>
  </tr>
  <tr>
    <td width="64%" height="32">&nbsp; <samp>::*::*::A?</samp></td>
    <td width="36%" height="32">Any two-letter name that begins with A and is two levels 
    deep</td>
  </tr>
  <tr>
    <td width="64%" height="32">&nbsp; <samp>::A</samp> </td>
    <td width="36%" height="32">Searches for A not nested in anything</td>
  </tr>
  <tr>
    <td width="64%" height="17">&nbsp; <samp>*()</samp></td>
    <td width="36%" height="17">Any function taking no parameters</td>
  </tr>
  <tr>
    <td width="64%" height="32">&nbsp;&nbsp;<samp>*( A * )</samp> </td>
    <td width="36%" height="32">Any function taking 1 parameter that is a pointer to type 
    A</td>
  </tr>
  <tr>
    <td width="64%" height="33">&nbsp;&nbsp;<samp>f( int * )</samp></td>
    <td width="36%" height="33">Will search for function f taking 1 parameter that is an 
    int *</td>
  </tr>
  <tr>
    <td width="64%" height="64">&nbsp;&nbsp;<samp>f( const char [ 
    ], A &amp; )</samp></td>
    <td width="36%" height="64">Will search for a function f, taking 2 parameters; one is a 
    const char array, the other is a reference to type A</td>
  </tr>
  <tr>
    <td width="64%" height="32">&nbsp;<samp>operator \*</samp></td>
    <td width="36%" height="32">Finds only operator *</td>
  </tr>
  <tr>
    <td width="64%" height="32">&nbsp;<samp>operator \*=</samp></td>
    <td width="36%" height="32">Finds only operator *=</td>
  </tr>
  <tr>
    <td width="64%" height="16">&nbsp;<samp>operator *</samp></td>
    <td width="36%" height="16">Finds all operators</td>
  </tr>
  <tr>
    <td width="64%" height="15">&nbsp;<samp>class</samp></td>
    <td width="36%" height="15">Searches for anonymous classes</td>
  </tr>
  <tr>
    <td width="64%" height="16"> &nbsp;<samp>struct</samp></td>
    <td width="36%" height="16">Searches for anonymous structs</td>
  </tr>
  <tr>
    <td width="64%" height="16"> &nbsp;<samp>union</samp></td>
    <td width="36%" height="16">Searches for anonymous unions</td>
  </tr>
  </table>
<h2>Search results</h2>
<p>Search results are displayed in the Search view. You can sort your search by Name, Parent Name and Path. You can also repeat 
your last search.</p>

<h2>Search Concepts</h2>

<h3>Declarations</h3>
<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>
<p>All C/C++ search elements can be searched for declarations.</p>

<h3>Definitions</h3>
<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>
<p>For C/C++ search the following elements can be searched for definitions:
<ul>
	<li>Functions/Methods – the definition is where the code implementation resides</li>
	<li>Variable:
		<ol>
			<li>Extern – the definition is where the variable is initialized</li>
			<li>Non extern - the definition of a variable is where it is declared </li>
		</ol></li>
	<li>Field:
		<ol>
			<li>Static fields - the definition of a static field is where it gets initialized</li>
			<li>Non static fields - the definition corresponds to the fields declaration</li>
		</ol></li>
	<li>Namespace – the definition of a namespace is the same as its declaration</li>
</ul></p>

<h3>References</h3>
<p>By selecting references, C/C++ search will return all of the places the selected element is used.</p>

<h3>All Occurrences</h3>
<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>

<h3>Any Element</h3>
<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>


<p>For more information, see:<ul>
  <li> <b>Workbench User Guide &gt; Concepts &gt; Views &gt; Search view</b></li>
  <li> <b>Workbench User Guide &gt; Tasks &gt; Navigating and finding resources</b></li>
  </ul>
<p><img border="0" src="../images/ngconcepts.gif" ALT="Related concepts" width="143" height="21"><br>
<a href="../concepts/cdt_c_indexer.htm">C/C++ Indexer</a><br>
<a href="cdt_c_projects.htm">CDT Projects</a><br>
<a href="cdt_c_open_declarations.htm">Open Declarations</a><br>
<a href="cdt_c_open_definitions.htm">Open Definitions</a>
</p>
<p><img border="0" src="../images/ngtasks.gif" ALT="Related tasks" width="143" height="21">
<br>
<a href="../tasks/cdt_t_search.htm">Searching for C/C++ elements</a><br>
<a href="../tasks/cdt_t_open_declarations.htm">Navigating to C/C++ declarations</a><br>
<a href="../tasks/cdt_t_open_definitions.htm">Navigating to C/C++ definitions</a>
</p>
<p><img border="0" src="../images/ngref.gif" ALT="Related reference" width="143" height="21"> <br>
<a href="../reference/cdt_u_search.htm">C/C++ search page, Search dialog box</a><br>
<a href="../reference/cdt_u_icons.htm">C/C++ perspective icons</a></p><p>

<img src="../images/ng00_04a.gif" ALT="IBM Copyright Statement" ></p>

</body>

</html>

Back to the top