mirror of
https://github.com/ethereum/solidity
synced 2023-10-03 13:03:40 +00:00
CommandLineParser: operator << for CompilerOutputs and CombinedJsonRequests
This commit is contained in:
parent
4b394f0b35
commit
8a7695784c
@ -176,6 +176,16 @@ bool CompilerOutputs::operator==(CompilerOutputs const& _other) const noexcept
|
||||
return true;
|
||||
}
|
||||
|
||||
ostream& operator<<(ostream& _out, CompilerOutputs const& _selection)
|
||||
{
|
||||
vector<string> serializedSelection;
|
||||
for (auto&& [componentName, component]: CompilerOutputs::componentMap())
|
||||
if (_selection.*component)
|
||||
serializedSelection.push_back(CompilerOutputs::componentName(component));
|
||||
|
||||
return _out << joinHumanReadable(serializedSelection, ",");
|
||||
}
|
||||
|
||||
string const& CompilerOutputs::componentName(bool CompilerOutputs::* _component)
|
||||
{
|
||||
solAssert(_component, "");
|
||||
@ -196,6 +206,17 @@ bool CombinedJsonRequests::operator==(CombinedJsonRequests const& _other) const
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
ostream& operator<<(ostream& _out, CombinedJsonRequests const& _requests)
|
||||
{
|
||||
vector<string> serializedRequests;
|
||||
for (auto&& [componentName, component]: CombinedJsonRequests::componentMap())
|
||||
if (_requests.*component)
|
||||
serializedRequests.push_back(CombinedJsonRequests::componentName(component));
|
||||
|
||||
return _out << joinHumanReadable(serializedRequests, ",");
|
||||
}
|
||||
|
||||
string const& CombinedJsonRequests::componentName(bool CombinedJsonRequests::* _component)
|
||||
{
|
||||
solAssert(_component, "");
|
||||
|
@ -55,6 +55,7 @@ struct CompilerOutputs
|
||||
{
|
||||
bool operator!=(CompilerOutputs const& _other) const noexcept { return !(*this == _other); }
|
||||
bool operator==(CompilerOutputs const& _other) const noexcept;
|
||||
friend std::ostream& operator<<(std::ostream& _out, CompilerOutputs const& _requests);
|
||||
|
||||
static std::string const& componentName(bool CompilerOutputs::* _component);
|
||||
static auto const& componentMap()
|
||||
@ -100,6 +101,7 @@ struct CombinedJsonRequests
|
||||
{
|
||||
bool operator!=(CombinedJsonRequests const& _other) const noexcept { return !(*this == _other); }
|
||||
bool operator==(CombinedJsonRequests const& _other) const noexcept;
|
||||
friend std::ostream& operator<<(std::ostream& _out, CombinedJsonRequests const& _requests);
|
||||
|
||||
static std::string const& componentName(bool CombinedJsonRequests::* _component);
|
||||
static auto const& componentMap()
|
||||
|
Loading…
Reference in New Issue
Block a user