This file is indexed.

/usr/include/Wt/WText is in libwt-dev 3.1.10-1ubuntu2.

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
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
// This may look like C code, but it's really -*- C++ -*-
/*
 * Copyright (C) 2008 Emweb bvba, Kessel-Lo, Belgium.
 *
 * See the LICENSE file for terms of use.
 */
#ifndef WTEXT_H_
#define WTEXT_H_

#include <Wt/WInteractWidget>
#include <Wt/WString>

namespace Wt {

/*! \class WText Wt/WText Wt/WText
 *  \brief A widget that renders (XHTML) text.
 *
 * The text is provided through a WString, which may either hold a
 * literal text, or a key to localized text which is looked up in
 * locale dependent XML files (see WString::tr()).
 *
 * Use setTextFormat() to configure the textFormat of the text. The
 * default textFormat is Wt::XHTMLText, which allows XHMTL markup to
 * be included in the text. Tags and attributes that indicate "active"
 * content are not allowed and stripped out, to avoid security risks
 * exposed by JavaScript such as the common web-based <a
 * href="http://en.wikipedia.org/wiki/Cross_site_scriptingCross-Site">
 * Cross-Site Scripting (XSS)</a> malicious attack. XSS is the
 * situation where one user of your web application is able to execute
 * a script in another user's browser while your application only
 * intended to display a message entered by the mailicious user to the
 * other user. To defeat this attack, %Wt assumes that content in a
 * %WText is intended to be passive, and not contain any scripting
 * elements.
 *
 * The Wt::PlainText format will display the text literally
 * (escaping any HTML special characters).
 *
 * In some situations, Wt::XHTMLUnsafeText may be useful to explicitly
 * allow scripting content. Like XHTMLText, it allows XHTML markup,
 * but it also allows potentially dangerous tags and attributes. Use
 * this if you're sure that a user cannot interfere with the text set,
 * and XHTMLText is too limiting.
 *
 * %WText is by default \link WWidget::setInline()
 * inline\endlink, unless the XHTML contents starts with an
 * element such as <tt>&lt;div&gt;</tt>, <tt>&lt;h&gt;</tt> or
 * <tt>&lt;p&gt;</tt> that is displayed as a block, in which case the
 * widget will also display as a block.
 *
 * \if cpp
 * Usage examples:
 * \code
 * Wt::WContainerWidget *container = new Wt::WContainerWidget();
 *
 * // display an XHTML text:
 * container->addWidget(new Wt::WText("Hello <i>dear</i> visitor."));
 *
 * // display a plain text:
 * container->addWidget(new Wt::WText("The <i> tag displays italic text.", Wt::PlainText));
 *
 * // display an XHTML fragment from a resource bundle:
 * container->addWidget(new Wt::WText(tr("introduction")));
 * \endcode
 * \endif
 *
 * <h3>CSS</h3>
 *
 * The widget corresponds to an HTML <tt>&lt;span&gt;</tt> tag or an
 * HTML <tt>&lt;div&gt;</tt> depending on whether the widget is inline.
 *
 * This widget does not provide styling, 
 * and can be styled using inline or external CSS as appropriate.
 *
 * \sa WApplication::setLocale()
 * \if cpp
 * \sa WApplication::messageResourceBundle()
 * \endif
 */
class WT_API WText : public WInteractWidget
{
public:
  /*! \brief Creates a text widget with an empty text.
   */
  WText(WContainerWidget *parent = 0);

  /*! \brief Creates a text widget with given text.
   *
   * The textFormat is set to Wt::XHTMLText, unless the \p text is
   * literal (not created using WString::tr()) and it could not be
   * parsed as valid XML. In that case the textFormat is set to
   * Wt::PlainText.
   *
   * Therefore, if you wish to use Wt::XHTMLText, 
   * but cannot be sure about \p text being valid XML, 
   * you should verify that the textFormat() is Wt::XHTMLText
   * after construction.
   *
   * The XML parser will silently discard malicious tags and
   * attributes for literal Wt::XHTMLText text.
   */
  WText(const WString& text, WContainerWidget *parent = 0);

  /*! \brief Creates a text widget with given text and format
   *
   * If <i>textFormat</i> is Wt::XHTMLText and \p text is not
   * literal (not created using WString::tr()), then if the
   * \p text could not be parsed as valid XML, the textFormat is
   * changed to Wt::PlainText.
   *
   * Therefore, if you wish to use Wt::XHTMLText, but cannot be sure
   * about \p text being valid XML, you should verify that the
   * textFormat() is Wt::XHTMLText after construction.
   *
   * The XML parser will silently discard malicious tags and
   * attributes for literal Wt::XHTMLText text.
   */
  WText(const WString& text, TextFormat textFormat,
	WContainerWidget *parent = 0);

