File: classExampleSourceViewer.html

package info (click to toggle)
witty 3.2.1-2%2Bdeb7u1
  • links: PTS
  • area: main
  • in suites: wheezy
  • size: 70,436 kB
  • sloc: cpp: 117,095; ansic: 77,999; xml: 7,564; sh: 1,037; perl: 208; makefile: 144; java: 86; sql: 14
file content (677 lines) | stat: -rw-r--r-- 54,359 bytes parent folder | download
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
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
<!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"/>
<title>Wt examples: ExampleSourceViewer Class Reference</title>

<link href="tabs.css" rel="stylesheet" type="text/css"/>
<link href="doxygen.css" rel="stylesheet" type="text/css" />



</head>
<body>
<div id="top"><!-- do not remove this div! -->


<div id="titlearea">
<table cellspacing="0" cellpadding="0">
 <tbody>
 <tr style="height: 56px;">
  
  
  <td style="padding-left: 0.5em;">
   <div id="projectname">Wt examples
   &#160;<span id="projectnumber">3.2.1</span>
   </div>
   
  </td>
  
  
  
 </tr>
 </tbody>
</table>
</div>

<!-- Generated by Doxygen 1.7.5.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 class="current"><a href="annotated.html"><span>Classes</span></a></li>
      <li><a href="files.html"><span>Files</span></a></li>
    </ul>
  </div>
  <div id="navrow2" class="tabs2">
    <ul class="tablist">
      <li><a href="annotated.html"><span>Class&#160;List</span></a></li>
      <li><a href="inherits.html"><span>Class&#160;Hierarchy</span></a></li>
      <li><a href="functions.html"><span>Class&#160;Members</span></a></li>
    </ul>
  </div>
</div>
<div class="header">
  <div class="summary">
<a href="#pub-methods">Public Member Functions</a> &#124;
<a href="#pri-methods">Private Member Functions</a> &#124;
<a href="#pri-attribs">Private Attributes</a>  </div>
  <div class="headertitle">
<div class="title">ExampleSourceViewer Class Reference</div>  </div>
</div>
<div class="contents">
<!-- doxytag: class="ExampleSourceViewer" --><!-- doxytag: inherits="Wt::WContainerWidget" -->
<p>A simple widget to visualise a set of example source files.  
 <a href="classExampleSourceViewer.html#details">More...</a></p>

<p><code>#include &lt;<a class="el" href="ExampleSourceViewer_8h_source.html">ExampleSourceViewer.h</a>&gt;</code></p>
<div class="dynheader">
Inheritance diagram for ExampleSourceViewer:</div>
<div class="dyncontent">
<div class="center"><img src="classExampleSourceViewer__inherit__graph.png" border="0" usemap="#ExampleSourceViewer_inherit__map" alt="Inheritance graph"/></div>
<map name="ExampleSourceViewer_inherit__map" id="ExampleSourceViewer_inherit__map">
<area shape="rect" doxygen="wt.tags:../../reference/html" href="../../reference/html/classWt_1_1WContainerWidget.html" title="Wt::WContainerWidget" alt="" coords="5,304,160,331"/><area shape="rect" doxygen="wt.tags:../../reference/html" href="../../reference/html/classWt_1_1WInteractWidget.html" title="Wt::WInteractWidget" alt="" coords="11,229,155,256"/><area shape="rect" doxygen="wt.tags:../../reference/html" href="../../reference/html/classWt_1_1WWebWidget.html" title="Wt::WWebWidget" alt="" coords="19,155,147,181"/><area shape="rect" doxygen="wt.tags:../../reference/html" href="../../reference/html/classWt_1_1WWidget.html" title="Wt::WWidget" alt="" coords="33,80,132,107"/><area shape="rect" doxygen="wt.tags:../../reference/html" href="../../reference/html/classWt_1_1WObject.html" title="Wt::WObject" alt="" coords="35,5,131,32"/></map>
<center><span class="legend">[<a href="graph_legend.html">legend</a>]</span></center></div>

<p><a href="classExampleSourceViewer-members.html">List of all members.</a></p>
<table class="memberdecls">
<tr><td colspan="2"><h2><a name="pub-methods"></a>
Public Member Functions</h2></td></tr>
<tr><td class="memItemLeft" align="right" valign="top">&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="classExampleSourceViewer.html#a3ab5978077589e8dbf6d8cfdb6da36d4">ExampleSourceViewer</a> (const std::string &amp;deployPath, const std::string &amp;examplesRoot, const std::string &amp;examplesType)</td></tr>
<tr><td class="mdescLeft">&#160;</td><td class="mdescRight">Constructor.  <a href="#a3ab5978077589e8dbf6d8cfdb6da36d4"></a><br/></td></tr>
<tr><td colspan="2"><h2><a name="pri-methods"></a>
Private Member Functions</h2></td></tr>
<tr><td class="memItemLeft" align="right" valign="top">void&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="classExampleSourceViewer.html#ae10b86e9ea10445cb5f4cac95e168c82">cppTraverseDir</a> (<a class="elRef" doxygen="wt.tags:../../reference/html" href="../../reference/html/classWt_1_1WStandardItem.html">Wt::WStandardItem</a> *<a class="elRef" doxygen="wt.tags:../../reference/html" href="../../reference/html/classWt_1_1WWidget.html#a3461e31818c4d2f516641bdaf508312a">parent</a>, const boost::filesystem::path &amp;path)</td></tr>
<tr><td class="memItemLeft" align="right" valign="top">void&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="classExampleSourceViewer.html#abdf6cba77785ba83e5cb04b78d7f9532">javaTraverseDir</a> (<a class="elRef" doxygen="wt.tags:../../reference/html" href="../../reference/html/classWt_1_1WStandardItem.html">Wt::WStandardItem</a> *<a class="elRef" doxygen="wt.tags:../../reference/html" href="../../reference/html/classWt_1_1WWidget.html#a3461e31818c4d2f516641bdaf508312a">parent</a>, const boost::filesystem::path &amp;path)</td></tr>
<tr><td class="memItemLeft" align="right" valign="top">void&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="classExampleSourceViewer.html#a23473a614f1d14bfc3a1bf2c9e688712">javaTraversePackages</a> (<a class="elRef" doxygen="wt.tags:../../reference/html" href="../../reference/html/classWt_1_1WStandardItem.html">Wt::WStandardItem</a> *<a class="elRef" doxygen="wt.tags:../../reference/html" href="../../reference/html/classWt_1_1WWidget.html#a3461e31818c4d2f516641bdaf508312a">parent</a>, const boost::filesystem::path &amp;srcPath, const std::string packageName)</td></tr>
<tr><td class="memItemLeft" align="right" valign="top">void&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="classExampleSourceViewer.html#a7f10a65267869bb570fec25bc19348ac">showFile</a> ()</td></tr>
<tr><td class="mdescLeft">&#160;</td><td class="mdescRight">Displayed the currently selected file.  <a href="#a7f10a65267869bb570fec25bc19348ac"></a><br/></td></tr>
<tr><td class="memItemLeft" align="right" valign="top">void&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="classExampleSourceViewer.html#a8aeb783e81242455f97f83d259919a20">handlePathChange</a> ()</td></tr>
<tr><td class="memItemLeft" align="right" valign="top">void&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="classExampleSourceViewer.html#a04710b0af789b12346a22a2f7ba2bccf">setExample</a> (const std::string &amp;exampleDir, const std::string &amp;example)</td></tr>
<tr><td colspan="2"><h2><a name="pri-attribs"></a>
Private Attributes</h2></td></tr>
<tr><td class="memItemLeft" align="right" valign="top"><a class="elRef" doxygen="wt.tags:../../reference/html" href="../../reference/html/classWt_1_1WTreeView.html">Wt::WTreeView</a> *&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="classExampleSourceViewer.html#a548859a1b20480151f542ebbcc82e5d0">exampleView_</a></td></tr>
<tr><td class="memItemLeft" align="right" valign="top"><a class="el" href="classSourceView.html">SourceView</a> *&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="classExampleSourceViewer.html#aefc329bfd3d8f7ae11c3f452a5744ab9">sourceView_</a></td></tr>
<tr><td class="memItemLeft" align="right" valign="top">std::string&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="classExampleSourceViewer.html#a49e72c4bc9714e8fdf9fad810f0d79b1">deployPath_</a></td></tr>
<tr><td class="memItemLeft" align="right" valign="top">std::string&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="classExampleSourceViewer.html#a7e33f7d49055157d7d26d036f91d2891">examplesRoot_</a></td></tr>
<tr><td class="memItemLeft" align="right" valign="top">std::string&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="classExampleSourceViewer.html#a7aaeb2ded7907e864f3ea804f19307cd">examplesType_</a></td></tr>
<tr><td class="memItemLeft" align="right" valign="top"><a class="elRef" doxygen="wt.tags:../../reference/html" href="../../reference/html/classWt_1_1WStandardItemModel.html">Wt::WStandardItemModel</a> *&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="classExampleSourceViewer.html#a09d648f3a6b7aa3ebeeac775f8a197cc">model_</a></td></tr>
</table>
<hr/><a name="details" id="details"></a><h2>Detailed Description</h2>
<div class="textblock"><p>A simple widget to visualise a set of example source files. </p>

