Pyrogenesis HEAD
Pyrogenesis, a RTS Engine
Stats.h
Go to the documentation of this file.
1/* Copyright (C) 2026 Wildfire Games.
2 * This file is part of 0 A.D.
3 *
4 * 0 A.D. is free software: you can redistribute it and/or modify
5 * it under the terms of the GNU General Public License as published by
6 * the Free Software Foundation, either version 2 of the License, or
7 * (at your option) any later version.
8 *
9 * 0 A.D. is distributed in the hope that it will be useful,
10 * but WITHOUT ANY WARRANTY; without even the implied warranty of
11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 * GNU General Public License for more details.
13 *
14 * You should have received a copy of the GNU General Public License
15 * along with 0 A.D. If not, see <http://www.gnu.org/licenses/>.
16 */
17
18#ifndef INCLUDED_SCRIPT_STATS
19#define INCLUDED_SCRIPT_STATS
20
21#include "lib/code_annotation.h"
22#include "ps/CStr.h"
23#include "ps/ProfileViewer.h"
24
25#include <cstddef>
26#include <string>
27#include <utility>
28#include <vector>
29
30namespace Script { class Interface; }
31
32namespace Script {
33
35{
37public:
39
40 void Add(const Interface* scriptInterface, const std::string& title);
41 void Remove(const Interface* scriptInterface);
42
43 CStr GetName() override;
44 CStr GetTitle() override;
45 size_t GetNumberRows() override;
46 const std::vector<ProfileColumn>& GetColumns() override;
47 CStr GetCellText(size_t row, size_t col) override;
48 AbstractProfileTable* GetChild(size_t row) override;
49
50private:
51 std::vector<std::pair<const Interface*, std::string> > m_ScriptInterfaces;
52 std::vector<ProfileColumn> m_ColumnDescriptions;
53};
54
55}
56
57// To simplify the UI we want to use a single table for all script interfaces,
58// so just make it a global that they can all add themselves to
60
61#endif // INCLUDED_SCRIPT_STATS
Script::CScriptStatsTable * g_ScriptStatsTable
Definition: Stats.cpp:27
Class AbstractProfileTable: Profile table data model.
Definition: ProfileViewer.h:62
Definition: Stats.h:35
size_t GetNumberRows() override
GetNumberRows.
Definition: Stats.cpp:70
AbstractProfileTable * GetChild(size_t row) override
GetChild: Return a row's child table if the child is expandable.
Definition: Stats.cpp:114
void Add(const Interface *scriptInterface, const std::string &title)
Definition: Stats.cpp:44
CScriptStatsTable()
Definition: Stats.cpp:40
std::vector< std::pair< const Interface *, std::string > > m_ScriptInterfaces
Definition: Stats.h:51
CStr GetCellText(size_t row, size_t col) override
GetCellText.
Definition: Stats.cpp:84
NONCOPYABLE(CScriptStatsTable)
void Remove(const Interface *scriptInterface)
Definition: Stats.cpp:49
std::vector< ProfileColumn > m_ColumnDescriptions
Definition: Stats.h:52
CStr GetTitle() override
GetTitle: Longer, explanatory text (can be dynamic).
Definition: Stats.cpp:65
CStr GetName() override
GetName: Short descriptive name of this table (should be static).
Definition: Stats.cpp:60
const std::vector< ProfileColumn > & GetColumns() override
GetColumnDescriptions.
Definition: Stats.cpp:75
Definition: Interface.h:93
Abstraction around a SpiderMonkey JSContext.
Definition: DapInterface.h:32