Wt examples  3.7.1
Functions
ExampleSourceViewer.C File Reference
#include <iostream>
#include <stdlib.h>
#include <algorithm>
#include <Wt/WApplication>
#include <Wt/WContainerWidget>
#include <Wt/WEnvironment>
#include <Wt/WLineEdit>
#include <Wt/WGridLayout>
#include <Wt/WHBoxLayout>
#include <Wt/WPushButton>
#include <Wt/WTable>
#include <Wt/WText>
#include <Wt/WTreeView>
#include <Wt/WVBoxLayout>
#include <Wt/WViewWidget>
#include <boost/filesystem/operations.hpp>
#include <boost/filesystem/exception.hpp>
#include <boost/filesystem/convenience.hpp>
#include <boost/algorithm/string.hpp>
#include "ExampleSourceViewer.h"
#include "FileItem.h"

Go to the source code of this file.

Functions

static std::string filename (const fs::path &p)
 
static std::string stem (const fs::path &p)
 
fs::path parent_path (const fs::path &p)
 
static bool comparePaths (const fs::path &p1, const fs::path &p2)
 
static fs::path getCompanion (const fs::path &path)
 

Function Documentation

◆ comparePaths()

static bool comparePaths ( const fs::path &  p1,
const fs::path &  p2 
)
static

Definition at line 66 of file ExampleSourceViewer.C.

67 {
68  return filename(p1) > filename(p2);
69 }
static std::string filename(const fs::path &p)

◆ filename()

static std::string filename ( const fs::path &  p)
static

Definition at line 36 of file ExampleSourceViewer.C.

37 {
38 #if BOOST_FILESYSTEM_VERSION < 3
39  return p.empty() ? std::string() : *--p.end();
40 #else
41  return p.empty() ? std::string() : (*--p.end()).string();
42 #endif
43 }

◆ getCompanion()

static fs::path getCompanion ( const fs::path &  path)
static

Definition at line 182 of file ExampleSourceViewer.C.

183 {
184  std::string ext = fs::extension(path);
185 
186  if (ext == ".h")
187  return parent_path(path) / (stem(path) + ".C");
188  else if (ext == ".C" || ext == ".cpp")
189  return parent_path(path) / (stem(path) + ".h");
190  else
191  return fs::path();
192 }
static std::string stem(const fs::path &p)
fs::path parent_path(const fs::path &p)

◆ parent_path()

fs::path parent_path ( const fs::path &  p)

Definition at line 58 of file ExampleSourceViewer.C.

59 {
60  std::string fn = filename(p);
61  std::string path = p.string();
62 
63  return path.substr(0, path.length() - fn.length() - 1);
64 }
static std::string filename(const fs::path &p)

◆ stem()

static std::string stem ( const fs::path &  p)
static

Definition at line 46 of file ExampleSourceViewer.C.

47 {
48  std::string fn = filename(p);
49  std::size_t pos = fn.find('.');
50  if (pos == std::string::npos)
51  return fn;
52  else
53  return fn.substr(0, pos);
54 }
static std::string filename(const fs::path &p)

Generated on Tue Dec 15 2020 for the C++ Web Toolkit (Wt) by doxygen 1.8.13