Skip to content

Commit

Permalink
resolve review comments Poco::Dynamic::Var
Browse files Browse the repository at this point in the history
  • Loading branch information
Alexander B committed Oct 22, 2023
1 parent f57a6e0 commit 35b7e22
Show file tree
Hide file tree
Showing 3 changed files with 16 additions and 15 deletions.
22 changes: 11 additions & 11 deletions Foundation/include/Poco/Dynamic/VarVisitor.h
Original file line number Diff line number Diff line change
Expand Up @@ -56,9 +56,9 @@ class Foundation_API Visitor
/// VarVisitor class.
{
std::unordered_map<Details::TypeInfoRef,
Details::HandlerCaller,
Details::TypeInfoHash,
Details::EqualRef> _handlers;
Details::HandlerCaller,
Details::TypeInfoHash,
Details::EqualRef> _handlers;

public:
template <typename T>
Expand All @@ -68,10 +68,10 @@ class Foundation_API Visitor
/// Returns true if handler was added
{
auto result = _handlers.emplace(std::ref(typeid(T)),
Details::HandlerCaller([handler = f](const Poco::Dynamic::Var& x)
{
handler(x.extract<T>());
}));
Details::HandlerCaller([handler = f](const Poco::Dynamic::Var& x)
{
handler(x.extract<T>());
}));
return result.second;
}

Expand All @@ -82,10 +82,10 @@ class Foundation_API Visitor
/// Returns true if handler was added
{
auto result = _handlers.emplace(std::ref(typeid(T)),
Details::HandlerCaller([handlerPointer = f](const Poco::Dynamic::Var& x)
{
handlerPointer(x.extract<T>());
}));
Details::HandlerCaller([handlerPointer = f](const Poco::Dynamic::Var& x)
{
handlerPointer(x.extract<T>());
}));
return result.second;
}

Expand Down
6 changes: 3 additions & 3 deletions Foundation/src/VarVisitor.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -19,14 +19,14 @@ namespace Dynamic {

bool Visitor::visit(const Var &x) const
{
bool wasHendled = false;
bool wasHandled = false;
auto it = _handlers.find(x.type());
if (it != _handlers.end())
{
it->second(x);
wasHendled = true;
wasHandled = true;
}
return wasHendled;
return wasHandled;
}

} } // namespace Poco::Dynamic
3 changes: 2 additions & 1 deletion Foundation/testsuite/src/VarTest.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -3114,7 +3114,8 @@ struct ProcessDummy
{
Var &v;
ProcessDummy(Var &var) : v(var) {}
void operator()(const Dummy &d) {
void operator()(const Dummy &d)
{
v = d;
}
};
Expand Down

0 comments on commit 35b7e22

Please sign in to comment.