Skip to content

Commit

Permalink
Constraint export: short type names #232
Browse files Browse the repository at this point in the history
  • Loading branch information
glebbelov committed Feb 29, 2024
1 parent 02cd31a commit 5c343d5
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion include/mp/flat/constr_keeper.h
Original file line number Diff line number Diff line change
Expand Up @@ -540,13 +540,15 @@ const char*
BasicConstraintKeeper::GetShortTypeName() const {
if (type_name_short_.empty()) {
std::string acc_opt = GetAcceptanceOptionNames();
assert(acc_opt.size());
auto word_end = std::min(acc_opt.find(' '),
acc_opt.size());
auto colon_pos = acc_opt.find(':');
if (colon_pos>word_end)
colon_pos = 0;
type_name_short_ = acc_opt.substr(
colon_pos, word_end-colon_pos);
assert(type_name_short_.size());
}
return type_name_short_.c_str();
}
Expand Down Expand Up @@ -878,7 +880,7 @@ class ConstraintKeeper final
fmt::MemoryWriter wrt;
{
MiniJSONWriter jw(wrt);
jw["con_type"] = cnt.con_.GetTypeName();
jw["con_type"] = GetShortTypeName();
jw["index"] = i_con;
jw["depth"] = cnt.GetDepth();
// wrt.write("\"data\": ");
Expand Down

0 comments on commit 5c343d5

Please sign in to comment.