Skip to content

Commit 330ba3c

Browse files
update comment functions across codebase to be description functions
1 parent f08c671 commit 330ba3c

14 files changed

Lines changed: 41 additions & 41 deletions

File tree

src/games/agg/agg.cc

Lines changed: 15 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -116,14 +116,14 @@ AGG::AGG(int numPlayers, std::vector<int> &_actions, int numANodes, int _numPNod
116116

117117
namespace {
118118

119-
void stripComment(istream &in)
119+
void stripDescription(istream &in)
120120
{
121121
in >> ws;
122122
const char c = in.peek();
123123
stringbuf discard(ios_base::out);
124124
if (c == AGG::COMMENT_CHAR) {
125125
in.get(discard);
126-
stripComment(in);
126+
stripDescription(in);
127127
}
128128
}
129129

@@ -137,22 +137,22 @@ std::shared_ptr<AGG> AGG::makeAGG(istream &in)
137137
if (!in.good() || in.eof()) {
138138
throw std::runtime_error("Bad game file");
139139
}
140-
stripComment(in);
140+
stripDescription(in);
141141
in >> n;
142142
if (!in.good()) {
143143
throw std::runtime_error("Error reading the number of players");
144144
}
145-
stripComment(in);
145+
stripDescription(in);
146146
in >> S;
147147
if (!in.good()) {
148148
throw std::runtime_error("Error reading the number of action nodes");
149149
}
150-
stripComment(in);
150+
stripDescription(in);
151151
in >> P;
152152
if (!in.good()) {
153153
throw std::runtime_error("Error reading the number of function nodes");
154154
}
155-
stripComment(in);
155+
stripDescription(in);
156156

157157
// enter sizes of action sets:
158158
std::vector<int> size(n);
@@ -165,10 +165,10 @@ std::shared_ptr<AGG> AGG::makeAGG(istream &in)
165165
}
166166
}
167167

168-
stripComment(in);
168+
stripDescription(in);
169169
vector<vector<int>> ASets(n); // action sets
170170
for (i = 0; i < n; i++) {
171-
stripComment(in);
171+
stripDescription(in);
172172
for (j = 0; j < size[i]; j++) {
173173
int aindex;
174174
in >> aindex;
@@ -181,10 +181,10 @@ std::shared_ptr<AGG> AGG::makeAGG(istream &in)
181181
}
182182
}
183183