  /*! \brief Destructor.
   */
  ~WText();

  /*! \brief Returns the text.
   *
   * When a literal XHTMLFormatted text was set, this may differ from
   * the text that was set since malicious tags/attributes may have
   * been stripped.
   *
   * \sa setText(const WString&)
   */
  const WString& text() const { return text_; }

  /*! \brief Sets the text.
   *
   * When the current format is Wt::XHTMLText, and
   * \p text is literal (not created using WString::tr()), it is
   * parsed using an XML parser which discards malicious tags and
   * attributes silently. When the parser encounters an XML parse
   * error, the textFormat is changed to Wt::PlainText.
   *
   * Returns whether the text could be set using the current
   * textFormat. A return value of \c false indicates that the textFormat
   * was changed in order to be able to accept the new text.
   *
   * \sa text(), setText()
   */
  bool setText(const WString& text);

  /*! \brief Sets the text format.
   *
   * The textFormat controls how the string should be interpreted:
   * either as plain text, which is displayed literally, or as
   * XHTML-markup.
   *
   * When changing the textFormat to Wt::XHTMLText, and the
   * current text is literal (not created using WString::tr()), the
   * current text is parsed using an XML parser which discards
   * malicious tags and attributes silently. When the parser
   * encounters an XML parse error, the textFormat is left unchanged,
   * and this method returns false.
   *
   * Returns whether the textFormat could be set for the current text.
   *
   * The default format is Wt::XHTMLText.
   */
  bool setTextFormat(TextFormat format);

  /*! \brief Returns the text format.
   *
   * \sa setTextFormat()
   */
  TextFormat textFormat() const { return textFormat_; }

  /*! \brief Configures word wrapping.
   *
   * When \p wordWrap is \c true, the widget may break lines, creating a
   * multi-line text. When \p wordWrap is \c false, the text will displayed
   * on a single line, unless the text contains end-of-lines (for
   * Wt::PlainText) or &lt;br /&gt; tags or other block-level tags
   * (for Wt::XHTMLText).
   *
   * The default value is \c true.
   *
   * \sa wordWrap()
   */
  void setWordWrap(bool wordWrap);

  /*! \brief Returns whether the widget may break lines.
   *
   * \sa setWordWrap(bool)
   */
  bool wordWrap() const { return flags_.test(BIT_WORD_WRAP); }

  /*! \brief Sets padding inside the widget
   *
   * Setting padding has the effect of adding distance between the
   * widget children and the border, for a WText padding is only supported
   * on the left and/or right.
   */
  void setPadding(const WLength& padding, WFlags<Side> sides = Left | Right);

  /*! \brief Returns the padding set for the widget.
   *
   * \sa setPadding(const WLength&, WFlags<Side>)
   */
  WLength padding(Side side) const;

  /*! \brief Enables internal path encoding of anchors in the XHTML text.
   *
   * Anchors to internal paths are represented differently depending
   * on the session implementation (plain HTML, Ajax or HTML5
   * history). By enabling this option, anchors which reference an
   * internal path (by referring a URL of the form
   * <tt>href="#/..."</tt>), are re-encoded to link to the internal
   * path.
   *
   * When using Wt::XHTMLText (or Wt::XHTMLUnsafeText) formatted text,
   * the text is pasted verbatim in the browser (with the exception of
   * XSS filtering if applicable). With this option, however, the
   * XHTML text may be transformed at the cost of an additional XML
   * parsing step.
   *
   * The default value is \c false.
   *
   * \sa WAnchor::setInternalPath()
   */
  void setInternalPathEncoding(bool enabled);

  /*! \brief Returns whether internal paths are encoded.
   *
   * \sa setInternalPathEncoding()
   */
  bool hasInternalPathEncoding() const
    { return flags_.test(BIT_ENCODE_INTERNAL_PATHS); }

  virtual void refresh();

private:
  WString      text_;
  TextFormat   textFormat_;

  static const int BIT_WORD_WRAP = 0;
  static const int BIT_TEXT_CHANGED = 1;
  static const int BIT_WORD_WRAP_CHANGED = 2;
  static const int BIT_PADDINGS_CHANGED = 3;
  static const int BIT_ENCODE_INTERNAL_PATHS = 4;

  std::bitset<5> flags_;

  bool        checkWellFormed();
  std::string formattedText() const;
  void        autoAdjustInline();

  WLength     *WT_ARRAY padding_;

protected:
  virtual void           render(WFlags<RenderFlag> flags);
  virtual void           updateDom(DomElement& element, bool all);
  virtual DomElementType domElementType() const;
  virtual void           propagateRenderOk(bool deep);

  friend class WLabel;
};

}

#endif // WTEXT_H_