<p>Definition at line <a class="el" href="ExampleSourceViewer_8h_source.html#l00021">21</a> of file <a class="el" href="ExampleSourceViewer_8h_source.html">ExampleSourceViewer.h</a>.</p>
</div><hr/><h2>Constructor &amp; Destructor Documentation</h2>
<a class="anchor" id="a3ab5978077589e8dbf6d8cfdb6da36d4"></a><!-- doxytag: member="ExampleSourceViewer::ExampleSourceViewer" ref="a3ab5978077589e8dbf6d8cfdb6da36d4" args="(const std::string &amp;deployPath, const std::string &amp;examplesRoot, const std::string &amp;examplesType)" -->
<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname">ExampleSourceViewer::ExampleSourceViewer </td>
          <td>(</td>
          <td class="paramtype">const std::string &amp;&#160;</td>
          <td class="paramname"><em>deployPath</em>, </td>
        </tr>
        <tr>
          <td class="paramkey"></td>
          <td></td>
          <td class="paramtype">const std::string &amp;&#160;</td>
          <td class="paramname"><em>examplesRoot</em>, </td>
        </tr>
        <tr>
          <td class="paramkey"></td>
          <td></td>
          <td class="paramtype">const std::string &amp;&#160;</td>
          <td class="paramname"><em>examplesType</em>&#160;</td>
        </tr>
        <tr>
          <td></td>
          <td>)</td>
          <td></td><td></td>
        </tr>
      </table>
</div>
<div class="memdoc">

<p>Constructor. </p>

<p>Definition at line <a class="el" href="ExampleSourceViewer_8C_source.html#l00071">71</a> of file <a class="el" href="ExampleSourceViewer_8C_source.html">ExampleSourceViewer.C</a>.</p>
<div class="fragment"><pre class="fragment">  : <a class="code" href="classExampleSourceViewer.html#a49e72c4bc9714e8fdf9fad810f0d79b1">deployPath_</a>(deployPath),
    <a class="code" href="classExampleSourceViewer.html#a7e33f7d49055157d7d26d036f91d2891">examplesRoot_</a>(examplesRoot),
    <a class="code" href="classExampleSourceViewer.html#a7aaeb2ded7907e864f3ea804f19307cd">examplesType_</a>(examplesType)
{
  wApp-&gt;internalPathChanged().connect
    (<span class="keyword">this</span>, &amp;<a class="code" href="classExampleSourceViewer.html#a8aeb783e81242455f97f83d259919a20">ExampleSourceViewer::handlePathChange</a>);

  <a class="code" href="classExampleSourceViewer.html#a8aeb783e81242455f97f83d259919a20">handlePathChange</a>();
}
</pre></div>
</div>
</div>
<hr/><h2>Member Function Documentation</h2>
<a class="anchor" id="ae10b86e9ea10445cb5f4cac95e168c82"></a><!-- doxytag: member="ExampleSourceViewer::cppTraverseDir" ref="ae10b86e9ea10445cb5f4cac95e168c82" args="(Wt::WStandardItem *parent, const boost::filesystem::path &amp;path)" -->
<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname">void ExampleSourceViewer::cppTraverseDir </td>
          <td>(</td>
          <td class="paramtype"><a class="elRef" doxygen="wt.tags:../../reference/html" href="../../reference/html/classWt_1_1WStandardItem.html">Wt::WStandardItem</a> *&#160;</td>
          <td class="paramname"><em>parent</em>, </td>
        </tr>
        <tr>
          <td class="paramkey"></td>
          <td></td>
          <td class="paramtype">const boost::filesystem::path &amp;&#160;</td>
          <td class="paramname"><em>path</em>&#160;</td>
        </tr>
        <tr>
          <td></td>
          <td>)</td>
          <td></td><td><code> [private]</code></td>
        </tr>
      </table>
</div>
<div class="memdoc">

