Skip to content

Commit

Permalink
Simplify districts : formatting
Browse files Browse the repository at this point in the history
  • Loading branch information
guilpier-code committed Jul 23, 2024
1 parent faf1d72 commit c3a2cb5
Show file tree
Hide file tree
Showing 2 changed files with 43 additions and 44 deletions.
82 changes: 41 additions & 41 deletions src/libs/antares/study/area/sets.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -134,54 +134,54 @@ void Sets::rebuildFromRules(const IDType& id, SetHandlerAreas& handler)
const Yuni::String& arg = *(rule.second);
switch (rule.first) // type
{
case ruleAdd:
case ruleAdd:
{
// Trying to add a single item
if (!handler.add(set, arg))
{
// Trying to add a single item
if (!handler.add(set, arg))
// Failed. Maybe the argument references another group
const IDType other = arg;
typename MapType::iterator i = pMap.find(other);
if (i != pMap.end())
{
// Failed. Maybe the argument references another group
const IDType other = arg;
typename MapType::iterator i = pMap.find(other);
if (i != pMap.end())
if (handler.add(set, *(i->second)))
{
if (handler.add(set, *(i->second)))
{
break;
}
break;
}
}
break;
}
case ruleRemove:
break;
}
case ruleRemove:
{
// Trying to remove a single item
if (!handler.remove(set, arg))
{
// Trying to remove a single item
if (!handler.remove(set, arg))
// Failed. Maybe the argument references another group
const IDType other = arg;
typename MapType::iterator i = pMap.find(other);
if (i != pMap.end())
{
// Failed. Maybe the argument references another group
const IDType other = arg;
typename MapType::iterator i = pMap.find(other);
if (i != pMap.end())
if (handler.remove(set, *(i->second)))
{
if (handler.remove(set, *(i->second)))
{
break;
}
break;
}
}
break;
}
case ruleFilter:
{
handler.applyFilter(set, arg);
break;
}
case ruleNone:
case ruleMax:
{
// Huh ??
assert(false && "Should not be here !");
break;
}
break;
}
case ruleFilter:
{
handler.applyFilter(set, arg);
break;
}
case ruleNone:
case ruleMax:
{
// Huh ??
assert(false && "Should not be here !");
break;
}
}
}
// Retrieving the size of the result set
Expand All @@ -190,7 +190,7 @@ void Sets::rebuildFromRules(const IDType& id, SetHandlerAreas& handler)
<< " rules, got " << opts.resultSize << " items";
}

bool Sets::saveToFile(const Yuni::String &filename) const
bool Sets::saveToFile(const Yuni::String& filename) const
{
Yuni::IO::File::Stream file;
if (!file.open(filename, Yuni::IO::OpenMode::write | Yuni::IO::OpenMode::truncate))
Expand Down Expand Up @@ -395,8 +395,8 @@ void Sets::dumpToLogs() const
for (typename MapType::const_iterator i = pMap.begin(); i != end; ++i)
{
logs.info() << " found `" << i->first << "` (" << (uint)i->second->size() << ' '
<< (i->second->size() < 2 ? "item" : "items")
<< ((!hasOutput(i->first)) ? ", no output" : "") << ')';
<< (i->second->size() < 2 ? "item" : "items")
<< ((!hasOutput(i->first)) ? ", no output" : "") << ')';
}
}

Expand All @@ -406,7 +406,7 @@ uint Sets::size() const
}

SetHandlerAreas::SetHandlerAreas(AreaList& areas):
areas_(areas)
areas_(areas)
{
}

Expand Down Expand Up @@ -488,4 +488,4 @@ bool SetHandlerAreas::applyFilter(Sets::SetAreasType& set, const Yuni::String& v
return false;
}

} // namespace Antares::Data
} // namespace Antares::Data
5 changes: 2 additions & 3 deletions src/libs/antares/study/include/antares/study/sets.h
Original file line number Diff line number Diff line change
Expand Up @@ -199,7 +199,7 @@ class Sets final
/*!
** \brief Get if the results for a given group should be written to the output
*/
bool hasOutput(const Yuni::ShortString128& s) const;
bool hasOutput(const Yuni::ShortString128& s) const;

/*!
** \brief Get if the results for a given group should be written to the output
Expand All @@ -209,7 +209,7 @@ class Sets final
/*!
** \brief Get the size of a result set
*/
uint resultSize(const Yuni::ShortString128& s) const;
uint resultSize(const Yuni::ShortString128& s) const;

/*!
** \brief Get the size of a result set
Expand Down Expand Up @@ -285,4 +285,3 @@ class SetHandlerAreas
}; // class SetHandlerAreas

} // namespace Antares::Data

0 comments on commit c3a2cb5

Please sign in to comment.