Wt examples  4.12.0
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 <Wt/cpp17/filesystem.hpp>
16 
17 #include "FileItem.h"
18 #include "SourceView.h"
19 
20 using namespace Wt;
21 
26 {
27 public:
30  ExampleSourceViewer(const std::string& deployPath,
31  const std::string& examplesRoot,
32  const std::string& examplesType);
33 
34 private:
37 
38  std::string deployPath_;
39  std::string examplesRoot_;
40  std::string examplesType_;
41 
42  std::shared_ptr<WStandardItemModel> model_;
43 
44  void cppTraverseDir(WStandardItem* parent,
45  const cpp17::filesystem::path& path);
46  void javaTraverseDir(WStandardItem* parent,
47  const cpp17::filesystem::path& path);
48  void javaTraversePackages(WStandardItem *parent,
49  const cpp17::filesystem::path& srcPath,
50  const std::string packageName);
51 
54  void showFile();
55 
56  void handlePathChange();
57 
58  void setExample(const std::string& exampleDir,
59  const std::string& example);
60 };
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