| Wt examples
    3.3.0
    | 
#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) | 
| static bool comparePaths | ( | const fs::path & | p1, | 
| const fs::path & | p2 | ||
| ) |  [static] | 
Definition at line 66 of file ExampleSourceViewer.C.
| static std::string filename | ( | const fs::path & | p | ) |  [static] | 
Definition at line 36 of file ExampleSourceViewer.C.
{
#if BOOST_FILESYSTEM_VERSION < 3
  return p.empty() ? std::string() : *--p.end();
#else
  return p.empty() ? std::string() : (*--p.end()).string();
#endif
}
| static fs::path getCompanion | ( | const fs::path & | path | ) |  [static] | 
Definition at line 182 of file ExampleSourceViewer.C.
{
  std::string ext = fs::extension(path);
  if (ext == ".h")
    return parent_path(path) / (stem(path) + ".C");
  else if (ext == ".C" || ext == ".cpp")
    return parent_path(path) / (stem(path) + ".h");
  else
    return fs::path();
}
| fs::path parent_path | ( | const fs::path & | p | ) | 
Definition at line 58 of file ExampleSourceViewer.C.
{
  std::string fn = filename(p);
  std::string path = p.string();
  return path.substr(0, path.length() - fn.length() - 1);
}
| static std::string stem | ( | const fs::path & | p | ) |  [static] | 
Definition at line 46 of file ExampleSourceViewer.C.
{
  std::string fn = filename(p);
  std::size_t pos = fn.find('.');
  if (pos == std::string::npos)
    return fn;
  else
    return fn.substr(0, pos);
}
 1.7.5.1
 1.7.5.1