<p>Definition at line <a class="el" href="ExampleSourceViewer_8C_source.html#l00192">192</a> of file <a class="el" href="ExampleSourceViewer_8C_source.html">ExampleSourceViewer.C</a>.</p>
<div class="fragment"><pre class="fragment">{
  <span class="keyword">static</span> <span class="keyword">const</span> <span class="keywordtype">char</span> *supportedFiles[] = {
    <span class="stringliteral">&quot;.C&quot;</span>, <span class="stringliteral">&quot;.cpp&quot;</span>, <span class="stringliteral">&quot;.h&quot;</span>, <span class="stringliteral">&quot;.css&quot;</span>, <span class="stringliteral">&quot;.xml&quot;</span>, <span class="stringliteral">&quot;.png&quot;</span>, <span class="stringliteral">&quot;.gif&quot;</span>, <span class="stringliteral">&quot;.csv&quot;</span>, <span class="stringliteral">&quot;.ico&quot;</span>, 0
  };

  <a class="code" href="classFileItem.html" title="WStandardItem which stores a file.">FileItem</a>* dir = <span class="keyword">new</span> <a class="code" href="classFileItem.html" title="WStandardItem which stores a file.">FileItem</a>(<span class="stringliteral">&quot;/icons/yellow-folder-open.png&quot;</span>, <a class="code" href="ExampleSourceViewer_8C.html#a90d62aee81b34c117b8f494a54bee4d4">filename</a>(path),
                               <span class="stringliteral">&quot;&quot;</span>);
  parent-&gt;<a class="codeRef" doxygen="wt.tags:../../reference/html" href="../../reference/html/classWt_1_1WStandardItem.html#abd54c7797f40c036b38300ba9cdf69b5">appendRow</a>(dir);
  parent = dir;
  <span class="keywordflow">try</span> {
    std::set&lt;fs::path&gt; paths;

    fs::directory_iterator end_itr;
    <span class="keywordflow">for</span> (fs::directory_iterator i(path); i != end_itr; ++i) 
      paths.insert(*i);

    std::vector&lt;FileItem*&gt; classes, files;
    std::vector&lt;fs::path&gt; dirs;

    <span class="keywordflow">while</span> (!paths.empty()) {
      fs::path p = *paths.begin();
      paths.erase(p);

      <span class="comment">// skip symbolic links and other files</span>
      <span class="keywordflow">if</span> (fs::is_symlink(p))
        <span class="keywordflow">continue</span>;

      <span class="comment">// skip files with an extension we do not want to handle</span>
      <span class="keywordflow">if</span> (fs::is_regular(p)) {
        std::string ext = fs::extension(p);
        <span class="keywordtype">bool</span> supported = <span class="keyword">false</span>;
        <span class="keywordflow">for</span> (<span class="keyword">const</span> <span class="keywordtype">char</span> **s = supportedFiles; *s != 0; ++s)
          <span class="keywordflow">if</span> (*s == ext) {
            supported = <span class="keyword">true</span>;
            <span class="keywordflow">break</span>;
          }
        
        <span class="keywordflow">if</span> (!supported)
          <span class="keywordflow">continue</span>;
      }

      <span class="comment">// see if we have one file of a class (.C, .h)</span>
      fs::path companion = <a class="code" href="ExampleSourceViewer_8C.html#a0c61a4a8c171f6b23a9fc3872c2e9e5d">getCompanion</a>(p);
      <span class="keywordflow">if</span> (!companion.empty()) {
        std::set&lt;fs::path&gt;::iterator it_companion = paths.find(companion);
 
          <span class="keywordflow">if</span> (it_companion != paths.end()) {
            std::string className = <a class="code" href="ExampleSourceViewer_8C.html#a2fb90126657b786f14062b06f995583c">stem</a>(p);
            <a class="codeRef" doxygen="wt.tags:../../reference/html" href="../../reference/html/classWt_1_1WWebWidget.html#a6cd1b8a84c7aaf72e5d44cb47ae90e9c">escapeText</a>(className);
            std::string label = <span class="stringliteral">&quot;&lt;i&gt;class&lt;/i&gt; &quot;</span> + className;

            <a class="code" href="classFileItem.html" title="WStandardItem which stores a file.">FileItem</a> *classItem = 
              <span class="keyword">new</span> <a class="code" href="classFileItem.html" title="WStandardItem which stores a file.">FileItem</a>(<span class="stringliteral">&quot;/icons/cppclass.png&quot;</span>, label, std::string());
            classItem-&gt;<a class="codeRef" doxygen="wt.tags:../../reference/html" href="../../reference/html/classWt_1_1WStandardItem.html#aedf80dfed644a525e5d726a4b6e74b94">setFlags</a>(classItem-&gt;<a class="codeRef" doxygen="wt.tags:../../reference/html" href="../../reference/html/classWt_1_1WStandardItem.html#a81bc3d55f8117f5c80edcb3c9c6b871a">flags</a>() | <a class="codeRef" doxygen="wt.tags:../../reference/html" href="../../reference/html/group__modelview.html#gga1d77c4de293aebfacbdde124de06b8b0a8ce71c5a5f185d9097b4bd596c71315e">ItemIsXHTMLText</a>);

            <a class="code" href="classFileItem.html" title="WStandardItem which stores a file.">FileItem</a> *header = <span class="keyword">new</span> <a class="code" href="classFileItem.html" title="WStandardItem which stores a file.">FileItem</a>(<span class="stringliteral">&quot;/icons/document.png&quot;</span>, <a class="code" href="ExampleSourceViewer_8C.html#a90d62aee81b34c117b8f494a54bee4d4">filename</a>(p),
                                            p.string());
            <a class="code" href="classFileItem.html" title="WStandardItem which stores a file.">FileItem</a> *cpp = <span class="keyword">new</span> <a class="code" href="classFileItem.html" title="WStandardItem which stores a file.">FileItem</a>(<span class="stringliteral">&quot;/icons/document.png&quot;</span>,
                                         <a class="code" href="ExampleSourceViewer_8C.html#a90d62aee81b34c117b8f494a54bee4d4">filename</a>(*it_companion),
                                         (*it_companion).string());
            classItem-&gt;<a class="codeRef" doxygen="wt.tags:../../reference/html" href="../../reference/html/classWt_1_1WStandardItem.html#abd54c7797f40c036b38300ba9cdf69b5">appendRow</a>(header);
            classItem-&gt;<a class="codeRef" doxygen="wt.tags:../../reference/html" href="../../reference/html/classWt_1_1WStandardItem.html#abd54c7797f40c036b38300ba9cdf69b5">appendRow</a>(cpp);
          
            classes.push_back(classItem);
            paths.erase(it_companion);
          } <span class="keywordflow">else</span> {
            <a class="code" href="classFileItem.html" title="WStandardItem which stores a file.">FileItem</a> *file = <span class="keyword">new</span> <a class="code" href="classFileItem.html" title="WStandardItem which stores a file.">FileItem</a>(<span class="stringliteral">&quot;/icons/document.png&quot;</span>, <a class="code" href="ExampleSourceViewer_8C.html#a90d62aee81b34c117b8f494a54bee4d4">filename</a>(p),
                                          p.string());
            files.push_back(file);
          }
      } <span class="keywordflow">else</span> <span class="keywordflow">if</span> (fs::is_directory(p)) {
        dirs.push_back(p);
      } <span class="keywordflow">else</span> {
        <a class="code" href="classFileItem.html" title="WStandardItem which stores a file.">FileItem</a> *file = <span class="keyword">new</span> <a class="code" href="classFileItem.html" title="WStandardItem which stores a file.">FileItem</a>(<span class="stringliteral">&quot;/icons/document.png&quot;</span>, <a class="code" href="ExampleSourceViewer_8C.html#a90d62aee81b34c117b8f494a54bee4d4">filename</a>(p),
                                      p.string());
        files.push_back(file);
      }
    }

    std::sort(dirs.begin(), dirs.end(), <a class="code" href="ExampleSourceViewer_8C.html#acb92ccbf2405b113c0b8b66cec63aaae">comparePaths</a>);

    <span class="keywordflow">for</span> (<span class="keywordtype">unsigned</span> <span class="keywordtype">int</span> i = 0; i &lt; classes.size(); i++)
      parent-&gt;<a class="codeRef" doxygen="wt.tags:../../reference/html" href="../../reference/html/classWt_1_1WStandardItem.html#abd54c7797f40c036b38300ba9cdf69b5">appendRow</a>(classes[i]);

    <span class="keywordflow">for</span> (<span class="keywordtype">unsigned</span> <span class="keywordtype">int</span> i = 0; i &lt; files.size(); i++)
      parent-&gt;<a class="codeRef" doxygen="wt.tags:../../reference/html" href="../../reference/html/classWt_1_1WStandardItem.html#abd54c7797f40c036b38300ba9cdf69b5">appendRow</a>(files[i]);

    <span class="keywordflow">for</span> (<span class="keywordtype">unsigned</span> <span class="keywordtype">int</span> i = 0; i &lt; dirs.size(); i++)
      <a class="code" href="classExampleSourceViewer.html#ae10b86e9ea10445cb5f4cac95e168c82">cppTraverseDir</a>(parent, dirs[i]);
  } <span class="keywordflow">catch</span> (fs::filesystem_error&amp; e) {
    std::cerr &lt;&lt; e.what() &lt;&lt; std::endl;
  }
}
</pre></div>
</div>
</div>
<a class="anchor" id="a8aeb783e81242455f97f83d259919a20"></a><!-- doxytag: member="ExampleSourceViewer::handlePathChange" ref="a8aeb783e81242455f97f83d259919a20" args="()" -->
<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname">void ExampleSourceViewer::handlePathChange </td>
          <td>(</td>
          <td class="paramname"></td><td>)</td>
          <td><code> [private]</code></td>
        </tr>
      </table>
