This file is indexed.

/usr/lib/Wt/examples/hangman/HangmanGame.C is in witty-examples 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
/*
 * Copyright (C) 2005 Wim Dumon
 *
 * See the LICENSE file for terms of use.
 */

#include <Wt/WText>
#include <Wt/WTable>
#include <Wt/WTableCell>
#include <Wt/WStackedWidget>
#include <Wt/WCssDecorationStyle>

#include "HangmanGame.h"
#include "LoginWidget.h"
#include "HangmanWidget.h"
#include "HighScoresWidget.h"

HangmanGame::HangmanGame(WContainerWidget *parent):
   WTable(parent)
{
   resize(WLength(100, WLength::Percentage), WLength::Auto);

   WText *title = new WText(L"A Witty game: Hangman", elementAt(0,0));
   title->decorationStyle().font().setSize(WFont::XXLarge);

   // Center the title horizontally.
   elementAt(0, 0)->setContentAlignment(AlignTop | AlignCenter);

   // Element (1,1) holds a stack of widgets with the main content.
   // This is where we switch between Login, Game, and Highscores widgets.
   MainStack = new WStackedWidget(elementAt(1, 0));
   MainStack->setPadding(20);

   MainStack->addWidget(Login = new LoginWidget());
   Login->loginSuccessful.connect(this, &HangmanGame::play);

   // Element (2,0) contains navigation buttons. Instead of WButton,
   // we use WText. WText inherits from WInteractWidget, and thus exposes
   // the click event.
   BackToGameText = new WText(L" Gaming Grounds ", elementAt(2, 0));
   BackToGameText->decorationStyle().setCursor(PointingHandCursor);
   BackToGameText->clicked().connect(this, &HangmanGame::showGame);

   ScoresText = new WText(L" Highscores ", elementAt(2, 0));
   ScoresText->decorationStyle().setCursor(PointingHandCursor);
   ScoresText->clicked().connect(this, &HangmanGame::showHighScores);
   // Center the buttons horizontally.
   elementAt(2, 0)->setContentAlignment(AlignTop | AlignCenter);

   doLogin();
}

void HangmanGame::doLogin()
{
   MainStack->setCurrentWidget(Login);
   BackToGameText->hide();
   ScoresText->hide();
}

void HangmanGame::play(std::wstring user, Dictionary dict)
{
   // Add a widget by passing MainStack as the parent, ...
   Game = new HangmanWidget(user, dict, MainStack);
   // ... or using addWidget
   MainStack->addWidget(Scores = new HighScoresWidget(user));

   BackToGameText->show();
   ScoresText->show();

   showGame();
}

void HangmanGame::showHighScores()
{
   MainStack->setCurrentWidget(Scores);
   Scores->update();
   BackToGameText->decorationStyle().font().setWeight(WFont::NormalWeight);
   ScoresText->decorationStyle().font().setWeight(WFont::Bold);
}

void HangmanGame::showGame()
{
   MainStack->setCurrentWidget(Game);
   BackToGameText->decorationStyle().font().setWeight(WFont::Bold);
   ScoresText->decorationStyle().font().setWeight(WFont::NormalWeight);
}