Skip to content

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

Merged
aleks-f merged 3 commits intopocoproject:develfrom
bas524:varvisitor
Nov 11, 2023
Merged

add visitor pattern implementation for Poco::Dynamic::Var#4144
aleks-f merged 3 commits intopocoproject:develfrom
bas524:varvisitor

Conversation

@bas524
Copy link
Copy Markdown
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
Copy Markdown
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

@aleks-f aleks-f requested a review from obiltschnig October 16, 2023 18:59
@bas524
Copy link
Copy Markdown
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
@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