</div>
<div class="memdoc">

<p>Definition at line <a class="el" href="ExampleSourceViewer_8C_source.html#l00084">84</a> of file <a class="el" href="ExampleSourceViewer_8C_source.html">ExampleSourceViewer.C</a>.</p>
<div class="fragment"><pre class="fragment">{
  <a class="codeRef" doxygen="wt.tags:../../reference/html" href="../../reference/html/classWt_1_1WApplication.html">WApplication</a> *app = wApp;

  <span class="keywordflow">if</span> (app-&gt;<a class="codeRef" doxygen="wt.tags:../../reference/html" href="../../reference/html/classWt_1_1WApplication.html#aed54bd83339bc80b3cffba9067ab1e39">internalPathMatches</a>(<a class="code" href="classExampleSourceViewer.html#a49e72c4bc9714e8fdf9fad810f0d79b1">deployPath_</a>)) {
    std::string example = app-&gt;<a class="codeRef" doxygen="wt.tags:../../reference/html" href="../../reference/html/classWt_1_1WApplication.html#a95e6b5e4dc9084d45e166264b10b3c46">internalPathNextPart</a>(<a class="code" href="classExampleSourceViewer.html#a49e72c4bc9714e8fdf9fad810f0d79b1">deployPath_</a>);

    <span class="keywordflow">if</span> (example.find(<span class="stringliteral">&quot;..&quot;</span>) != std::string::npos
        || example.find(<span class="charliteral">&#39;/&#39;</span>) != std::string::npos
        || example.find(<span class="charliteral">&#39;\\&#39;</span>) != std::string::npos)
      <a class="code" href="classExampleSourceViewer.html#a04710b0af789b12346a22a2f7ba2bccf">setExample</a>(<span class="stringliteral">&quot;INVALID_DIR&quot;</span>, <span class="stringliteral">&quot;INVALID&quot;</span>);
    <span class="keywordflow">else</span>
      <a class="code" href="classExampleSourceViewer.html#a04710b0af789b12346a22a2f7ba2bccf">setExample</a>(<a class="code" href="classExampleSourceViewer.html#a7e33f7d49055157d7d26d036f91d2891">examplesRoot_</a> + example, example);
  }
}
</pre></div>
</div>
</div>
<a class="anchor" id="abdf6cba77785ba83e5cb04b78d7f9532"></a><!-- doxytag: member="ExampleSourceViewer::javaTraverseDir" ref="abdf6cba77785ba83e5cb04b78d7f9532" args="(Wt::WStandardItem *parent, const boost::filesystem::path &amp;path)" -->
<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname">void ExampleSourceViewer::javaTraverseDir </td>
          <td>(</td>
          <td class="paramtype"><a class="elRef" doxygen="wt.tags:../../reference/html" href="../../reference/html/classWt_1_1WStandardItem.html">Wt::WStandardItem</a> *&#160;</td>
          <td class="paramname"><em>parent</em>, </td>
        </tr>
        <tr>
          <td class="paramkey"></td>
          <td></td>
          <td class="paramtype">const boost::filesystem::path &amp;&#160;</td>
          <td class="paramname"><em>path</em>&#160;</td>
        </tr>
        <tr>
          <td></td>
          <td>)</td>
          <td></td><td><code> [private]</code></td>
        </tr>
      </table>
</div>
<div class="memdoc">

<p>Definition at line <a class="el" href="ExampleSourceViewer_8C_source.html#l00322">322</a> of file <a class="el" href="ExampleSourceViewer_8C_source.html">ExampleSourceViewer.C</a>.</p>
<div class="fragment"><pre class="fragment">{
  <a class="code" href="classFileItem.html" title="WStandardItem which stores a file.">FileItem</a>* dir = <span class="keyword">new</span> <a class="code" href="classFileItem.html" title="WStandardItem which stores a file.">FileItem</a>(<span class="stringliteral">&quot;/icons/yellow-folder-open.png&quot;</span>, <a class="code" href="ExampleSourceViewer_8C.html#a90d62aee81b34c117b8f494a54bee4d4">filename</a>(path),
                               <span class="stringliteral">&quot;&quot;</span>);
  parent-&gt;<a class="codeRef" doxygen="wt.tags:../../reference/html" href="../../reference/html/classWt_1_1WStandardItem.html#abd54c7797f40c036b38300ba9cdf69b5">appendRow</a>(dir);
  parent = dir;

  std::vector&lt;fs::path&gt; files, dirs;

  fs::directory_iterator end_itr;
  <span class="keywordflow">for</span> (fs::directory_iterator i(path); i != end_itr; ++i) {
    fs::path p = *i;
    <span class="keywordflow">if</span> (fs::is_directory(p)) {
      <span class="keywordflow">if</span> (<a class="code" href="ExampleSourceViewer_8C.html#a90d62aee81b34c117b8f494a54bee4d4">filename</a>(p) == <span class="stringliteral">&quot;src&quot;</span>) {
        <a class="code" href="classFileItem.html" title="WStandardItem which stores a file.">FileItem</a>* dir = <span class="keyword">new</span> <a class="code" href="classFileItem.html" title="WStandardItem which stores a file.">FileItem</a>(<span class="stringliteral">&quot;/icons/package-folder-open.png&quot;</span>,
                                     <a class="code" href="ExampleSourceViewer_8C.html#a90d62aee81b34c117b8f494a54bee4d4">filename</a>(p), <span class="stringliteral">&quot;&quot;</span>);
        parent-&gt;<a class="codeRef" doxygen="wt.tags:../../reference/html" href="../../reference/html/classWt_1_1WStandardItem.html#abd54c7797f40c036b38300ba9cdf69b5">appendRow</a>(dir);
        <a class="code" href="classExampleSourceViewer.html#a23473a614f1d14bfc3a1bf2c9e688712">javaTraversePackages</a>(dir, p, <span class="stringliteral">&quot;&quot;</span>);
      } <span class="keywordflow">else</span>
        dirs.push_back(p);
    } <span class="keywordflow">else</span> {
      files.push_back(p);
    }
  }

  std::sort(dirs.begin(), dirs.end(), <a class="code" href="ExampleSourceViewer_8C.html#acb92ccbf2405b113c0b8b66cec63aaae">comparePaths</a>);
  std::sort(files.begin(), files.end(), <a class="code" href="ExampleSourceViewer_8C.html#acb92ccbf2405b113c0b8b66cec63aaae">comparePaths</a>);

  <span class="keywordflow">for</span> (<span class="keywordtype">unsigned</span> <span class="keywordtype">int</span> i = 0; i &lt; dirs.size(); i++)
    <a class="code" href="classExampleSourceViewer.html#abdf6cba77785ba83e5cb04b78d7f9532">javaTraverseDir</a>(parent, dirs[i]);

  <span class="keywordflow">for</span> (<span class="keywordtype">unsigned</span> <span class="keywordtype">int</span> i = 0; i &lt; files.size(); i++) {
    <a class="code" href="classFileItem.html" title="WStandardItem which stores a file.">FileItem</a> *file = <span class="keyword">new</span> <a class="code" href="classFileItem.html" title="WStandardItem which stores a file.">FileItem</a>(<span class="stringliteral">&quot;/icons/document.png&quot;</span>, <a class="code" href="ExampleSourceViewer_8C.html#a90d62aee81b34c117b8f494a54bee4d4">filename</a>(files[i]),
                                  files[i].<span class="keywordtype">string</span>());
    parent-&gt;<a class="codeRef" doxygen="wt.tags:../../reference/html" href="../../reference/html/classWt_1_1WStandardItem.html#abd54c7797f40c036b38300ba9cdf69b5">appendRow</a>(file);
  }
}
</pre></div>
</div>
</div>
<a class="anchor" id="a23473a614f1d14bfc3a1bf2c9e688712"></a><!-- doxytag: member="ExampleSourceViewer::javaTraversePackages" ref="a23473a614f1d14bfc3a1bf2c9e688712" args="(Wt::WStandardItem *parent, const boost::filesystem::path &amp;srcPath, const std::string packageName)" -->
<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname">void ExampleSourceViewer::javaTraversePackages </td>
          <td>(</td>
          <td class="paramtype"><a class="elRef" doxygen="wt.tags:../../reference/html" href="../../reference/html/classWt_1_1WStandardItem.html">Wt::WStandardItem</a> *&#160;</td>
          <td class="paramname"><em>parent</em>, </td>
        </tr>
        <tr>
          <td class="paramkey"></td>
          <td></td>
          <td class="paramtype">const boost::filesystem::path &amp;&#160;</td>
          <td class="paramname"><em>srcPath</em>, </td>
        </tr>
        <tr>
          <td class="paramkey"></td>
          <td></td>
          <td class="paramtype">const std::string&#160;</td>
          <td class="paramname"><em>packageName</em>&#160;</td>
        </tr>
        <tr>
          <td></td>
          <td>)</td>
          <td></td><td><code> [private]</code></td>
        </tr>
      </table>
</div>
<div class="memdoc">

<p>Definition at line <a class="el" href="ExampleSourceViewer_8C_source.html#l00288">288</a> of file <a class="el" href="ExampleSourceViewer_8C_source.html">ExampleSourceViewer.C</a>.</p>
<div class="fragment"><pre class="fragment">{
  fs::directory_iterator end_itr;

  <a class="code" href="classFileItem.html" title="WStandardItem which stores a file.">FileItem</a> *packageItem = 0;
  <span class="keywordflow">for</span> (fs::directory_iterator i(srcPath); i != end_itr; ++i) {
    fs::path p = *i;
    <span class="keywordflow">if</span> (fs::is_regular(p)) {
      <span class="keywordflow">if</span> (!packageItem) {
        packageItem = <span class="keyword">new</span> <a class="code" href="classFileItem.html" title="WStandardItem which stores a file.">FileItem</a>(<span class="stringliteral">&quot;/icons/package.png&quot;</span>, packageName, <span class="stringliteral">&quot;&quot;</span>);
        parent-&gt;<a class="codeRef" doxygen="wt.tags:../../reference/html" href="../../reference/html/classWt_1_1WStandardItem.html#abd54c7797f40c036b38300ba9cdf69b5">appendRow</a>(packageItem);
      }

      <a class="code" href="classFileItem.html" title="WStandardItem which stores a file.">FileItem</a> *file = <span class="keyword">new</span> <a class="code" href="classFileItem.html" title="WStandardItem which stores a file.">FileItem</a>(<span class="stringliteral">&quot;/icons/javaclass.png&quot;</span>, <a class="code" href="ExampleSourceViewer_8C.html#a90d62aee81b34c117b8f494a54bee4d4">filename</a>(p),
                                    p.string());
      packageItem-&gt;<a class="codeRef" doxygen="wt.tags:../../reference/html" href="../../reference/html/classWt_1_1WStandardItem.html#abd54c7797f40c036b38300ba9cdf69b5">appendRow</a>(file);
    }
  }

  <span class="keywordflow">for</span> (fs::directory_iterator i(srcPath); i != end_itr; ++i) {
    fs::path p = *i;
    <span class="keywordflow">if</span> (fs::is_directory(p)) {  
      std::string pn = packageName;
      <span class="keywordflow">if</span> (!pn.empty())
        pn += <span class="stringliteral">&quot;.&quot;</span>;
      pn += <a class="code" href="ExampleSourceViewer_8C.html#a90d62aee81b34c117b8f494a54bee4d4">filename</a>(p);

      <a class="code" href="classExampleSourceViewer.html#a23473a614f1d14bfc3a1bf2c9e688712">javaTraversePackages</a>(parent, p, pn);
    }
  }
}
</pre></div>
</div>
</div>
<a class="anchor" id="a04710b0af789b12346a22a2f7ba2bccf"></a><!-- doxytag: member="ExampleSourceViewer::setExample" ref="a04710b0af789b12346a22a2f7ba2bccf" args="(const std::string &amp;exampleDir, const std::string &amp;example)" -->
<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname">void ExampleSourceViewer::setExample </td>
          <td>(</td>
          <td class="paramtype">const std::string &amp;&#160;</td>
          <td class="paramname"><em>exampleDir</em>, </td>
        </tr>
        <tr>
          <td class="paramkey"></td>
          <td></td>
          <td class="paramtype">const std::string &amp;&#160;</td>
          <td class="paramname"><em>example</em>&#160;</td>
        </tr>
        <tr>
          <td></td>
          <td>)</td>
          <td></td><td><code> [private]</code></td>
        </tr>
      </table>
</div>
<div class="memdoc">

<p>Definition at line <a class="el" href="ExampleSourceViewer_8C_source.html#l00100">100</a> of file <a class="el" href="ExampleSourceViewer_8C_source.html">ExampleSourceViewer.C</a>.</p>
<div class="fragment"><pre class="fragment">{
  <a class="codeRef" doxygen="wt.tags:../../reference/html" href="../../reference/html/classWt_1_1WContainerWidget.html#a608f748cbdda763f1a11556ddad9fbe1">clear</a>();

  <span class="keywordtype">bool</span> exists = <span class="keyword">false</span>;
  <span class="keywordflow">try</span> {
    exists = fs::exists(exampleDir);
  } <span class="keywordflow">catch</span> (std::exception&amp;) {
  }

  <span class="keywordflow">if</span> (!exists) {
    <a class="codeRef" doxygen="wt.tags:../../reference/html" href="../../reference/html/classWt_1_1WContainerWidget.html#a2cfe66d9b62940f889e99538a9f478d2">addWidget</a>(<span class="keyword">new</span> <a class="codeRef" doxygen="wt.tags:../../reference/html" href="../../reference/html/classWt_1_1WText.html">WText</a>(<span class="stringliteral">&quot;No such example: &quot;</span> + exampleDir));
    <span class="keywordflow">return</span>;
  }

  <a class="code" href="classExampleSourceViewer.html#a09d648f3a6b7aa3ebeeac775f8a197cc">model_</a> = <span class="keyword">new</span> <a class="codeRef" doxygen="wt.tags:../../reference/html" href="../../reference/html/classWt_1_1WStandardItemModel.html">WStandardItemModel</a>(0, 1, <span class="keyword">this</span>);
  <span class="keywordflow">if</span> (<a class="code" href="classExampleSourceViewer.html#a7aaeb2ded7907e864f3ea804f19307cd">examplesType_</a> == <span class="stringliteral">&quot;CPP&quot;</span>) {
    <a class="code" href="classExampleSourceViewer.html#ae10b86e9ea10445cb5f4cac95e168c82">cppTraverseDir</a>(<a class="code" href="classExampleSourceViewer.html#a09d648f3a6b7aa3ebeeac775f8a197cc">model_</a>-&gt;<a class="codeRef" doxygen="wt.tags:../../reference/html" href="../../reference/html/classWt_1_1WStandardItemModel.html#a5fdc79e8100020d98a77ad3543019477">invisibleRootItem</a>(), exampleDir);
  } <span class="keywordflow">else</span> <span class="keywordflow">if</span> (<a class="code" href="classExampleSourceViewer.html#a7aaeb2ded7907e864f3ea804f19307cd">examplesType_</a> == <span class="stringliteral">&quot;JAVA&quot;</span>) {
    <a class="code" href="classExampleSourceViewer.html#abdf6cba77785ba83e5cb04b78d7f9532">javaTraverseDir</a>(<a class="code" href="classExampleSourceViewer.html#a09d648f3a6b7aa3ebeeac775f8a197cc">model_</a>-&gt;<a class="codeRef" doxygen="wt.tags:../../reference/html" href="../../reference/html/classWt_1_1WStandardItemModel.html#a5fdc79e8100020d98a77ad3543019477">invisibleRootItem</a>(), exampleDir);
  }

  WApplication::instance()-&gt;setTitle(<a class="codeRef" doxygen="wt.tags:../../reference/html" href="../../reference/html/classWt_1_1WWidget.html#aa651f107ec7cf080faef6c435705fc44">tr</a>(<span class="stringliteral">&quot;srcview.title.&quot;</span> + example));
  <a class="codeRef" doxygen="wt.tags:../../reference/html" href="../../reference/html/classWt_1_1WText.html">WText</a> *title = 
    <span class="keyword">new</span> <a class="codeRef" doxygen="wt.tags:../../reference/html" href="../../reference/html/classWt_1_1WText.html">WText</a>(<a class="codeRef" doxygen="wt.tags:../../reference/html" href="../../reference/html/classWt_1_1WWidget.html#aa651f107ec7cf080faef6c435705fc44">tr</a>(<span class="stringliteral">&quot;srcview.title.&quot;</span> + <a class="code" href="classExampleSourceViewer.html#a7aaeb2ded7907e864f3ea804f19307cd">examplesType_</a> + <span class="stringliteral">&quot;.&quot;</span> + example));
  title-&gt;<a class="codeRef" doxygen="wt.tags:../../reference/html" href="../../reference/html/classWt_1_1WText.html#a3491e55f74027b49aaf8cd25369bc0e4">setInternalPathEncoding</a>(<span class="keyword">true</span>);

  <a class="code" href="classExampleSourceViewer.html#a548859a1b20480151f542ebbcc82e5d0">exampleView_</a> = <span class="keyword">new</span> <a class="codeRef" doxygen="wt.tags:../../reference/html" href="../../reference/html/classWt_1_1WTreeView.html">WTreeView</a>();
  <a class="code" href="classExampleSourceViewer.html#a548859a1b20480151f542ebbcc82e5d0">exampleView_</a>-&gt;<a class="codeRef" doxygen="wt.tags:../../reference/html" href="../../reference/html/classWt_1_1WTreeView.html#a4d0967483ed31b26a16a5c7620cb5d7c">setHeaderHeight</a>(0);
  <a class="code" href="classExampleSourceViewer.html#a548859a1b20480151f542ebbcc82e5d0">exampleView_</a>-&gt;<a class="codeRef" doxygen="wt.tags:../../reference/html" href="../../reference/html/classWt_1_1WTreeView.html#a482314306c8404d7ed941fd986e32623">resize</a>(300, WLength::Auto);
  <a class="code" href="classExampleSourceViewer.html#a548859a1b20480151f542ebbcc82e5d0">exampleView_</a>-&gt;<a class="codeRef" doxygen="wt.tags:../../reference/html" href="../../reference/html/classWt_1_1WAbstractItemView.html#ae1c86a0f37f97f63aed3b00fd8ffad7c">setSortingEnabled</a>(<span class="keyword">false</span>);
  <a class="code" href="classExampleSourceViewer.html#a548859a1b20480151f542ebbcc82e5d0">exampleView_</a>-&gt;<a class="codeRef" doxygen="wt.tags:../../reference/html" href="../../reference/html/classWt_1_1WTreeView.html#a390300f766472476e6a0df5aefaa2ef0">setModel</a>(<a class="code" href="classExampleSourceViewer.html#a09d648f3a6b7aa3ebeeac775f8a197cc">model_</a>);
  <a class="code" href="classExampleSourceViewer.html#a548859a1b20480151f542ebbcc82e5d0">exampleView_</a>-&gt;<a class="codeRef" doxygen="wt.tags:../../reference/html" href="../../reference/html/classWt_1_1WTreeView.html#add40d3e05352ae094f6fe2b9c879c2c7">expandToDepth</a>(1);
  <a class="code" href="classExampleSourceViewer.html#a548859a1b20480151f542ebbcc82e5d0">exampleView_</a>-&gt;<a class="codeRef" doxygen="wt.tags:../../reference/html" href="../../reference/html/classWt_1_1WAbstractItemView.html#af6fcd9761e2f7a3b497d3563c849d320">setSelectionMode</a>(SingleSelection);
  <a class="code" href="classExampleSourceViewer.html#a548859a1b20480151f542ebbcc82e5d0">exampleView_</a>-&gt;<a class="codeRef" doxygen="wt.tags:../../reference/html" href="../../reference/html/classWt_1_1WTreeView.html#a48f74194ae6bd63c08a6ff76ecb3e39c">setAlternatingRowColors</a>(<span class="keyword">false</span>);
  <a class="code" href="classExampleSourceViewer.html#a548859a1b20480151f542ebbcc82e5d0">exampleView_</a>-&gt;<a class="codeRef" doxygen="wt.tags:../../reference/html" href="../../reference/html/classWt_1_1WAbstractItemView.html#ada37ffbe2d470dd227c8714645f150f0">selectionChanged</a>().<a class="codeRef" doxygen="wt.tags:../../reference/html" href="../../reference/html/classWt_1_1Signal.html#a15d1150af031537b492674ee651bf4a3">connect</a>
    (<span class="keyword">this</span>, &amp;<a class="code" href="classExampleSourceViewer.html#a7f10a65267869bb570fec25bc19348ac" title="Displayed the currently selected file.">ExampleSourceViewer::showFile</a>);

  <a class="code" href="classExampleSourceViewer.html#aefc329bfd3d8f7ae11c3f452a5744ab9">sourceView_</a> = <span class="keyword">new</span> <a class="code" href="classSourceView.html" title="View class for source code.">SourceView</a>(<a class="code" href="classFileItem.html#ae072fe0aa9a614bfc39a9f59cf987771">FileItem::FileNameRole</a>, 
                               <a class="code" href="classFileItem.html#ae1dbc221110c06627765b421c30df2ab">FileItem::ContentsRole</a>,
                               <a class="code" href="classFileItem.html#aa8d601340669b5628a8bac8e35ccd936">FileItem::FilePathRole</a>);
  <a class="code" href="classExampleSourceViewer.html#aefc329bfd3d8f7ae11c3f452a5744ab9">sourceView_</a>-&gt;<a class="codeRef" doxygen="wt.tags:../../reference/html" href="../../reference/html/classWt_1_1WWebWidget.html#afd3a3b359681111460a93d13979d17dd">setStyleClass</a>(<span class="stringliteral">&quot;source-view&quot;</span>);

  <span class="comment">/*</span>
<span class="comment">   * Expand path to first file, to show something in the source viewer</span>
<span class="comment">   */</span>
  <a class="codeRef" doxygen="wt.tags:../../reference/html" href="../../reference/html/classWt_1_1WStandardItem.html">WStandardItem</a> *w = <a class="code" href="classExampleSourceViewer.html#a09d648f3a6b7aa3ebeeac775f8a197cc">model_</a>-&gt;<a class="codeRef" doxygen="wt.tags:../../reference/html" href="../../reference/html/classWt_1_1WStandardItemModel.html#a32d755ace793c2110b0fa5d650a0d577">item</a>(0);
  <span class="keywordflow">do</span> {
    <a class="code" href="classExampleSourceViewer.html#a548859a1b20480151f542ebbcc82e5d0">exampleView_</a>-&gt;<a class="codeRef" doxygen="wt.tags:../../reference/html" href="../../reference/html/classWt_1_1WTreeView.html#a49566dd5cc8d1d0d95bad4783dd4e11a">setExpanded</a>(w-&gt;<a class="codeRef" doxygen="wt.tags:../../reference/html" href="../../reference/html/classWt_1_1WStandardItem.html#a8afc6170ff2544d385823795b4dded37">index</a>(), <span class="keyword">true</span>);
    <span class="keywordflow">if</span> (w-&gt;<a class="codeRef" doxygen="wt.tags:../../reference/html" href="../../reference/html/classWt_1_1WStandardItem.html#a0b025885afc1500285359821f52bb531">rowCount</a>() &gt; 0)
      w = w-&gt;<a class="codeRef" doxygen="wt.tags:../../reference/html" href="../../reference/html/classWt_1_1WStandardItem.html#a874247b52596f31126882ee8ea53d3ca">child</a>(0);
    <span class="keywordflow">else</span> {
      <a class="code" href="classExampleSourceViewer.html#a548859a1b20480151f542ebbcc82e5d0">exampleView_</a>-&gt;<a class="codeRef" doxygen="wt.tags:../../reference/html" href="../../reference/html/classWt_1_1WAbstractItemView.html#a4423d5412ff1b4bc67f0a8f443f12136">select</a>(w-&gt;<a class="codeRef" doxygen="wt.tags:../../reference/html" href="../../reference/html/classWt_1_1WStandardItem.html#a8afc6170ff2544d385823795b4dded37">index</a>(), <a class="codeRef" doxygen="wt.tags:../../reference/html" href="../../reference/html/namespaceWt.html#a1ec974261fb0e2b80498473dcb6c91eda5317beeb399a97e111e7c99dee9161d5">Select</a>);
      w = 0;
    }
  } <span class="keywordflow">while</span> (w);

  <a class="codeRef" doxygen="wt.tags:../../reference/html" href="../../reference/html/classWt_1_1WVBoxLayout.html">WVBoxLayout</a> *topLayout = <span class="keyword">new</span> <a class="codeRef" doxygen="wt.tags:../../reference/html" href="../../reference/html/classWt_1_1WVBoxLayout.html">WVBoxLayout</a>();
  topLayout-&gt;<a class="codeRef" doxygen="wt.tags:../../reference/html" href="../../reference/html/classWt_1_1WBoxLayout.html#a7c1ec58e25d0b7add93f5f4342844db6">addWidget</a>(title, 0, AlignTop | AlignJustify);

  <a class="codeRef" doxygen="wt.tags:../../reference/html" href="../../reference/html/classWt_1_1WHBoxLayout.html">WHBoxLayout</a> *gitLayout = <span class="keyword">new</span> <a class="codeRef" doxygen="wt.tags:../../reference/html" href="../../reference/html/classWt_1_1WHBoxLayout.html">WHBoxLayout</a>();
  gitLayout-&gt;<a class="codeRef" doxygen="wt.tags:../../reference/html" href="../../reference/html/classWt_1_1WBoxLayout.html#a7c1ec58e25d0b7add93f5f4342844db6">addWidget</a>(<a class="code" href="classExampleSourceViewer.html#a548859a1b20480151f542ebbcc82e5d0">exampleView_</a>, 0);
  gitLayout-&gt;<a class="codeRef" doxygen="wt.tags:../../reference/html" href="../../reference/html/classWt_1_1WBoxLayout.html#a7c1ec58e25d0b7add93f5f4342844db6">addWidget</a>(<a class="code" href="classExampleSourceViewer.html#aefc329bfd3d8f7ae11c3f452a5744ab9">sourceView_</a>, 1);
  topLayout-&gt;<a class="codeRef" doxygen="wt.tags:../../reference/html" href="../../reference/html/classWt_1_1WBoxLayout.html#a062d26b432841995a0be7b7d7aac6413">addLayout</a>(gitLayout, 1);
  gitLayout-&gt;<a class="codeRef" doxygen="wt.tags:../../reference/html" href="../../reference/html/classWt_1_1WBoxLayout.html#a00bdfb4d442bd8e8ad9c33b72692763f">setResizable</a>(0);

  <span class="comment">/*</span>
<span class="comment">   * FIXME, in plain HTML mode, we should set a minimum size to the source</span>
<span class="comment">   * view, and remove this in enableAjax() ?</span>
<span class="comment">   */</span>
  <span class="comment">// sourceView_-&gt;setHeight(&quot;100%&quot;);</span>

  <a class="codeRef" doxygen="wt.tags:../../reference/html" href="../../reference/html/classWt_1_1WContainerWidget.html#a1c84e0ffe330d4798f0ce217f75be08c">setLayout</a>(topLayout);
  <a class="codeRef" doxygen="wt.tags:../../reference/html" href="../../reference/html/classWt_1_1WWebWidget.html#afd3a3b359681111460a93d13979d17dd">setStyleClass</a>(<span class="stringliteral">&quot;maindiv&quot;</span>);
}
</pre></div>
</div>
</div>
<a class="anchor" id="a7f10a65267869bb570fec25bc19348ac"></a><!-- doxytag: member="ExampleSourceViewer::showFile" ref="a7f10a65267869bb570fec25bc19348ac" args="()" -->
<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname">void ExampleSourceViewer::showFile </td>
          <td>(</td>
          <td class="paramname"></td><td>)</td>
          <td><code> [private]</code></td>
        </tr>
      </table>
</div>
<div class="memdoc">

<p>Displayed the currently selected file. </p>

<p>Definition at line <a class="el" href="ExampleSourceViewer_8C_source.html#l00363">363</a> of file <a class="el" href="ExampleSourceViewer_8C_source.html">ExampleSourceViewer.C</a>.</p>
<div class="fragment"><pre class="fragment">                                   {
  <span class="keywordflow">if</span> (<a class="code" href="classExampleSourceViewer.html#a548859a1b20480151f542ebbcc82e5d0">exampleView_</a>-&gt;<a class="codeRef" doxygen="wt.tags:../../reference/html" href="../../reference/html/classWt_1_1WAbstractItemView.html#afde08bb75862592d81dc93f30ed7dcd6">selectedIndexes</a>().empty())
    <span class="keywordflow">return</span>;

  <a class="codeRef" doxygen="wt.tags:../../reference/html" href="../../reference/html/classWt_1_1WModelIndex.html">WModelIndex</a> selected = *<a class="code" href="classExampleSourceViewer.html#a548859a1b20480151f542ebbcc82e5d0">exampleView_</a>-&gt;<a class="codeRef" doxygen="wt.tags:../../reference/html" href="../../reference/html/classWt_1_1WAbstractItemView.html#afde08bb75862592d81dc93f30ed7dcd6">selectedIndexes</a>().begin();

  <span class="comment">// expand a folder when clicked</span>
  <span class="keywordflow">if</span> (<a class="code" href="classExampleSourceViewer.html#a548859a1b20480151f542ebbcc82e5d0">exampleView_</a>-&gt;<a class="codeRef" doxygen="wt.tags:../../reference/html" href="../../reference/html/classWt_1_1WAbstractItemView.html#abd583faed8e2fc3936d1b5545c4bbf84">model</a>()-&gt;<a class="codeRef" doxygen="wt.tags:../../reference/html" href="../../reference/html/classWt_1_1WAbstractItemModel.html#ab0709a8f71fd5df882f29bb29fd055f0">rowCount</a>(selected) &gt; 0
      &amp;&amp; !<a class="code" href="classExampleSourceViewer.html#a548859a1b20480151f542ebbcc82e5d0">exampleView_</a>-&gt;<a class="codeRef" doxygen="wt.tags:../../reference/html" href="../../reference/html/classWt_1_1WTreeView.html#a48eac450ec46ac1eea41822bfd227e9b">isExpanded</a>(selected))
    <a class="code" href="classExampleSourceViewer.html#a548859a1b20480151f542ebbcc82e5d0">exampleView_</a>-&gt;<a class="codeRef" doxygen="wt.tags:../../reference/html" href="../../reference/html/classWt_1_1WTreeView.html#a49566dd5cc8d1d0d95bad4783dd4e11a">setExpanded</a>(selected, <span class="keyword">true</span>);

  <span class="comment">// (for a file,) load data in source viewer</span>
  <a class="code" href="classExampleSourceViewer.html#aefc329bfd3d8f7ae11c3f452a5744ab9">sourceView_</a>-&gt;<a class="code" href="classSourceView.html#a10f2b88b0b8ea6b9563077e7958bc4d0" title="Sets the model index.">setIndex</a>(selected);
}
</pre></div>
</div>
</div>
<hr/><h2>Member Data Documentation</h2>
<a class="anchor" id="a49e72c4bc9714e8fdf9fad810f0d79b1"></a><!-- doxytag: member="ExampleSourceViewer::deployPath_" ref="a49e72c4bc9714e8fdf9fad810f0d79b1" args="" -->
<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname">std::string <a class="el" href="classExampleSourceViewer.html#a49e72c4bc9714e8fdf9fad810f0d79b1">ExampleSourceViewer::deployPath_</a><code> [private]</code></td>
        </tr>
      </table>
</div>
<div class="memdoc">

<p>Definition at line <a class="el" href="ExampleSourceViewer_8h_source.html#l00034">34</a> of file <a class="el" href="ExampleSourceViewer_8h_source.html">ExampleSourceViewer.h</a>.</p>

</div>
</div>
<a class="anchor" id="a7e33f7d49055157d7d26d036f91d2891"></a><!-- doxytag: member="ExampleSourceViewer::examplesRoot_" ref="a7e33f7d49055157d7d26d036f91d2891" args="" -->
<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname">std::string <a class="el" href="classExampleSourceViewer.html#a7e33f7d49055157d7d26d036f91d2891">ExampleSourceViewer::examplesRoot_</a><code> [private]</code></td>
        </tr>
      </table>
</div>
<div class="memdoc">

<p>Definition at line <a class="el" href="ExampleSourceViewer_8h_source.html#l00035">35</a> of file <a class="el" href="ExampleSourceViewer_8h_source.html">ExampleSourceViewer.h</a>.</p>

</div>
</div>
<a class="anchor" id="a7aaeb2ded7907e864f3ea804f19307cd"></a><!-- doxytag: member="ExampleSourceViewer::examplesType_" ref="a7aaeb2ded7907e864f3ea804f19307cd" args="" -->
<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname">std::string <a class="el" href="classExampleSourceViewer.html#a7aaeb2ded7907e864f3ea804f19307cd">ExampleSourceViewer::examplesType_</a><code> [private]</code></td>
        </tr>
      </table>
</div>
<div class="memdoc">

<p>Definition at line <a class="el" href="ExampleSourceViewer_8h_source.html#l00036">36</a> of file <a class="el" href="ExampleSourceViewer_8h_source.html">ExampleSourceViewer.h</a>.</p>

</div>
</div>
<a class="anchor" id="a548859a1b20480151f542ebbcc82e5d0"></a><!-- doxytag: member="ExampleSourceViewer::exampleView_" ref="a548859a1b20480151f542ebbcc82e5d0" args="" -->
<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname"><a class="elRef" doxygen="wt.tags:../../reference/html" href="../../reference/html/classWt_1_1WTreeView.html">Wt::WTreeView</a>* <a class="el" href="classExampleSourceViewer.html#a548859a1b20480151f542ebbcc82e5d0">ExampleSourceViewer::exampleView_</a><code> [private]</code></td>
        </tr>
      </table>
</div>
<div class="memdoc">

<p>Definition at line <a class="el" href="ExampleSourceViewer_8h_source.html#l00031">31</a> of file <a class="el" href="ExampleSourceViewer_8h_source.html">ExampleSourceViewer.h</a>.</p>

</div>
</div>
<a class="anchor" id="a09d648f3a6b7aa3ebeeac775f8a197cc"></a><!-- doxytag: member="ExampleSourceViewer::model_" ref="a09d648f3a6b7aa3ebeeac775f8a197cc" args="" -->
<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname"><a class="elRef" doxygen="wt.tags:../../reference/html" href="../../reference/html/classWt_1_1WStandardItemModel.html">Wt::WStandardItemModel</a>* <a class="el" href="classExampleSourceViewer.html#a09d648f3a6b7aa3ebeeac775f8a197cc">ExampleSourceViewer::model_</a><code> [private]</code></td>
        </tr>
      </table>
</div>
<div class="memdoc">

<p>Definition at line <a class="el" href="ExampleSourceViewer_8h_source.html#l00038">38</a> of file <a class="el" href="ExampleSourceViewer_8h_source.html">ExampleSourceViewer.h</a>.</p>

</div>
</div>
<a class="anchor" id="aefc329bfd3d8f7ae11c3f452a5744ab9"></a><!-- doxytag: member="ExampleSourceViewer::sourceView_" ref="aefc329bfd3d8f7ae11c3f452a5744ab9" args="" -->
<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname"><a class="el" href="classSourceView.html">SourceView</a>* <a class="el" href="classExampleSourceViewer.html#aefc329bfd3d8f7ae11c3f452a5744ab9">ExampleSourceViewer::sourceView_</a><code> [private]</code></td>
        </tr>
      </table>
</div>
<div class="memdoc">

<p>Definition at line <a class="el" href="ExampleSourceViewer_8h_source.html#l00032">32</a> of file <a class="el" href="ExampleSourceViewer_8h_source.html">ExampleSourceViewer.h</a>.</p>

</div>
</div>
<hr/>The documentation for this class was generated from the following files:<ul>
<li>/home/koen/project/wt/public-git/wt/examples/wt-homepage/<a class="el" href="ExampleSourceViewer_8h_source.html">ExampleSourceViewer.h</a></li>
<li>/home/koen/project/wt/public-git/wt/examples/wt-homepage/<a class="el" href="ExampleSourceViewer_8C_source.html">ExampleSourceViewer.C</a></li>
</ul>
</div>
<hr size="1"><address style="text-align: right; margin: 3px"><small>
Generated on Fri Mar 30 2012 for <a href="http://www.webtoolkit.eu/wt">the
C++ Web Toolkit (Wt)</a> by&nbsp;<a
href="http://www.doxygen.org/index.html"><img src="doxygen.png"
alt="doxygen" border="0" style="vertical-align: middle; display:
inline-block; height: 2em"></a> 1.7.5.1</small></address>
</body>
</html>