184-
stripComment(in);
184+
stripDescription(in);
185185
vector<vector<int>> neighb(S + P); // neighbor lists
186186
for (i = 0; i < S + P; i++) {
187-
stripComment(in);
187+
stripDescription(in);
188188
in >> neighb_size;
189189
if (in.eof() || in.fail()) {
190190
throw std::runtime_error(
@@ -202,12 +202,12 @@ std::shared_ptr<AGG> AGG::makeAGG(istream &in)
202202
}
203203
}
204204

205-
stripComment(in);
205+
stripDescription(in);
206206
// enter the projection types:
207207
vector<projtype> projTypes(P);
208208
for (i = 0; i < P; ++i) {
209209
int pt;
210-
stripComment(in);
210+
stripDescription(in);
211211
in >> pt;
212212
if (in.eof() || in.fail()) {
213213
throw std::runtime_error("Error in game file: expected integer for type of function node #" +
@@ -259,13 +259,13 @@ std::shared_ptr<AGG> AGG::makeAGG(istream &in)
259259
}
260260
}
261261

262-
stripComment(in);
262+
stripDescription(in);
263263
// read in payoffs
264264
for (i = 0; i < S; i++) {
265265
if (in.eof() || in.bad()) {
266266
throw std::runtime_error("Error in game file: not enough payoffs");
267267
}
268-
stripComment(in);
268+
stripDescription(in);
269269
int t;
270270
in >> t;
271271
if (!in.good()) {
@@ -807,7 +807,7 @@ void AGG::makeMAPPINGpayoff(std::istream &in, aggpayoff &pay, int numNei)
807807
temp = pay;
808808
pay.clear();
809809

810-
stripComment(in);
810+
stripDescription(in);
811811
in >> num;
812812
if (!in.good()) {
813813
throw std::runtime_error("Error reading the integer number of configuration-value pairs");

src/games/agg/bagg.cc

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -48,7 +48,7 @@ BAGG::BAGG(int N, int S, vector<int> &numTypes, vector<ProbDist> &TDist,
4848

4949
namespace {
5050

51-
void stripComment(istream &in)
51+
void stripDescription(istream &in)
5252
{
5353
const char COMMENT_CHAR = '#';
5454

@@ -57,7 +57,7 @@ void stripComment(istream &in)
5757
stringbuf discard(ios_base::out);
5858
if (c == COMMENT_CHAR) {
5959
in.get(discard);
60-
stripComment(in);
60+
stripDescription(in);
6161
}
6262
}
6363

@@ -67,14 +67,14 @@ std::shared_ptr<BAGG> BAGG::makeBAGG(istream &in)
6767
{
6868
int N, S, P;
6969

70-
stripComment(in);
70+
stripDescription(in);
7171
in >> N;
72-
stripComment(in);
72+
stripDescription(in);
7373
in >> S;
74-
stripComment(in);
74+
stripDescription(in);
7575
in >> P;
7676

77-
stripComment(in);
77+
stripDescription(in);
7878
vector<int> numTypes(N);
7979

8080
// input number of types for each player
@@ -88,7 +88,7 @@ std::shared_ptr<BAGG> BAGG::makeBAGG(istream &in)
8888
}
8989

9090
// input the type distributions
91-
stripComment(in);
91+
stripDescription(in);
9292
vector<ProbDist> TDist;
9393
for (int i = 0; i < N; ++i) {
9494
TDist.emplace_back(numTypes[i]);
@@ -100,7 +100,7 @@ std::shared_ptr<BAGG> BAGG::makeBAGG(istream &in)
100100
}
101101
}
102102

103-
stripComment(in);
103+
stripDescription(in);
104104
// sizes of type action sets
105105
vector<vector<vector<int>>> typeActionSets(N);
106106
for (int i = 0; i < N; ++i) {
@@ -116,7 +116,7 @@ std::shared_ptr<BAGG> BAGG::makeBAGG(istream &in)
116116
}
117117

118118
// type action sets
119-
stripComment(in);
119+
stripDescription(in);
120120
for (int i = 0; i < N; ++i) {
121121
for (int j = 0; j < numTypes[i]; ++j) {
122122
for (int &el : typeActionSets[i][j]) {
@@ -127,7 +127,7 @@ std::shared_ptr<BAGG> BAGG::makeBAGG(istream &in)
127127
}
128128
}
129129
}
130-
stripComment(in);
130+
stripDescription(in);
131131

132132
// action sets
133133
vector<vector<int>> aggActionSets;

src/games/file.cc

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -440,7 +440,7 @@ Game BuildNfg(GameFileLexer &p_parser, TableFileGame &p_data)
440440
// If this looks lke an outcome-based format, then don't create outcomes in advance
441441
Game nfg = NewTable(p_data.NumStrategies(), p_parser.GetCurrentToken() == TOKEN_LBRACE);
442442
nfg->SetTitle(p_data.m_title);
443-
nfg->SetComment(p_data.m_comment);
443+
nfg->SetDescription(p_data.m_comment);
444444

445445
for (auto player : nfg->GetPlayers()) {
446446
player->SetLabel(p_data.GetPlayer(player->GetNumber()));
@@ -865,7 +865,7 @@ Game ReadEfgFile(std::istream &p_stream, bool p_normalizeLabels /* = false */)
865865
ReadPlayers(parser, game, treeData);
866866
if (parser.GetNextToken() == TOKEN_TEXT) {
867867
// Read optional comment
868-
game->SetComment(parser.GetLastText());
868+
game->SetDescription(parser.GetLastText());
869869
parser.GetNextToken();
870870
}
871871
ParseNode(parser, game, game->GetRoot(), treeData);

src/games/game.cc

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -229,7 +229,7 @@ void GameRep::WriteNfgFile(std::ostream &p_file) const
229229
}) << std::endl;
230230
}
231231
p_file << "}" << std::endl;
232-
p_file << std::quoted(GetComment()) << std::endl << std::endl;
232+
p_file << std::quoted(GetDescription()) << std::endl << std::endl;
233233

234234
for (auto iter : StrategyContingencies(
235235
StrategySupportProfile(std::const_pointer_cast<GameRep>(shared_from_this())))) {

src/games/game.h

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -888,9 +888,9 @@ class GameRep : public std::enable_shared_from_this<GameRep> {
888888
virtual void SetTitle(const std::string &p_title) { m_title = p_title; }
889889

890890
/// Get the text comment associated with the game
891-
virtual const std::string &GetComment() const { return m_comment; }
891+
virtual const std::string &GetDescription() const { return m_comment; }
892892
/// Set the text comment associated with the game
893-
virtual void SetComment(const std::string &p_comment) { m_comment = p_comment; }
893+
virtual void SetDescription(const std::string &p_comment) { m_comment = p_comment; }
894894

895895
/// Return the version number of the game. The version is incremented after each
896896
/// substantive change to the game (i.e. not merely involving labels)

src/games/gametable.cc

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -469,7 +469,7 @@ void GameTableRep::WriteNfgFile(std::ostream &p_file) const
469469
}) << std::endl;
470470
}
471471
p_file << "}" << std::endl;
472-
p_file << std::quoted(GetComment()) << std::endl << std::endl;
472+
p_file << std::quoted(GetDescription()) << std::endl << std::endl;
473473

474474
p_file << "{" << std::endl;
475475
for (auto outcome : m_outcomes) {

src/games/gametree.cc

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1196,7 +1196,7 @@ void GameTreeRep::WriteEfgFile(std::ostream &p_file, const GameNode &p_subtree /
11961196
<< FormatList(GetPlayers(),
11971197
[](const GamePlayer &p) { return QuoteString(p->GetLabel()); })
11981198
<< std::endl;
1199-
p_file << std::quoted(GetComment()) << std::endl << std::endl;
1199+
p_file << std::quoted(GetDescription()) << std::endl << std::endl;
12001200
Gambit::WriteEfgFile(p_file, (p_subtree) ? p_subtree : GetRoot());
12011201
}
12021202

src/games/stratspt.cc

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -100,7 +100,7 @@ void StrategySupportProfile::WriteNfgFile(std::ostream &p_file) const
100100
}) << std::endl;
101101
}
102102
p_file << "}" << std::endl;
103-
p_file << std::quoted(m_game->GetComment()) << std::endl << std::endl;
103+
p_file << std::quoted(m_game->GetDescription()) << std::endl << std::endl;
104104

105105
for (const auto &iter : StrategyContingencies(*this)) {
106106
p_file << FormatList(

src/gui/dlgameprop.cc

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -51,7 +51,7 @@ GamePropertiesDialog::GamePropertiesDialog(wxWindow *p_parent, GameDocument *p_d
5151
commentSizer->Add(new wxStaticText(this, wxID_STATIC, _("Comment")), 0, wxALL | wxALIGN_CENTER,
5252
5);
5353
m_comment = new wxTextCtrl(this, wxID_ANY,
54-
wxString(m_doc->GetGame()->GetComment().c_str(), *wxConvCurrent),
54+
wxString(m_doc->GetGame()->GetDescription().c_str(), *wxConvCurrent),
5555
wxDefaultPosition, wxSize(400, -1), wxTE_MULTILINE);
5656
commentSizer->Add(m_comment, 1, wxALL | wxALIGN_CENTER, 5);
5757
topSizer->Add(commentSizer, 1, wxALL | wxEXPAND, 0);

src/gui/dlgameprop.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@ class GamePropertiesDialog final : public wxDialog {
3434

3535
// Data access (only valid when ShowModal() returns with wxID_OK)
3636
wxString GetTitle() const override { return m_title->GetValue(); }
37-
wxString GetComment() const { return m_comment->GetValue(); }
37+
wxString GetDescription() const { return m_comment->GetValue(); }
3838
};
3939

4040
} // namespace Gambit::GUI

0 commit comments

Comments
 (0)