This file is indexed.

/usr/lib/Wt/examples/widgetgallery/TopicWidget.C is in witty-examples 3.3.0-1build1.

This file is owned by root:root, with mode 0o644.

The actual contents of the file can be viewed below.

  1
  2
  3
  4
  5
  6
  7
  8
  9
 10
 11
 12
 13
 14
 15
 16
 17
 18
 19
 20
 21
 22
 23
 24
 25
 26
 27
 28
 29
 30
 31
 32
 33
 34
 35
 36
 37
 38
 39
 40
 41
 42
 43
 44
 45
 46
 47
 48
 49
 50
 51
 52
 53
 54
 55
 56
 57
 58
 59
 60
 61
 62
 63
 64
 65
 66
 67
 68
 69
 70
 71
 72
 73
 74
 75
 76
 77
 78
 79
 80
 81
 82
 83
 84
 85
 86
 87
 88
 89
 90
 91
 92
 93
 94
 95
 96
 97
 98
 99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
/*
 * Copyright (C) 2008 Emweb bvba
 *
 * See the LICENSE file for terms of use.
 */

#include "TopicWidget.h"

#include <Wt/WText>

#include <sstream>
#include <boost/algorithm/string.hpp>

namespace {

int countSpaces(const std::string& line) {
  for (unsigned int pos=0; pos<line.length(); ++pos) {
    if (line[pos] != ' ')
      return pos;
  }
  return line.length();
}

std::string skipSpaces(const std::string& line, unsigned int count) {
  if (line.length() >= count)
    return line.substr(count);
  else
    return std::string();
}

}

TopicWidget::TopicWidget()
  : Wt::WContainerWidget()
{ }

void TopicWidget::populateSubMenu(Wt::WMenu *menu)
{
  
}

std::string TopicWidget::escape(const std::string &name) const
{
  std::stringstream ss;
  for(unsigned int i = 0; i < name.size(); ++i) {
    if (name[i] != ':') {
      ss << name[i];
    } else {
      ss << "_1";
    }
  }
  return ss.str();
}

std::string TopicWidget::docAnchor(const std::string &classname) const
{
  std::stringstream ss;

#if !defined(WT_TARGET_JAVA)
  ss << "<a href=\"http://www.webtoolkit.eu/wt/doc/reference/html/class"
     << escape("Wt::" + classname)
     << ".html\" target=\"_blank\">doc</a>";
#else
  std::string cn = boost::replace_all(classname, "Chart::","chart/");
  ss << "<a href=\"http://www.webtoolkit.eu/"
     << "jwt/latest/doc/javadoc/eu/webtoolkit/jwt/"
     << classname
     << ".html\" target=\"_blank\">doc</a>";
#endif

  return ss.str();
}

Wt::WText *TopicWidget::addText(const Wt::WString& s,
				Wt::WContainerWidget *parent)
{
  Wt::WText *text = new Wt::WText(s, parent);
  bool literal;
#ifndef WT_TARGET_JAVA
  literal = s.literal();
#else
  literal = Wt::WString(s).literal();
#endif
  if (!literal)
    text->setInternalPathEncoding(true);
  return text;
}

Wt::WString TopicWidget::reindent(const Wt::WString& text)
{
  std::vector<std::string> lines;
  std::string s = text.toUTF8();
  boost::split(lines, s, boost::is_any_of("\n"));

  std::string result;
  int indent = -1;
  int newlines = 0;
  for (unsigned i = 0; i < lines.size(); ++i) {
    const std::string& line = lines[i];

    if (line.empty()) {
      ++newlines;
    } else {
      if (indent == -1) {
        indent = countSpaces(line);
      } else {
        for (int j = 0; j < newlines; ++j)
          result += '\n';
      }

      newlines = 0;

      if (!result.empty())
        result += '\n';

      result += skipSpaces(line, indent);
    }
  }
  return Wt::WString::fromUTF8(result);
}