Wt examples  3.2.2
Functions
/home/koen/project/wt/public-git/wt/examples/wt-homepage/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

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

Definition at line 66 of file ExampleSourceViewer.C.

{
  return filename(p1) > filename(p2);
}
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 180 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);
}

Generated on Fri Jul 27 2012 for the C++ Web Toolkit (Wt) by doxygen 1.7.5.1