Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

add visitor pattern implementation for Poco::Dynamic::Var #4144

Merged
merged 3 commits into from
Nov 11, 2023

Conversation

bas524
Copy link
Contributor

@bas524 bas524 commented Sep 9, 2023

Complimentary for #2291
It's a simple implementation of runtime visitor
Main idea is using unique handler for every type which can be saved in the Dynamic::Var

As handler you can use lambda, std::function and function pointer with signature:

std::function<void(const T&)>;
void (*)(const T &);

example

// ...
Visitor visitor;
visitor.addHandler<std::string>([](const std::string& s) { std::cout << s; });
// ...
Poco::Dynamic::Var v = getVar();
if (visitor.visit(v))
{
    // successfully processed
}

@obiltschnig obiltschnig self-assigned this Sep 9, 2023
@obiltschnig obiltschnig added this to the Release 1.13.0 milestone Sep 9, 2023
Copy link
Member

@aleks-f aleks-f left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@bas524 we need that CI passing. rebase your branch with devel to get the most recent changes and I will restart any failing CI (sometimes they just timeout) that does not show a serious bug

Foundation/include/Poco/Dynamic/VarVisitor.h Outdated Show resolved Hide resolved
Foundation/include/Poco/Dynamic/VarVisitor.h Outdated Show resolved Hide resolved
Foundation/src/VarVisitor.cpp Outdated Show resolved Hide resolved
Foundation/testsuite/src/VarTest.cpp Outdated Show resolved Hide resolved
@bas524
Copy link
Contributor Author

bas524 commented Oct 24, 2023

@bas524 we need that CI passing. rebase your branch with devel to get the most recent changes and I will restart any failing CI (sometimes they just timeout) that does not show a serious bug

Hi! I did it, but ci has failed and I think that my PR is not a reason

@aleks-f aleks-f merged commit 6a5387e into pocoproject:devel Nov 11, 2023
14 of 15 checks passed
@bas524 bas524 deleted the varvisitor branch November 13, 2023 08:23
aleks-f pushed a commit that referenced this pull request Nov 23, 2023
* 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>
aleks-f pushed a commit that referenced this pull request Nov 27, 2023
* 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>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants