Wt examples  4.10.4
ExampleSourceViewer.h
Go to the documentation of this file.
1 // This may look like C code, but it's really -*- C++ -*-
2 /*
3  * Copyright (C) 2009 Emweb bv, Herent, Belgium
4  *
5  * See the LICENSE file for terms of use.
6  */
7 
8 #include <iostream>
9 #include <stdlib.h>
10 
11 #include <Wt/WContainerWidget.h>
12 #include <Wt/WTreeView.h>
13 #include <Wt/WStandardItemModel.h>
14 
15 #include "FileItem.h"
16 #include "SourceView.h"
17 
18 using namespace Wt;
19 
24 {
25 public:
28  ExampleSourceViewer(const std::string& deployPath,
29  const std::string& examplesRoot,
30  const std::string& examplesType);
31 
32 private:
35 
36  std::string deployPath_;
37  std::string examplesRoot_;
38  std::string examplesType_;
39 
40  std::shared_ptr<WStandardItemModel> model_;
41 
42  void cppTraverseDir(WStandardItem* parent,
43  const boost::filesystem::path& path);
44  void javaTraverseDir(WStandardItem* parent,
45  const boost::filesystem::path& path);
46  void javaTraversePackages(WStandardItem *parent,
47  const boost::filesystem::path& srcPath,
48  const std::string packageName);
49 
52  void showFile();
53 
54  void handlePathChange();
55 
56  void setExample(const std::string& exampleDir,
57  const std::string& example);
58 };
A simple widget to visualise a set of example source files.
std::shared_ptr< WStandardItemModel > model_
View class for source code.
Definition: SourceView.h:29