poco/Foundation/src/VarVisitor.cpp
Alexander B 6a5387ec21
add visitor pattern implementation for Poco::Dynamic::Var (#4144)
* add visitor pattern implementation for Poco::Dynamic::Var

* add changes to Makefile and vcxproj for VarVisitor

* resolve review comments Poco::Dynamic::Var

---------

Co-authored-by: Alexander B <bas524@ya.ru>
2023-11-11 19:18:12 +01:00

33 lines
537 B
C++

//
// VarVisitor.cpp
//
// Library: Foundation
// Package: Dynamic
// Module: VarVisitor
//
//
// Copyright (c) 2023, Applied Informatics Software Engineering GmbH.
// and Contributors.
//
// SPDX-License-Identifier: BSL-1.0
//
#include "Poco/Dynamic/VarVisitor.h"
namespace Poco {
namespace Dynamic {
bool Visitor::visit(const Var &x) const
{
bool wasHandled = false;
auto it = _handlers.find(x.type());
if (it != _handlers.end())
{
it->second(x);
wasHandled = true;
}
return wasHandled;
}
} } // namespace Poco::Dynamic